Decompiled source of SCP1 Pestily v1.1.2

BepInEx/plugins/com.binbin.TheBiohealer.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Content;
using Obeliskial_Essentials;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.binbin.TheBiohealer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Pestily, The Biohealer")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5adf3d2aeeefcc32c42a306765a0e2abc84f44c7")]
[assembly: AssemblyProduct("The Biohealer")]
[assembly: AssemblyTitle("com.binbin.TheBiohealer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TheBiohealer
{
	[BepInPlugin("com.binbin.TheBiohealer", "The Biohealer", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("AcrossTheObelisk.exe")]
	public class Plugin : BaseUnityPlugin
	{
		internal const int ModDate = 20240916;

		private readonly Harmony harmony = new Harmony("com.binbin.TheBiohealer");

		internal static ManualLogSource Log;

		public static string characterName = "Pestily";

		public static string subclassName = "Biohealer";

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"com.binbin.TheBiohealer 1.0.0 has loaded!");
			Essentials.RegisterMod("The Biohealer", "binbin", "Pestily, The Biohealer.", "1.0.0", 20240916, "https://github.com/binbinmods/pestilybiohealer", (string[])null, characterName, 100, new string[3] { "content", "hero", "trait" }, "", true);
			harmony.PatchAll();
		}
	}
	public class TraitFunctions
	{
		public static void TraitHeal(ref Character _character, ref Character _target, int healAmount, string traitName)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			int num = healAmount;
			if (_target.GetHpLeftForMax() < healAmount)
			{
				num = _target.GetHpLeftForMax();
			}
			if (num > 0)
			{
				_target.ModifyHp(num, true, true);
				CastResolutionForCombatText val = new CastResolutionForCombatText();
				val.heal = num;
				if (_target.HeroItem != null)
				{
					((CharacterItem)_target.HeroItem).ScrollCombatTextDamageNew(val);
					EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)_target.HeroItem).CharImageT, false, 0f);
				}
				else
				{
					((CharacterItem)_target.NPCItem).ScrollCombatTextDamageNew(val);
					EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)_target.NPCItem).CharImageT, false, 0f);
				}
				_target.SetEvent((EventActivation)15, (Character)null, 0, "");
				_character.SetEvent((EventActivation)14, _target, 0, "");
				((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
			}
		}

		public static void TraitHealHero(ref Character _character, ref Hero _target, int healAmount, string traitName)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			if (_target == null || !((Character)_target).IsHero || !((Character)_target).Alive)
			{
				return;
			}
			int num = healAmount;
			if (((Character)_target).GetHpLeftForMax() < healAmount)
			{
				num = ((Character)_target).GetHpLeftForMax();
			}
			if (num > 0)
			{
				((Character)_target).ModifyHp(num, true, true);
				CastResolutionForCombatText val = new CastResolutionForCombatText();
				val.heal = num;
				if (((Character)_target).HeroItem != null)
				{
					((CharacterItem)((Character)_target).HeroItem).ScrollCombatTextDamageNew(val);
					EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)((Character)_target).HeroItem).CharImageT, false, 0f);
				}
				else
				{
					((CharacterItem)((Character)_target).NPCItem).ScrollCombatTextDamageNew(val);
					EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)((Character)_target).NPCItem).CharImageT, false, 0f);
				}
				((Character)_target).SetEvent((EventActivation)15, (Character)null, 0, "");
				_character.SetEvent((EventActivation)14, (Character)(object)_target, 0, "");
				((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
			}
		}

		public static void WhenYouPlayXRefund1Energy(CardType cardType, ref Character _character, string traitName, string traitID)
		{
		}

		public static void ApplyAuraCurseTo(string auraCurse, int amount, bool allHeroFlag, bool allNpcFlag, bool randomHeroFlag, bool randomNpcFlag, ref Character _character, ref Hero[] teamHeroes, ref NPC[] teamNpc, string traitName, string soundEffect)
		{
			if (allNpcFlag)
			{
				for (int i = 0; i < teamNpc.Length; i++)
				{
					if (teamNpc[i] != null && ((Character)teamNpc[i]).Alive)
					{
						((Character)teamNpc[i]).SetAuraTrait(_character, auraCurse, amount);
						if (((Character)teamNpc[i]).NPCItem != null)
						{
							((CharacterItem)((Character)teamNpc[i]).NPCItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
							EffectsManager.Instance.PlayEffectAC(soundEffect, true, ((CharacterItem)((Character)teamNpc[i]).NPCItem).CharImageT, false, 0f);
						}
					}
				}
			}
			if (!allHeroFlag)
			{
				return;
			}
			for (int j = 0; j < teamHeroes.Length; j++)
			{
				if (teamHeroes[j] != null && ((Character)teamHeroes[j]).Alive)
				{
					((Character)teamHeroes[j]).SetAuraTrait(_character, auraCurse, amount);
					if (((Character)teamHeroes[j]).NPCItem != null)
					{
						((CharacterItem)((Character)teamHeroes[j]).HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
						EffectsManager.Instance.PlayEffectAC(soundEffect, true, ((CharacterItem)((Character)teamHeroes[j]).NPCItem).CharImageT, false, 0f);
					}
				}
			}
		}

		public static void WhenYouGainXGainY(string gainedAuraCurse, string desiredAuraCurse, string appliedAuraCurse, int n_charges_incoming, int n_bonus_charges, float multiplier, ref Character _character, string traitName)
		{
			if ((Object)(object)MatchManager.Instance != (Object)null && gainedAuraCurse != null && (Object)(object)_character.HeroData != (Object)null && gainedAuraCurse == desiredAuraCurse)
			{
				int num = Mathf.RoundToInt((float)(n_charges_incoming + n_bonus_charges) * multiplier);
				_character.SetAuraTrait(_character, appliedAuraCurse, num);
				((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
			}
		}

		public static void WhenYouPlayXGainY(CardType desiredCardType, string desiredAuraCurse, int n_charges, CardData castedCard, ref Character _character, string traitName)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MatchManager.Instance != (Object)null && (Object)(object)castedCard != (Object)null && (Object)(object)_character.HeroData != (Object)null && castedCard.GetCardTypes().Contains(desiredCardType))
			{
				_character.SetAuraTrait(_character, desiredAuraCurse, n_charges);
				((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
			}
		}

		public static void ReduceCostByStacks(CardType cardType, string auraCurseName, int n_charges, ref Character _character, ref List<string> heroHand, ref List<CardData> cardDataList, string traitName, bool applyToAllCards)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_character.HeroData != (Object)null))
			{
				return;
			}
			int num = Mathf.FloorToInt((float)(_character.EffectCharges(auraCurseName) / n_charges));
			if (num <= 0)
			{
				return;
			}
			for (int i = 0; i < heroHand.Count; i++)
			{
				CardData cardData = MatchManager.Instance.GetCardData(heroHand[i]);
				if (cardData.GetCardFinalCost() > 0 && (cardData.GetCardTypes().Contains(cardType) || applyToAllCards))
				{
					cardDataList.Add(cardData);
				}
			}
			for (int j = 0; j < cardDataList.Count; j++)
			{
				CardData obj = cardDataList[j];
				obj.EnergyReductionTemporal += num;
				MatchManager.Instance.UpdateHandCards();
				CardItem cardFromTableByIndex = MatchManager.Instance.GetCardFromTableByIndex(cardDataList[j].InternalId);
				cardFromTableByIndex.PlayDissolveParticle();
				cardFromTableByIndex.ShowEnergyModification(-num);
				((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
				MatchManager.Instance.CreateLogCardModification(cardDataList[j].InternalId, MatchManager.Instance.GetHero(_character.HeroIndex));
			}
		}

		public static void IncreaseChargesByStacks(string auraCurseToModify, float stacks_per_bonus, string auraCurseDependent, ref Character _character, string traitName)
		{
			int auraCharges = _character.GetAuraCharges(auraCurseDependent);
			int num = Mathf.FloorToInt((float)auraCharges / stacks_per_bonus);
			_character.ModifyAuraCurseQuantity(auraCurseToModify, num);
		}

		public static string TextChargesLeft(int currentCharges, int chargesTotal)
		{
			int num = currentCharges;
			int num2 = chargesTotal;
			return "<br><color=#FFF>" + num + "/" + num2 + "</color>";
		}

		public static void Duality(ref Character _character, ref CardData _castedCard, CardClass class1, CardClass class2, string traitName)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			if (MatchManager.Instance == null || _castedCard == null)
			{
				return;
			}
			TraitData traitData = Globals.Instance.GetTraitData(traitName);
			if (MatchManager.Instance.activatedTraits != null && MatchManager.Instance.activatedTraits.ContainsKey(traitName) && MatchManager.Instance.activatedTraits[traitName] > traitData.TimesPerTurn - 1)
			{
				return;
			}
			for (int i = 0; i < 2; i++)
			{
				CardClass val;
				CardClass val2;
				if (i == 0)
				{
					val = class1;
					val2 = class2;
				}
				else
				{
					val = class2;
					val2 = class1;
				}
				if (_castedCard.CardClass != val)
				{
					continue;
				}
				if (MatchManager.Instance.CountHeroHand(-1) == 0 || _character.HeroData == null)
				{
					break;
				}
				List<CardData> list = new List<CardData>();
				List<string> heroHand = MatchManager.Instance.GetHeroHand(_character.HeroIndex);
				int num = 0;
				for (int j = 0; j < heroHand.Count; j++)
				{
					CardData cardData = MatchManager.Instance.GetCardData(heroHand[j]);
					if (cardData != null && cardData.CardClass == val2 && _character.GetCardFinalCost(cardData) > num)
					{
						num = _character.GetCardFinalCost(cardData);
					}
				}
				if (num <= 0)
				{
					break;
				}
				for (int k = 0; k < heroHand.Count; k++)
				{
					CardData cardData2 = MatchManager.Instance.GetCardData(heroHand[k]);
					if (cardData2 != null && cardData2.CardClass == val2 && _character.GetCardFinalCost(cardData2) >= num)
					{
						list.Add(cardData2);
					}
				}
				if (list.Count <= 0)
				{
					break;
				}
				CardData val3 = ((list.Count != 1) ? list[MatchManager.Instance.GetRandomIntRange(0, list.Count, "trait", "")] : list[0]);
				if (val3 != null)
				{
					if (!MatchManager.Instance.activatedTraits.ContainsKey(traitName))
					{
						MatchManager.Instance.activatedTraits.Add(traitName, 1);
					}
					else
					{
						Dictionary<string, int> activatedTraits = MatchManager.Instance.activatedTraits;
						int value = activatedTraits[traitName] + 1;
						activatedTraits[traitName] = value;
					}
					MatchManager.Instance.SetTraitInfoText();
					int num2 = 1;
					val3.EnergyReductionTemporal += num2;
					MatchManager.Instance.GetCardFromTableByIndex(val3.InternalId).ShowEnergyModification(-num2);
					MatchManager.Instance.UpdateHandCards();
					((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, "") + TextChargesLeft(MatchManager.Instance.activatedTraits[traitName], traitData.TimesPerTurn), (CombatScrollEffectType)7);
					MatchManager.Instance.CreateLogCardModification(val3.InternalId, MatchManager.Instance.GetHero(_character.HeroIndex));
				}
				break;
			}
		}

		public static void PermanentyReduceXWhenYouPlayY(ref Character _character, ref CardData _castedCard, CardType cardTypeToReduce, CardType whenYouPlayThis, int amountToReduce, string traitName)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Invalid comparison between Unknown and I4
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if (MatchManager.Instance == null || _castedCard == null || !_castedCard.GetCardTypes().Contains(whenYouPlayThis))
			{
				return;
			}
			TraitData traitData = Globals.Instance.GetTraitData(traitName);
			if ((MatchManager.Instance.activatedTraits != null && MatchManager.Instance.activatedTraits.ContainsKey(traitName) && MatchManager.Instance.activatedTraits[traitName] > traitData.TimesPerTurn - 1) || MatchManager.Instance.CountHeroHand(-1) == 0 || _character.HeroData == null)
			{
				return;
			}
			List<CardData> list = new List<CardData>();
			List<string> heroHand = MatchManager.Instance.GetHeroHand(_character.HeroIndex);
			if ((int)cardTypeToReduce == 0)
			{
				for (int i = 0; i < heroHand.Count; i++)
				{
					CardData cardData = MatchManager.Instance.GetCardData(heroHand[i]);
					if (cardData != null)
					{
						list.Add(cardData);
					}
				}
			}
			else
			{
				for (int j = 0; j < heroHand.Count; j++)
				{
					CardData cardData2 = MatchManager.Instance.GetCardData(heroHand[j]);
					if (cardData2 != null && cardData2.GetCardTypes().Contains(cardTypeToReduce))
					{
						list.Add(cardData2);
					}
				}
			}
			if (list.Count != 0)
			{
				if (!MatchManager.Instance.activatedTraits.ContainsKey(traitName))
				{
					MatchManager.Instance.activatedTraits.Add(traitName, 1);
				}
				else
				{
					Dictionary<string, int> activatedTraits = MatchManager.Instance.activatedTraits;
					int value = activatedTraits[traitName] + 1;
					activatedTraits[traitName] = value;
				}
				CardData val = list[MatchManager.Instance.GetRandomIntRange(0, list.Count, "trait", "")];
				val.EnergyReductionPermanent += amountToReduce;
				MatchManager.Instance.GetCardFromTableByIndex(val.InternalId).ShowEnergyModification(-amountToReduce);
				MatchManager.Instance.UpdateHandCards();
				((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, "") + TextChargesLeft(MatchManager.Instance.activatedTraits[traitName], traitData.TimesPerTurn), (CombatScrollEffectType)7);
				MatchManager.Instance.CreateLogCardModification(val.InternalId, MatchManager.Instance.GetHero(_character.HeroIndex));
			}
		}

		public static int CountAllStacks(string auraCurse, Hero[] teamHero, NPC[] teamNpc)
		{
			int num = 0;
			for (int i = 0; i < teamHero.Length; i++)
			{
				if (teamHero[i] != null && (Object)(object)((Character)teamHero[i]).HeroData != (Object)null && ((Character)teamHero[i]).Alive)
				{
					num += ((Character)teamHero[i]).GetAuraCharges(auraCurse);
				}
			}
			for (int j = 0; j < teamNpc.Length; j++)
			{
				if (teamNpc[j] != null && ((Character)teamNpc[j]).Alive)
				{
					num += ((Character)teamNpc[j]).GetAuraCharges(auraCurse);
				}
			}
			return num;
		}

		public static void CastTargetCard(string cardToCast)
		{
			CardData cardData = Globals.Instance.GetCardData(cardToCast, true);
			((MonoBehaviour)MatchManager.Instance).StartCoroutine(MatchManager.Instance.CastCard((CardItem)null, true, cardData, 0, -1, true));
		}
	}
	[HarmonyPatch]
	internal class Traits
	{
		public static string[] myTraitList = new string[5] { "pestilybioheal", "pestilyshadowpoison", "pestilyantidote", "pestilyhealingtoxins", "pestilytoxichealing" };

		public static int level5ActivationCounter = 0;

		public static int level5MaxActivations = 3;

		public static void DoCustomTrait(string _trait, ref Trait __instance)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			EventActivation value = Traverse.Create((object)__instance).Field("theEvent").GetValue<EventActivation>();
			Character _character = Traverse.Create((object)__instance).Field("character").GetValue<Character>();
			Character value2 = Traverse.Create((object)__instance).Field("target").GetValue<Character>();
			int value3 = Traverse.Create((object)__instance).Field("auxInt").GetValue<int>();
			string value4 = Traverse.Create((object)__instance).Field("auxString").GetValue<string>();
			CardData _castedCard = Traverse.Create((object)__instance).Field("castedCard").GetValue<CardData>();
			Traverse.Create((object)__instance).Field("character").SetValue((object)_character);
			Traverse.Create((object)__instance).Field("target").SetValue((object)value2);
			Traverse.Create((object)__instance).Field("theEvent").SetValue((object)value);
			Traverse.Create((object)__instance).Field("auxInt").SetValue((object)value3);
			Traverse.Create((object)__instance).Field("auxString").SetValue((object)value4);
			Traverse.Create((object)__instance).Field("castedCard").SetValue((object)_castedCard);
			TraitData traitData = Globals.Instance.GetTraitData(_trait);
			List<CardData> list = new List<CardData>();
			List<string> heroHand = MatchManager.Instance.GetHeroHand(_character.HeroIndex);
			Hero[] teamHero = MatchManager.Instance.GetTeamHero();
			NPC[] teamNPC = MatchManager.Instance.GetTeamNPC();
			switch (_trait)
			{
			case "pestilybioheal":
			{
				string traitName = "pestilybioheal";
				int num2 = TraitFunctions.CountAllStacks("poison", teamHero, teamNPC);
				int healAmount = Functions.FuncRoundToInt((float)((double)num2 * 0.20000000298023224));
				for (int i = 0; i < teamHero.Length; i++)
				{
					Plugin.Log.LogDebug((object)"Binbin - PestilyBiohealer - Biohealing");
					TraitFunctions.TraitHealHero(ref _character, ref teamHero[i], healAmount, traitName);
				}
				break;
			}
			case "pestilyshadowpoison":
				if (value4 == "dark")
				{
					int num = value3 * 2;
					value2.SetAuraTrait(_character, "poison", num);
				}
				break;
			case "pestilyantidote":
				_character.SetAuraTrait(_character, "poison", 20);
				break;
			case "pestilyhealingtoxins":
				TraitFunctions.PermanentyReduceXWhenYouPlayY(ref _character, ref _castedCard, (CardType)11, (CardType)12, 1, _trait);
				if (level5ActivationCounter < level5MaxActivations)
				{
					if (_castedCard.GetCardTypes().Contains((CardType)11))
					{
						TraitFunctions.CastTargetCard("healingrainb");
					}
					level5ActivationCounter++;
				}
				break;
			case "pestilytoxichealing":
				TraitFunctions.PermanentyReduceXWhenYouPlayY(ref _character, ref _castedCard, (CardType)12, (CardType)11, 1, _trait);
				if (level5ActivationCounter <= level5MaxActivations)
				{
					if (_castedCard.GetCardTypes().Contains((CardType)12))
					{
						TraitFunctions.CastTargetCard("acidrainb");
					}
					level5ActivationCounter++;
				}
				break;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Trait), "DoTrait")]
		public static bool DoTrait(EventActivation _theEvent, string _trait, Character _character, Character _target, int _auxInt, string _auxString, CardData _castedCard, ref Trait __instance)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MatchManager.Instance == (Object)null)
			{
				return false;
			}
			Traverse.Create((object)__instance).Field("character").SetValue((object)_character);
			Traverse.Create((object)__instance).Field("target").SetValue((object)_target);
			Traverse.Create((object)__instance).Field("theEvent").SetValue((object)_theEvent);
			Traverse.Create((object)__instance).Field("auxInt").SetValue((object)_auxInt);
			Traverse.Create((object)__instance).Field("auxString").SetValue((object)_auxString);
			Traverse.Create((object)__instance).Field("castedCard").SetValue((object)_castedCard);
			if (Content.medsCustomTraitsSource.Contains(_trait) && myTraitList.Contains(_trait))
			{
				DoCustomTrait(_trait, ref __instance);
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "SetEvent")]
		public static void SetEventPrefix(ref Character __instance, ref EventActivation theEvent, Character target = null)
		{
			if ((int)theEvent == 3 && __instance.IsHero && (__instance.HaveTrait("pestilyhealingtoxins") || __instance.HaveTrait("pestilytoxichealing")))
			{
				level5ActivationCounter = 0;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(AtOManager), "GlobalAuraCurseModificationByTraitsAndItems")]
		public static void GlobalAuraCurseModificationByTraitsAndItemsPostfix(ref AtOManager __instance, ref AuraCurseData __result, string _type, string _acId, Character _characterCaster, Character _characterTarget)
		{
			if (!(_acId == "poison"))
			{
				return;
			}
			if (_type == "set")
			{
				if (_characterTarget != null && __instance.CharacterHaveTrait(_characterTarget.SubclassName, "pestilyshadowpoison"))
				{
					__result.AuraDamageType = (DamageType)9;
					int auraDamageIncreasedTotal = Mathf.FloorToInt((float)_characterTarget.GetAuraCharges("poison") / 10f);
					__result.AuraDamageIncreasedTotal = auraDamageIncreasedTotal;
				}
				if (_characterTarget != null && __instance.CharacterHaveTrait(_characterTarget.SubclassName, "pestilyantidote"))
				{
					__result.MaxCharges = 300;
					__result.ProduceDamageWhenConsumed = false;
					__result.DamageWhenConsumedPerCharge = 0f;
					Plugin.Log.LogInfo((object)("Binbin - PestilyBiohealer - Setting Poison: " + __result.DamageWhenConsumedPerCharge));
				}
			}
			if (_type == "consume" && _characterCaster != null && __instance.CharacterHaveTrait(_characterCaster.SubclassName, "pestilyantidote"))
			{
				Plugin.Log.LogInfo((object)"Binbin - PestilyBiohealer - Consuming Poison");
				__result.MaxCharges = 300;
				__result.ProduceDamageWhenConsumed = false;
				__result.DamageWhenConsumedPerCharge = 0f;
				Plugin.Log.LogInfo((object)("Binbin - PestilyBiohealer - Consuming Poison: " + __result.DamageWhenConsumedPerCharge));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "com.binbin.TheBiohealer";

		public const string PLUGIN_NAME = "The Biohealer";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}