Decompiled source of Too Many Perks v1.5.4
BepInEx/plugins/com.binbin.PerkManager.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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.PerkManager")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.5.4.0")] [assembly: AssemblyInformationalVersion("1.5.4+f731301898c03c06c8200c1e982c30314ec2168d")] [assembly: AssemblyProduct("Custom Perks")] [assembly: AssemblyTitle("com.binbin.PerkManager")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.4.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 PerkManager { public class CustomFunctions { public enum AppliesTo { None, Global, Monsters, Heroes, ThisHero } public enum CharacterHas { Perk, Item, Trait } public static void PLog(string s) { Plugin.Log.LogDebug((object)(Plugin.debugBase + s)); } 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, false); } else { ((CharacterItem)_target.NPCItem).ScrollCombatTextDamageNew(val); EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)_target.NPCItem).CharImageT, false, 0f, false); } _target.SetEvent((EventActivation)15, (Character)null, 0, "", (Character)null); _character.SetEvent((EventActivation)14, _target, 0, "", (Character)null); ((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, false); } else { ((CharacterItem)((Character)_target).NPCItem).ScrollCombatTextDamageNew(val); EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)((Character)_target).NPCItem).CharImageT, false, 0f, false); } ((Character)_target).SetEvent((EventActivation)15, (Character)null, 0, "", (Character)null); _character.SetEvent((EventActivation)14, (Character)(object)_target, 0, "", (Character)null); ((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, false); } } } } 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, false); } } } } 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_0067: 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], true); 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 AddImmunityToHero(string immunity, ref Hero _character) { if (!((Character)_character).AuracurseImmune.Contains(immunity)) { ((Character)_character).AuracurseImmune.Add(immunity); } } 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 AuraCurseData GetAuraCurseData(string ac) { return Globals.Instance.GetAuraCurseData(ac); } 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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], true); 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], true); 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 reduceThis, CardType whenYouPlayThis, int amountToReduce, string traitName) { //IL_0077: 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_0143: 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) || !_castedCard.GetCardTypes().Contains(whenYouPlayThis) || 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)reduceThis == 0) { for (int i = 0; i < heroHand.Count; i++) { CardData cardData = MatchManager.Instance.GetCardData(heroHand[i], true); if (cardData != null) { list.Add(cardData); } } } else { for (int j = 0; j < heroHand.Count; j++) { CardData cardData2 = MatchManager.Instance.GetCardData(heroHand[j], true); if (cardData2 != null && cardData2.GetCardTypes().Contains(reduceThis)) { list.Add(cardData2); } } } 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 DealIndirectDamageToAllMonsters(DamageType damageType, int amount) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) Plugin.Log.LogDebug((object)(Plugin.debugBase + "Dealing Indirect Damage")); NPC[] teamNPC = MatchManager.Instance.GetTeamNPC(); foreach (NPC val in teamNPC) { if (val != null && ((Character)val).Alive && !((Character)val).IsHero) { ((Character)val).IndirectDamage(damageType, amount, (AudioClip)null, "", "", ""); } } } public static Character GetRandomCharacter(Character[] array) { if (array == null) { Plugin.Log.LogDebug((object)(Plugin.debugBase + "Null Array")); } List<Character> list = new List<Character>(); for (int i = 0; i < array.Length; i++) { if (array[i] == null) { Plugin.Log.LogDebug((object)(Plugin.debugBase + "Null index")); continue; } Character val = array[i]; if (val.Alive && val != null) { list.Add(val); } } if (list.Count == 0) { return null; } int randomIntRange = MatchManager.Instance.GetRandomIntRange(0, list.Count, "default", ""); if (randomIntRange < list.Count) { return list[randomIntRange]; } if (list[randomIntRange] == null) { return null; } return list[0]; } public static bool IsLivingHero(Character _character) { return _character != null && _character.Alive && _character.IsHero; } public static bool IsLivingNPC(Character _character) { return _character != null && _character.Alive && !_character.IsHero; } public static bool CharacterHasPerkForSet(string perkName, bool flag, AtOManager __instance, Character _characterTarget) { return flag && _characterTarget != null && __instance.CharacterHavePerk(_characterTarget.SubclassName, Plugin.perkBase + perkName); } public static bool CharacterHasPerkForConsume(string perkName, bool flag, AtOManager __instance, Character _characterCaster) { return flag && _characterCaster != null && __instance.CharacterHavePerk(_characterCaster.SubclassName, Plugin.perkBase + perkName); } public static bool TeamHasPerkForSet(string perkName, bool flag, AtOManager __instance, Character _characterTarget) { return _characterTarget != null && __instance.TeamHavePerk(Plugin.perkBase + perkName) && flag; } public static bool TeamHasPerk(string perkName) { return AtOManager.Instance.TeamHavePerk(Plugin.perkBase + perkName); } public static bool TeamHasPerkForConsume(string perkName, bool flag, AtOManager __instance, Character _characterCaster) { return _characterCaster != null && __instance.TeamHavePerk(Plugin.perkBase + perkName) && flag; } public static bool CharacterObjectHavePerk(Character _character, string _perk_id) { if (_character == null) { return false; } return AtOManager.Instance.CharacterHavePerk(_character.SubclassName, Plugin.perkBase + _perk_id) || AtOManager.Instance.CharacterHavePerk(_character.SubclassName, _perk_id); } 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)); } public static bool IfCharacterHas(Character characterOfInterest, CharacterHas characterHas, string id, AppliesTo appliesTo = AppliesTo.Global, string _type = "", string onlyThisType = "") { if (appliesTo == AppliesTo.None || characterOfInterest == null || (Object)(object)AtOManager.Instance == (Object)null) { return false; } if (_type != "" && onlyThisType != _type) { return false; } bool flag = (characterOfInterest.IsHero && appliesTo == AppliesTo.Heroes) || (!characterOfInterest.IsHero && appliesTo == AppliesTo.Monsters) || appliesTo == AppliesTo.Global || (appliesTo == AppliesTo.ThisHero && characterOfInterest.IsHero); bool flag2 = false; if (appliesTo == AppliesTo.ThisHero) { switch (characterHas) { case CharacterHas.Item: flag2 = AtOManager.Instance.CharacterHaveItem(characterOfInterest.SubclassName, Plugin.perkBase + id) || AtOManager.Instance.CharacterHaveItem(characterOfInterest.SubclassName, id); break; case CharacterHas.Perk: flag2 = AtOManager.Instance.CharacterHavePerk(characterOfInterest.SubclassName, Plugin.perkBase + id) || AtOManager.Instance.CharacterHavePerk(characterOfInterest.SubclassName, id); break; case CharacterHas.Trait: flag2 = AtOManager.Instance.CharacterHaveTrait(characterOfInterest.SubclassName, Plugin.perkBase + id) || AtOManager.Instance.CharacterHaveTrait(characterOfInterest.SubclassName, id); break; } } else { switch (characterHas) { case CharacterHas.Item: flag2 = AtOManager.Instance.TeamHaveItem(Plugin.perkBase + id, -1, false) || AtOManager.Instance.TeamHaveItem(id, -1, false); break; case CharacterHas.Perk: flag2 = AtOManager.Instance.TeamHavePerk(Plugin.perkBase + id) || AtOManager.Instance.TeamHavePerk(id); break; case CharacterHas.Trait: flag2 = AtOManager.Instance.TeamHaveTrait(Plugin.perkBase + id) || AtOManager.Instance.TeamHaveTrait(id); break; } } if (flag2 && flag) { Plugin.LogDebug("Applying Perk - " + id); } return flag2 && flag; } } [HarmonyPatch] public class PerkBackgroundExtension { [HarmonyPrefix] [HarmonyPatch(typeof(PerkNodeAmplify), "SetForNodes")] public static bool SetForNodesPrefix(PerkNodeAmplify __instance, int _numNodes) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) PolygonCollider2D component = ((Component)__instance).GetComponent<PolygonCollider2D>(); float num = -0.7f * (float)(_numNodes - 1); switch (_numNodes) { case 2: ((Component)__instance.bg2).gameObject.SetActive(true); ((Component)__instance.bg3).gameObject.SetActive(false); ((Component)__instance.bg4).gameObject.SetActive(false); __instance.amplifyNodes.localPosition = new Vector3(num, __instance.amplifyNodes.localPosition.y, __instance.amplifyNodes.localPosition.z); component.points = ((Component)__instance.bg2).GetComponent<PolygonCollider2D>().points; break; case 3: ((Component)__instance.bg2).gameObject.SetActive(false); ((Component)__instance.bg3).gameObject.SetActive(true); ((Component)__instance.bg4).gameObject.SetActive(false); __instance.amplifyNodes.localPosition = new Vector3(num, __instance.amplifyNodes.localPosition.y, __instance.amplifyNodes.localPosition.z); component.points = ((Component)__instance.bg3).GetComponent<PolygonCollider2D>().points; break; default: { ((Component)__instance.bg2).gameObject.SetActive(false); ((Component)__instance.bg3).gameObject.SetActive(false); ((Component)__instance.bg4).gameObject.SetActive(true); __instance.amplifyNodes.localPosition = new Vector3(num, __instance.amplifyNodes.localPosition.y, __instance.amplifyNodes.localPosition.z); float num2 = (float)_numNodes / 4f; ((Component)__instance.bg4).transform.localScale = new Vector3(num2, 1f, 1f); PolygonCollider2D component2 = ((Component)__instance.bg4).GetComponent<PolygonCollider2D>(); Vector2[] points = component2.points; for (int i = 0; i < points.Length; i++) { points[i] = new Vector2(points[i].x * num2, points[i].y); } component.points = points; break; } } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(PerkTree), "DrawTree")] public static void DrawTreePrefix() { Plugin.Log.LogDebug((object)(Plugin.debugBase + "Draw Tree")); } } [HarmonyPatch] public class PerkPatches { public static int[] paralyzeCounters = new int[4]; public static bool blockShieldFlag = false; public static int blockCount = 0; public static int shieldCount = 0; public static bool mark1dFlag = true; public static bool poison2gFlag = true; public static bool bleed2gFlag = true; public static bool thorns1eFlag = true; public static bool shackle1fFlag = false; public static bool insulate1dFlag = false; public static bool isDamagePreviewActive = false; public static bool isCalculateDamageActive = false; public static int infiniteProctection = 0; public static int infiniteProctectionPowerful = 0; [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "BeginAdventure")] public static void BeginAdventurePostfix(ref AtOManager __instance) { Hero[] value = Traverse.Create((object)__instance).Field("teamAtO").GetValue<Hero[]>(); foreach (Hero hero in value) { HandleExpPerks(hero); } } public static void HandleExpPerks(Hero _hero) { int num = 0; int num2 = 10; int num3 = 40; if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_hero, "exp0")) { num += num2; } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_hero, "exp1")) { num += num2; } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_hero, "exp2")) { num += num2; } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_hero, "exp3")) { num += num3; } ((Character)_hero).GrantExperience(num); } [HarmonyPrefix] [HarmonyPatch(typeof(AtOManager), "HeroLevelUp")] public static void HeroLevelUpPrefix(ref AtOManager __instance, int heroIndex, string traitId) { Hero[] value = Traverse.Create((object)__instance).Field("teamAtO").GetValue<Hero[]>(); Hero val = value[heroIndex]; if (CustomFunctions.CharacterObjectHavePerk((Character)(object)val, "health6b")) { int num = 12; ((Character)value[heroIndex]).ModifyMaxHP(num); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)val, "health6c")) { int num2 = -14; ((Character)value[heroIndex]).ModifyMaxHP(num2); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)val, "shards5b")) { int num3 = 125; AtOManager.Instance.GivePlayer(1, num3, "", "", true, false); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)val, "currency6b")) { int num4 = 125; AtOManager.Instance.GivePlayer(0, num4, "", "", true, false); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)val, "resistance5b")) { Plugin.LogDebug("Attempting to add resistances"); int num5 = 4; string text = Plugin.perkBase + "resistance5b"; PerkData perkData = Globals.Instance.GetPerkData(text); perkData.ResistModified = (DamageType)10; perkData.ResistModifiedValue += num5; Dictionary<string, PerkData> value2 = Traverse.Create((object)Globals.Instance).Field("_PerksSource").GetValue<Dictionary<string, PerkData>>(); if (value2.ContainsKey(text)) { Plugin.LogDebug("Setting perk dictionary"); value2[text] = perkData; } Traverse.Create((object)Globals.Instance).Field("_PerksSource").SetValue((object)value2); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)val, "resistance5c")) { Plugin.LogDebug("Attempting to add resistances"); int num6 = -4; string text2 = Plugin.perkBase + "resistance5b"; PerkData perkData2 = Globals.Instance.GetPerkData(text2); perkData2.ResistModified = (DamageType)10; perkData2.ResistModifiedValue += num6; Dictionary<string, PerkData> value3 = Traverse.Create((object)Globals.Instance).Field("_PerksSource").GetValue<Dictionary<string, PerkData>>(); if (value3.ContainsKey(text2)) { Plugin.LogDebug("Setting perk dictionary"); value3[text2] = perkData2; } Traverse.Create((object)Globals.Instance).Field("_PerksSource").SetValue((object)value3); } HandleExpPerks(val); } [HarmonyPostfix] [HarmonyPatch(typeof(MatchManager), "GenerateHeroes")] public static void GenerateHeroesPostfix(ref MatchManager __instance) { Hero[] teamHero = MatchManager.Instance.GetTeamHero(); for (int i = 0; i < teamHero.Length; i++) { if (teamHero[i] != null) { Hero _character = teamHero[i]; if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "mitigate1d")) { Plugin.LogDebug("Hero has mitigate1d"); } Plugin.LogDebug("Adding Immunities weak1d and more"); if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "weak1d")) { CustomFunctions.AddImmunityToHero("weak", ref _character); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "disarm1a")) { CustomFunctions.AddImmunityToHero("disarm", ref _character); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "silence1a")) { CustomFunctions.AddImmunityToHero("silence", ref _character); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "shackle1b")) { CustomFunctions.AddImmunityToHero("shackle", ref _character); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "stanza0e")) { CustomFunctions.AddImmunityToHero("stanzai", ref _character); CustomFunctions.AddImmunityToHero("stanzaiii", ref _character); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "energize1e")) { CustomFunctions.AddImmunityToHero("fatigue", ref _character); } if (CustomFunctions.CharacterObjectHavePerk((Character)(object)_character, "vulnerable0d")) { CustomFunctions.AddImmunityToHero("vulnerable", ref _character); CustomFunctions.AddImmunityToHero("reinforce", ref _character); CustomFunctions.AddImmunityToHero("insulate", ref _character); CustomFunctions.AddImmunityToHero("courage", ref _character); } } } Traverse.Create((object)MatchManager.Instance).Field("teamHero").SetValue((object)teamHero); } [HarmonyPostfix] [HarmonyPatch(typeof(Globals), "GetCostReroll")] public static void GetRerollCostPostfix(ref int __result) { if (CustomFunctions.TeamHasPerk("currency6d")) { __result = Mathf.RoundToInt(0.75f * (float)__result); } } [HarmonyPostfix] [HarmonyPatch(typeof(Globals), "GetDivinationCost")] public static void GetDivinationCost(ref Globals __instance, ref int __result) { if (CustomFunctions.TeamHasPerk("currency6e")) { __result = Mathf.RoundToInt(0.85f * (float)__result); } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetTraitHealReceivedPercentBonus")] public static void GetTraitHealReceivedPercentBonusPostfix(ref Character __instance, ref float __result) { if (CustomFunctions.CharacterObjectHavePerk(__instance, "heal5c") && __instance.IsHero && __instance.Alive && __instance != null) { __result += 35f; } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "SetEvent")] public static void SetEventPrefix(ref Character __instance, EventActivation theEvent, ref int auxInt, Character target = null, string auxString = "") { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Invalid comparison between Unknown and I4 //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Invalid comparison between Unknown and I4 //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Invalid comparison between Unknown and I4 //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Invalid comparison between Unknown and I4 //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Invalid comparison between Unknown and I4 //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Invalid comparison between Unknown and I4 //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Invalid comparison between Unknown and I4 //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Invalid comparison between Unknown and I4 //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Invalid comparison between Unknown and I4 //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Invalid comparison between Unknown and I4 //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Invalid comparison between Unknown and I4 //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Invalid comparison between Unknown and I4 //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Invalid comparison between Unknown and I4 //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Invalid comparison between Unknown and I4 //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Invalid comparison between Unknown and I4 //IL_08f7: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Invalid comparison between Unknown and I4 //IL_0998: Unknown result type (might be due to invalid IL or missing references) //IL_099b: Invalid comparison between Unknown and I4 //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a28: Invalid comparison between Unknown and I4 //IL_0a8e: Unknown result type (might be due to invalid IL or missing references) //IL_0a91: Invalid comparison between Unknown and I4 //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0b8f: Invalid comparison between Unknown and I4 //IL_0c10: Unknown result type (might be due to invalid IL or missing references) //IL_0c12: Invalid comparison between Unknown and I4 if ((int)theEvent == 18 || (int)theEvent == 26 || __instance == null || (int)theEvent == 0) { return; } Hero[] teamHeroes = MatchManager.Instance.GetTeamHero(); NPC[] teamNpc = MatchManager.Instance.GetTeamNPC(); string name = Enum.GetName(typeof(EventActivation), theEvent); Plugin.LogDebug("SETEVENTPREFIX - START - " + name); if ((int)theEvent == 1) { infiniteProctection = 0; paralyzeCounters = new int[4]; mark1dFlag = true; } if ((int)theEvent == 23 && CustomFunctions.IsLivingNPC(__instance) && CustomFunctions.TeamHasPerk("mark1d") && __instance.HasEffect("mark") && auxString == "mark" && __instance.GetAuraCharges("mark") >= 10 && mark1dFlag) { Plugin.LogDebug("mark1d"); __instance.SetAura(__instance, CustomFunctions.GetAuraCurseData("taunt"), 2, false, (CardClass)11, false, true); mark1dFlag = false; } if ((int)theEvent == 23 && CustomFunctions.IsLivingNPC(target) && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "spark2g") && auxString == "spark") { Plugin.LogDebug("spark2g"); target.SetAura((Character)null, CustomFunctions.GetAuraCurseData("crack"), 2, false, (CardClass)11, true, true); } if ((int)theEvent == 23 && auxString == "powerful" && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.TeamHasPerk("powerful1d") && __instance.HasEffect("powerful")) { AuraCurseData auraCurseData = CustomFunctions.GetAuraCurseData("powerful"); if ((__instance.GetAuraCharges("powerful") == auraCurseData.MaxCharges || __instance.GetAuraCharges("powerful") == auraCurseData.MaxCharges + 7) && infiniteProctectionPowerful < 10) { Plugin.LogDebug("powerful1d"); __instance.SetAuraTrait(__instance, "vitality", 1); infiniteProctectionPowerful++; } } if ((int)theEvent == 23 && auxString == "shackle" && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "shackle1e") && __instance.HasEffect("shackle")) { Plugin.LogDebug("shackle1e"); int auraCharges = __instance.GetAuraCharges("shackle"); __instance.ModifyAuraCurseQuantity("dark", auraCharges); } if ((int)theEvent == 23 && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.IsLivingNPC(target) && CustomFunctions.CharacterObjectHavePerk(__instance, "poison2h") && auxString == "poison") { Plugin.LogDebug("poison2h"); int auraCharges2 = target.GetAuraCharges("poison"); float num = (target.HasEffect("rust") ? 0.3f : 0.2f); int num2 = Mathf.RoundToInt((float)auraCharges2 * num); target.IndirectDamage((DamageType)7, num2, (AudioClip)null, "", "", ""); } if ((int)theEvent == 23 && CustomFunctions.IsLivingHero(target) && target.HasEffect("courage") && CustomFunctions.CharacterObjectHavePerk(target, "courage1d") && auxString == "shield") { int auraCharges3 = target.GetAuraCharges("courage"); shieldCount++; if (shieldCount % 2 == 1 && shieldCount < 100) { Plugin.LogDebug("courage1d"); target.SetAura(__instance, CustomFunctions.GetAuraCurseData("shield"), auraCharges3, false, (CardClass)11, false, true); } } if ((int)theEvent == 23 && CustomFunctions.IsLivingHero(target) && target.HasEffect("reinforce") && CustomFunctions.CharacterObjectHavePerk(target, "reinforce1d") && auxString == "block") { int auraCharges4 = __instance.GetAuraCharges("reinforce"); blockCount++; if (blockCount % 2 == 1 && blockCount < 100) { Plugin.LogDebug("reinforce1d"); target.SetAura(__instance, CustomFunctions.GetAuraCurseData("block"), auraCharges4, false, (CardClass)11, false, true); } } if ((int)theEvent == 23 && CustomFunctions.IsLivingNPC(target) && CustomFunctions.TeamHasPerk("sight1e") && auxString == "sight" && target.HasEffect("sight") && target.GetAuraCharges("sight") >= 100) { Plugin.LogDebug("sight1e"); target.HealCursesName((List<string>)null, "sight"); target.DispelAuras(3); } if ((int)theEvent == 23 && __instance != null && CustomFunctions.IsLivingNPC(target) && CustomFunctions.TeamHasPerk("paralyze1c") && auxString == "spark") { int auraCharges5 = target.GetAuraCharges("spark"); if (auraCharges5 >= 100 && paralyzeCounters[target.NPCIndex] <= 0) { Plugin.LogDebug("paralyze1c"); AuraCurseData auraCurseData2 = CustomFunctions.GetAuraCurseData("paralyze"); paralyzeCounters[target.NPCIndex]++; target.SetAura(__instance, auraCurseData2, 1, false, (CardClass)11, true, true); } } if ((int)theEvent == 23 && auxString == "block" && CustomFunctions.IsLivingHero(target) && CustomFunctions.CharacterObjectHavePerk(target, "block5d")) { Plugin.LogDebug("block5d"); int num3 = 1; DamageType val = (DamageType)2; int num4 = target.DamageWithCharacterBonus(num3, val, (CardClass)11, 0, -1000); Character[] array = (Character[])(object)teamNpc; Character randomCharacter = CustomFunctions.GetRandomCharacter(array); if (randomCharacter.Alive && randomCharacter != null && target.Alive && target != null) { randomCharacter.IndirectDamage(val, num4, (AudioClip)null, "", "", ""); target.IndirectDamage(val, num4, (AudioClip)null, "", "", ""); } } if ((int)theEvent == 23 && auxString == "rust" && CustomFunctions.IsLivingNPC(__instance) && CustomFunctions.CharacterObjectHavePerk(target, "rust1f")) { Plugin.LogDebug("rust1f"); __instance.DispelAuras(1); } if ((int)theEvent == 23 && auxString == "decay" && CustomFunctions.IsLivingNPC(__instance) && CustomFunctions.IsLivingHero(target) && CustomFunctions.CharacterObjectHavePerk(target, "decay1g")) { Plugin.LogDebug("decay1g"); target.SetAura(__instance, CustomFunctions.GetAuraCurseData("rust"), 1, false, (CardClass)11, true, true); target.SetAura(target, CustomFunctions.GetAuraCurseData("rust"), 1, false, (CardClass)11, true, true); } if ((int)theEvent == 1 && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "block5c")) { Plugin.LogDebug("block5c"); bool allHeroFlag = true; bool allNpcFlag = false; CustomFunctions.ApplyAuraCurseTo("block", 2, allHeroFlag, allNpcFlag, randomHeroFlag: false, randomNpcFlag: false, ref __instance, ref teamHeroes, ref teamNpc, "", ""); } if ((int)theEvent == 1 && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "shield5c")) { Plugin.LogDebug("shield5c"); bool allHeroFlag2 = true; bool allNpcFlag2 = false; CustomFunctions.ApplyAuraCurseTo("shield", 4, allHeroFlag2, allNpcFlag2, randomHeroFlag: false, randomNpcFlag: false, ref __instance, ref teamHeroes, ref teamNpc, "", ""); } if ((int)theEvent == 1 && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "fortify1f")) { Plugin.LogDebug("fortify1f"); bool allHeroFlag3 = true; bool allNpcFlag3 = false; CustomFunctions.ApplyAuraCurseTo("fortify", 2, allHeroFlag3, allNpcFlag3, randomHeroFlag: false, randomNpcFlag: false, ref __instance, ref teamHeroes, ref teamNpc, "", ""); } if ((int)theEvent == 1 && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "rust1e")) { Plugin.LogDebug("rust1e"); bool allHeroFlag4 = true; bool allNpcFlag4 = false; CustomFunctions.ApplyAuraCurseTo("rust", 2, allHeroFlag4, allNpcFlag4, randomHeroFlag: false, randomNpcFlag: false, ref __instance, ref teamHeroes, ref teamNpc, "", ""); } if ((int)theEvent == 35 && !target.IsHero && target != null && CustomFunctions.TeamHasPerk("poison2g") && target.HasEffect("poison")) { Plugin.LogDebug("poison2g"); if (poison2gFlag) { poison2gFlag = false; int auraCharges6 = target.GetAuraCharges("poison"); Plugin.LogDebug("poison2g - n charges: " + auraCharges6); int num5 = Mathf.RoundToInt((float)auraCharges6 * 0.5f); Character[] array = (Character[])(object)teamNpc; Character randomCharacter2 = CustomFunctions.GetRandomCharacter(array); if (CustomFunctions.IsLivingNPC(randomCharacter2)) { randomCharacter2.SetAura(__instance, CustomFunctions.GetAuraCurseData("poison"), num5, false, (CardClass)11, false, true); } } } if ((int)theEvent == 35 && !target.IsHero && target != null && CustomFunctions.TeamHasPerk("thorns1e") && target.HasEffect("thorns")) { Plugin.LogDebug("thorns1e"); if (thorns1eFlag) { thorns1eFlag = false; int auraCharges7 = target.GetAuraCharges("thorns"); int num6 = Mathf.RoundToInt((float)auraCharges7 * 1f); Character[] array = (Character[])(object)teamHeroes; Character randomCharacter3 = CustomFunctions.GetRandomCharacter(array); if (CustomFunctions.IsLivingHero(randomCharacter3)) { randomCharacter3.SetAura(__instance, CustomFunctions.GetAuraCurseData("thorns"), num6, false, (CardClass)11, false, true); } } } if ((int)theEvent == 35 && !target.IsHero && target != null && CustomFunctions.TeamHasPerk("bleed2g") && target.HasEffect("bleed") && bleed2gFlag) { bleed2gFlag = false; Plugin.LogDebug("bleed2g"); int auraCharges8 = target.GetAuraCharges("bleed"); Plugin.LogDebug("bleed2g Bleed charges: " + auraCharges8); int amount = Mathf.RoundToInt((float)auraCharges8 * 0.25f); CustomFunctions.DealIndirectDamageToAllMonsters((DamageType)0, amount); } if ((int)theEvent == 9 && CustomFunctions.IsLivingNPC(__instance) && CustomFunctions.IsLivingHero(target) && CustomFunctions.CharacterObjectHavePerk(target, "bleed2e")) { Plugin.LogDebug("bleed2e"); int auraCharges9 = __instance.GetAuraCharges("bleed"); int num7 = Mathf.RoundToInt((float)auraCharges9 * 0.25f); target.IndirectHeal(num7, (AudioClip)null, "", ""); } if ((int)theEvent == 9 && CustomFunctions.IsLivingNPC(__instance) && CustomFunctions.IsLivingHero(target) && CustomFunctions.CharacterObjectHavePerk(target, "spark2f")) { Plugin.LogDebug("spark2f Hit by: " + target.SourceName); int auraCharges10 = __instance.GetAuraCharges("spark"); int num8 = Mathf.RoundToInt((float)auraCharges10 * 0.2f); int nPCIndex = __instance.NPCIndex; List<NPC> nPCSides = MatchManager.Instance.GetNPCSides(nPCIndex); for (int i = 0; i < nPCSides.Count; i++) { if (((Character)nPCSides[i]).Alive && nPCSides[i] != null) { Plugin.LogDebug("spark2f dealing damage to: " + ((Character)nPCSides[i]).SourceName); ((Character)nPCSides[i]).IndirectDamage((DamageType)6, num8, (AudioClip)null, "", "", ""); } } } if ((int)theEvent == 7 && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "spellsword1d")) { CardData value = Traverse.Create((object)__instance).Field("cardCasted").GetValue<CardData>(); if ((Object)(object)value != (Object)null && MatchManager.Instance.energyJustWastedByHero >= 4 && (value.HasCardType((CardType)19) || value.HasCardType((CardType)20))) { __instance.SetAuraTrait(__instance, "spellsword", 1); } } if ((int)theEvent == 7 && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.CharacterObjectHavePerk(__instance, "energy2e")) { CardData value2 = Traverse.Create((object)__instance).Field("cardCasted").GetValue<CardData>(); if ((Object)(object)value2 != (Object)null && MatchManager.Instance.energyJustWastedByHero >= 4) { __instance.ModifyEnergy(1, false); } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetEnergyTurn")] public static void GetEnergyTurnPostfix(Character __instance, ref int __result) { if (CustomFunctions.CharacterObjectHavePerk(__instance, "energy2e") && __instance.IsHero && __instance.Alive && __instance != null) { Plugin.LogDebug("energy2e"); __result--; if (__result < 0) { __result = 0; } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "DamageReflected")] public static bool DamageReflectedPrefix(ref Character __instance, Hero theCasterHero, NPC theCasterNPC, int damageAmount = 0, int blockedAmount = 0) { //IL_008d: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (__instance.IsHero && theCasterHero != null) { return true; } List<Aura> auraList = __instance.AuraList; for (int i = 0; i < auraList.Count; i++) { if (auraList[i] == null) { continue; } AuraCurseData aCData = auraList[i].ACData; if (!((Object)(object)aCData != (Object)null) || aCData.DamageReflectedMultiplier <= 0 || __instance.GetAuraCharges(aCData.Id) < aCData.ChargesPreReqForDamageReflection) { continue; } RefectedDamageModifierType damageReflectedModifierType = aCData.DamageReflectedModifierType; RefectedDamageModifierType val = damageReflectedModifierType; if ((int)val == 0 && aCData.Id == "thorns" && theCasterNPC != null && CustomFunctions.IfCharacterHas(__instance, CustomFunctions.CharacterHas.Perk, "zeal1g", CustomFunctions.AppliesTo.Heroes) && __instance.HasEffect("zeal")) { ((Character)theCasterNPC).SetAura(__instance, Globals.Instance.GetAuraCurseData("burn"), Functions.FuncRoundToInt((float)auraList[i].AuraCharges * 0.5f), false, (CardClass)11, true, true); if (aCData.DamageReflectedConsumeCharges > 0) { __instance.ConsumeEffectCharges(aCData.Id, aCData.DamageReflectedConsumeCharges); } return false; } } return true; } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "EndRound")] public static void EndRoundPostfix(ref Character __instance) { Plugin.LogDebug("EndRoundPostfix"); if (__instance != null) { int auraCharges = __instance.GetAuraCharges("spark"); if ((Object)(object)AtOManager.Instance != (Object)null && AtOManager.Instance.TeamHavePerk("mainperkspark2c")) { __instance.SetAuraTrait((Character)null, "slow", Mathf.FloorToInt(1f / 14f * (float)auraCharges)); } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "DamageWithCharacterBonus")] public static void DamageWithCharacterBonusPostfix(ref Character __instance, ref int __result, int value, DamageType DT, CardClass CC, int energyCost = 0) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Invalid comparison between Unknown and I4 //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Invalid comparison between Unknown and I4 if ((int)CC == 11 || !CustomFunctions.IsLivingHero(__instance) || value == 0 || __result == 0 || (int)DT == 0 || (Object)(object)AtOManager.Instance == (Object)null || (Object)(object)MatchManager.Instance == (Object)null || !CustomFunctions.CharacterObjectHavePerk(__instance, "energy2d")) { return; } float num = 4f; num += (float)__instance.GetAuraCharges("bless") * 0.25f; if ((int)DT == 1 || (int)DT == 3 || ((int)DT == 9 && AtOManager.Instance.CharacterHavePerk(__instance.SubclassName, "mainperkSharp1d")) || ((int)DT == 7 && AtOManager.Instance.TeamHaveTrait("shrilltone"))) { num += (float)__instance.GetAuraCharges("sharp") * 0.2f; } if (((int)DT == 4 || (int)DT == 2) && AtOManager.Instance.CharacterHavePerk(__instance.SubclassName, "mainperkfortify1a")) { num += (float)__instance.GetAuraCharges("fortify") * 0.2f; } Dictionary<int, float> dictionary = new Dictionary<int, float> { { 0, 0.4f }, { 1, 0.7f }, { 2, 1f }, { 3, 1.4f }, { 4, 1.8f }, { 5, 2.2f }, { 6, 2.7f }, { 7, 3.2f }, { 8, 3.9f }, { 9, 4.8f }, { 10, 6f } }; int num2 = __result; if (dictionary.ContainsKey(energyCost)) { int val = Mathf.RoundToInt(((float)__result - num * MathF.Sqrt(energyCost)) * dictionary[energyCost] + num); if (energyCost < 2) { __result = Math.Min(val, Mathf.RoundToInt((float)num2 * dictionary[energyCost])); } else { __result = Math.Max(val, num2); } if (__result < 0) { __result = 0; } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "SetAura")] public static void SetAuraPrefix(ref Character __instance, Character theCaster, AuraCurseData _acData, ref int charges, bool fromTrait = false, CardClass CC = 11, bool useCharacterMods = true, bool canBePreventable = true) { if (CustomFunctions.TeamHasPerk("weak1b") && __instance != null && __instance.Alive && CustomFunctions.IsLivingNPC(theCaster)) { Plugin.LogDebug("weak1b"); if (theCaster.HasEffect("weak")) { charges = Functions.FuncRoundToInt(0.8f * (float)charges); } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "BeginTurn")] public static void BeginTurnPrefix(ref Character __instance) { poison2gFlag = true; bleed2gFlag = true; thorns1eFlag = true; infiniteProctection = 0; infiniteProctectionPowerful = 0; if (!__instance.Alive || __instance == null || (Object)(object)MatchManager.Instance == (Object)null) { return; } Hero[] teamHero = MatchManager.Instance.GetTeamHero(); NPC[] teamNPC = MatchManager.Instance.GetTeamNPC(); if (CustomFunctions.CharacterObjectHavePerk(__instance, "rust1d")) { int num = 2; __instance.SetAuraTrait(__instance, "rust", num); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "shackle1d")) { int auraCharges = __instance.GetAuraCharges("shackle"); int num2 = 2; __instance.SetAuraTrait(__instance, "fortify", auraCharges * num2); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "mitigate1a")) { int num3 = 2; __instance.SetAuraTrait(__instance, "mitigate", num3); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "mitigate1c")) { int num4 = 7 * __instance.GetAuraCharges("mitigate"); __instance.SetAuraTrait(__instance, "block", num4); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "health6c")) { Plugin.LogDebug("Health6c current: " + __instance.HpCurrent + " Max: " + __instance.GetMaxHP()); if (__instance.GetMaxHP() <= __instance.HpCurrent || __instance.GetHpLeftForMax() <= 0) { int num5 = 2; __instance.SetAuraTrait(__instance, "vitality", num5); } } if (CustomFunctions.CharacterObjectHavePerk(__instance, "chill2f")) { int num6 = 3; __instance.SetAuraTrait(__instance, "chill", num6); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "sight1d")) { int num7 = 0; NPC[] array = teamNPC; foreach (NPC val in array) { if (CustomFunctions.IsLivingNPC((Character)(object)val) && ((Character)val).GetAuraCharges("sight") >= 100) { num7++; } } __instance.SetAuraTrait(__instance, "evasion", num7); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "energize1a") && MatchManager.Instance.GetCurrentRound() == 1) { __instance.SetAuraTrait(__instance, "energize", 1); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "spellsword1c")) { Hero[] array2 = teamHero; foreach (Hero val2 in array2) { if (CustomFunctions.IsLivingHero((Character)(object)val2) && (!(((Character)val2).SubclassName == "queen") || ((Character)val2).GetAuraCharges("spellsword") != 4)) { ((Character)val2).SetAuraTrait(__instance, "spellsword", 1); } } NPC[] array3 = teamNPC; foreach (NPC val3 in array3) { if (CustomFunctions.IsLivingNPC((Character)(object)val3)) { ((Character)val3).SetAuraTrait(__instance, "spellsword", 1); } } } if (CustomFunctions.TeamHasPerk("sanctify2e") && __instance.IsHero && __instance.HasEffect("sanctify")) { int auraCharges2 = __instance.GetAuraCharges("sanctify"); int num8 = Mathf.FloorToInt((float)auraCharges2 * 0.05f); AuraCurseData auraCurseData = CustomFunctions.GetAuraCurseData("zeal"); __instance.SetAura(__instance, auraCurseData, num8, false, (CardClass)11, false, true); } if (CustomFunctions.TeamHasPerk("insane2f") && __instance.HasEffect("insane")) { int num9 = Mathf.FloorToInt((float)(__instance.GetAuraCharges("insane") / 30)); __instance.SetAuraTrait(__instance, "scourge", num9); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "stealh1d") && __instance.IsHero && !__instance.HasEffect("stealth")) { __instance.SetAura(__instance, CustomFunctions.GetAuraCurseData("stealth"), 1, false, (CardClass)11, false, true); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "stanza0d") && __instance.IsHero && MatchManager.Instance.GetCurrentRound() == 1) { __instance.SetAura(__instance, CustomFunctions.GetAuraCurseData("stanzai"), 1, false, (CardClass)11, false, true); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "stanza0e") && __instance.IsHero && MatchManager.Instance.GetCurrentRound() == 1) { __instance.SetAura(__instance, CustomFunctions.GetAuraCurseData("stanzaii"), 1, false, (CardClass)11, false, true); } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetTraitDamagePercentModifiers")] public static void GetTraitDamagePercentModifiersPostfix(ref Character __instance, ref float __result) { if (CustomFunctions.CharacterObjectHavePerk(__instance, "currency6c")) { int playerGold = AtOManager.Instance.GetPlayerGold(); int num = Mathf.FloorToInt((float)(10 * playerGold / 2000)); __result += num; } } [HarmonyPrefix] [HarmonyPatch(typeof(MatchManager), "EndTurn")] public static void MatchManagerEndTurnPrefix(MatchManager __instance) { if ((Object)(object)__instance == (Object)null) { return; } Character characterActive = __instance.GetCharacterActive(); if (!CustomFunctions.IsLivingHero(characterActive)) { return; } if (CustomFunctions.CharacterObjectHavePerk(characterActive, "inspire0d")) { Plugin.LogDebug("Handsize at End of Turn: " + __instance.CountHeroHand(-1)); if (__instance.CountHeroHand(-1) >= 4) { characterActive.SetAuraTrait(characterActive, "inspire", 1); } } if (CustomFunctions.CharacterObjectHavePerk(characterActive, "health6d") && characterActive.GetHpLeftForMax() <= 0) { Plugin.LogDebug("health6d"); characterActive.SetAuraTrait(characterActive, "vitality", 2); } if (!CustomFunctions.TeamHasPerk("fury1d") || !characterActive.HasEffect("fury")) { return; } Plugin.LogDebug("fury1d"); float num = 0.7f; if ((Object)(object)characterActive.HeroItem != (Object)null) { List<Hero> heroSides = MatchManager.Instance.GetHeroSides(characterActive.Position); for (int i = 0; i < heroSides.Count; i++) { ((Character)heroSides[i]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("fury"), Functions.FuncRoundToInt((float)characterActive.GetAuraCharges("fury") * num), false, (CardClass)11, true, true); } } } [HarmonyPrefix] [HarmonyPatch(typeof(MatchManager), "SetDamagePreview")] public static void SetDamagePreviewPrefix() { isDamagePreviewActive = true; } [HarmonyPostfix] [HarmonyPatch(typeof(MatchManager), "SetDamagePreview")] public static void SetDamagePreviewPostfix() { isDamagePreviewActive = false; } [HarmonyPrefix] [HarmonyPatch(typeof(CharacterItem), "CalculateDamagePrePostForThisCharacter")] public static void CalculateDamagePrePostForThisCharacterPrefix() { isCalculateDamageActive = true; } [HarmonyPostfix] [HarmonyPatch(typeof(CharacterItem), "CalculateDamagePrePostForThisCharacter")] public static void CalculateDamagePrePostForThisCharacterPostfix() { isCalculateDamageActive = false; } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "IndirectDamage")] public static void IndirectDamagePostfix(ref Character __instance, DamageType damageType, ref int damage, AudioClip sound = null, string effect = "", string sourceCharacterName = "", string sourceCharacterId = "") { Plugin.LogDebug("IndirectDamagePostfix"); if (!((Object)(object)MatchManager.Instance == (Object)null)) { Character characterById = MatchManager.Instance.GetCharacterById(sourceCharacterId); if (CustomFunctions.TeamHasPerk("thorns1f") && CustomFunctions.IsLivingHero(characterById) && characterById.HasEffect("bless") && effect == "thorns") { int auraCharges = characterById.GetAuraCharges("rust"); float num = 1f + 0.05f * (float)auraCharges; damage = Mathf.RoundToInt((float)damage * num); } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "HealReceivedFinal")] public static void HealReceivedFinalPostfix(Character __instance, int __result, int heal, bool isIndirect = false) { if (infiniteProctection <= 100 && !isDamagePreviewActive && !isCalculateDamageActive && !((Object)(object)MatchManager.Instance == (Object)null) && CustomFunctions.IsLivingHero(__instance) && MatchManager.Instance.GetHeroHeroActive() != null) { infiniteProctection++; Hero heroHeroActive = MatchManager.Instance.GetHeroHeroActive(); if (__result >= 0 && __instance.GetHpLeftForMax() <= 0 && CustomFunctions.CharacterObjectHavePerk((Character)(object)heroHeroActive, "heal5b") && CustomFunctions.IsLivingHero(__instance) && CustomFunctions.IsLivingHero((Character)(object)heroHeroActive) && heal > 0 && !isIndirect) { __instance.SetAura(__instance, CustomFunctions.GetAuraCurseData("powerful"), 2, false, (CardClass)11, false, true); } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "EndTurn")] public static void CharacterEndTurnPrefix(Character __instance) { if (!__instance.Alive || __instance == null || (Object)(object)MatchManager.Instance == (Object)null) { return; } Hero[] teamHero = MatchManager.Instance.GetTeamHero(); if (CustomFunctions.CharacterHasPerkForConsume("zeal1e", __instance.IsHero, AtOManager.Instance, __instance)) { Plugin.LogDebug("zeal1e"); int auraCharges = __instance.GetAuraCharges("zeal"); AuraCurseData auraCurseData = CustomFunctions.GetAuraCurseData("zeal"); int num = ((!auraCurseData.ConsumeAll) ? auraCurseData.AuraConsumed : auraCharges); int amount = 4 * num; CustomFunctions.DealIndirectDamageToAllMonsters((DamageType)8, amount); CustomFunctions.DealIndirectDamageToAllMonsters((DamageType)4, amount); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "paralyze1b")) { AuraCurseData auraCurseData2 = CustomFunctions.GetAuraCurseData("paralyze"); Hero[] array = teamHero; foreach (Hero val in array) { if (((Character)val).Alive && val != null) { ((Character)val).HealAuraCurse(auraCurseData2); } } } if (CustomFunctions.CharacterObjectHavePerk(__instance, "energize1d") && __instance.EnergyCurrent >= 4) { __instance.SetAuraTrait(__instance, "energize", 1); } if (CustomFunctions.CharacterObjectHavePerk(__instance, "fortify1d")) { int auraCharges2 = __instance.GetAuraCharges("fortify"); int num2 = Mathf.RoundToInt((float)auraCharges2 * 0.5f); __instance.SetAuraTrait(__instance, "reinforce", num2); } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GainEnergyTurn")] public static void GainEnergyTurn(ref Character __instance) { if (MatchManager.Instance.GetCurrentRound() > 3 && CustomFunctions.IfCharacterHas(__instance, CustomFunctions.CharacterHas.Perk, "energy2f", CustomFunctions.AppliesTo.ThisHero)) { Plugin.LogDebug("Updated Energy2f perk"); __instance.ModifyEnergy(1, true); } if (MatchManager.Instance.GetCurrentRound() == 4 && AtOManager.Instance.CharacterHavePerk(__instance.SubclassName, "mainperkenergy2c")) { Plugin.LogDebug("Updated Energy2c perk"); __instance.ModifyEnergy(1, true); } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "GlobalAuraCurseModificationByTraitsAndItems")] public static void GlobalAuraCurseModificationByTraitsAndItemsPostfixGeneral(ref AtOManager __instance, ref AuraCurseData __result, string _type, string _acId, Character _characterCaster, Character _characterTarget) { Character val = ((_type == "set") ? _characterTarget : _characterCaster); Character val2 = ((_type == "set") ? _characterCaster : _characterTarget); if (val == null) { return; } bool flag = false; if (val != null) { flag = val.HasEffect("rust"); } switch (_acId) { case "evasion": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "evasion0b", CustomFunctions.AppliesTo.Heroes)) { __result.ConsumeAll = true; __result.GainCharges = true; __result.ConsumedAtTurnBegin = true; } break; case "mark": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mark1e", CustomFunctions.AppliesTo.Monsters)) { __result.IncreasedDamageReceivedType = (DamageType)3; __result.IncreasedDirectDamageReceivedPerStack = 1.5f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mark1g")) { AuraCurseData obj = __result; obj.IncreasedDirectDamageReceivedPerStack *= 0.5f; __result.CharacterStatModified = (CharacterStat)2; __result.CharacterStatModifiedValuePerStack = -1; } break; case "disarm": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "disarm1b", CustomFunctions.AppliesTo.ThisHero)) { __result.Removable = false; __result.ResistModified = (DamageType)10; __result.ResistModifiedValue = 10; } break; case "silence": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "silence1b", CustomFunctions.AppliesTo.ThisHero)) { __result.Removable = false; __result.AuraDamageType = (DamageType)10; __result.AuraDamageIncreasedTotal = 7; } break; case "stealth": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "stealth1d", CustomFunctions.AppliesTo.Heroes)) { __result.AuraDamageIncreasedPercentPerStack = 0f; } break; case "fast": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "fast0b", CustomFunctions.AppliesTo.Heroes)) { __result.GainCharges = true; __result.ConsumeAll = true; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "fast0c", CustomFunctions.AppliesTo.Heroes)) { __result.ConsumedAtTurn = true; __result.ConsumedAtTurnBegin = false; } break; case "slow": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "slow0b", CustomFunctions.AppliesTo.Monsters)) { __result.GainCharges = true; __result.MaxCharges = 10; __result.MaxMadnessCharges = 10; __result.CharacterStatModifiedValuePerStack = -1; __result.ChargesAuxNeedForOne1 = ((!flag) ? 1 : 2); __result.CharacterStatChargesMultiplierNeededForOne = ((!flag) ? 1 : 2); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "slow0c", CustomFunctions.AppliesTo.Monsters)) { __result.GainCharges = true; __result.MaxCharges = 10; __result.MaxMadnessCharges = 10; __result.CharacterStatModifiedValuePerStack = -1; __result.ChargesAuxNeedForOne1 = ((!flag) ? 1 : 2); __result.CharacterStatChargesMultiplierNeededForOne = ((!flag) ? 1 : 2); } break; } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "GlobalAuraCurseModificationByTraitsAndItems")] public static void GlobalAuraCurseModificationByTraitsAndItemsPostfixPhysical(ref AtOManager __instance, ref AuraCurseData __result, string _type, string _acId, Character _characterCaster, Character _characterTarget) { Character val = ((_type == "set") ? _characterTarget : _characterCaster); Character val2 = ((_type == "set") ? _characterCaster : _characterTarget); if (val == null) { return; } bool flag = false; if (val != null) { flag = val.HasEffect("rust"); } switch (_acId) { case "fortify": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "fortify1e", CustomFunctions.AppliesTo.Heroes)) { __result.GainCharges = true; AuraCurseData obj12 = __result; int maxCharges = (__result.MaxMadnessCharges = 5); obj12.MaxCharges = maxCharges; __result = AtOManager.Instance.GlobalAuraCurseModifyDamage(__result, (DamageType)10, 0, -1, 0); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "fortify1f", CustomFunctions.AppliesTo.Heroes)) { AuraCurseData obj13 = __result; int maxCharges = (__result.MaxMadnessCharges = 2); obj13.MaxCharges = maxCharges; } break; case "fury": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "fury1d", CustomFunctions.AppliesTo.Heroes)) { __result.ConsumeAll = true; } break; case "sharp": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperksharp1d", CustomFunctions.AppliesTo.Heroes)) { __result = AtOManager.Instance.GlobalAuraCurseModifyDamage(__result, (DamageType)9, 0, 1, 0); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "sharp1e", CustomFunctions.AppliesTo.Heroes)) { __result = AtOManager.Instance.GlobalAuraCurseModifyDamage(__result, (DamageType)9, 0, 1, 0); __result.MaxCharges = 25; __result.MaxMadnessCharges = 25; __result.AuraDamageIncreasedPerStack = (flag ? 0.75f : 1.5f); __result.AuraDamageIncreasedPerStack2 = (flag ? 0.75f : 1.5f); __result.AuraDamageIncreasedPerStack3 = (flag ? 0.75f : 1.5f); __result.AuraDamageIncreasedPerStack4 = (flag ? 0.75f : 1.5f); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "insane2e", CustomFunctions.AppliesTo.ThisHero)) { __result = AtOManager.Instance.GlobalAuraCurseModifyDamage(__result, (DamageType)9, 0, 1, 0); int auraCharges5 = val.GetAuraCharges("insane"); AuraCurseData obj8 = __result; obj8.AuraDamageIncreasedPerStack *= 1f + 0.01f * (float)auraCharges5; AuraCurseData obj9 = __result; obj9.AuraDamageIncreasedPerStack2 *= 1f + 0.01f * (float)auraCharges5; AuraCurseData obj10 = __result; obj10.AuraDamageIncreasedPerStack3 *= 1f + 0.01f * (float)auraCharges5; AuraCurseData obj11 = __result; obj11.AuraDamageIncreasedPerStack4 *= 1f + 0.01f * (float)auraCharges5; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "sharp1f", CustomFunctions.AppliesTo.ThisHero)) { __result.AuraDamageIncreasedPerStack = 0f; __result.AuraDamageIncreasedPerStack2 = 0f; __result.AuraDamageIncreasedPerStack3 = 0f; __result.AuraDamageIncreasedPerStack4 = 0f; __result = AtOManager.Instance.GlobalAuraCurseModifyDamage(__result, (DamageType)9, 0, 1, 0); } break; case "crack": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "insane2d", CustomFunctions.AppliesTo.Monsters)) { int auraCharges3 = val.GetAuraCharges("insane"); AuraCurseData obj6 = __result; obj6.IncreasedDirectDamageReceivedPerStack += (float)(flag ? Mathf.FloorToInt(0.03f * (float)auraCharges3) : Mathf.FloorToInt(0.02f * (float)auraCharges3)); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "crack2d", CustomFunctions.AppliesTo.Monsters)) { __result.CharacterStatModified = (CharacterStat)2; __result.CharacterStatModifiedValue = -1; __result.CharacterStatChargesMultiplierNeededForOne = (flag ? 10 : 5); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "crack2e", CustomFunctions.AppliesTo.Monsters)) { float num7 = (flag ? (-0.45f) : (-0.3f)); __result = __instance.GlobalAuraCurseModifyResist(__result, (DamageType)6, 0, num7); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "crack2f", CustomFunctions.AppliesTo.Monsters)) { __result.IncreasedDamageReceivedType2 = (DamageType)4; __result.IncreasedDirectDamageReceivedPerStack2 = (flag ? 1.125f : 0.75f); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "crack2g")) { __result.IncreasedDamageReceivedType2 = (DamageType)7; __result.IncreasedDirectDamageReceivedPerStack2 = (flag ? 1.125f : 0.75f); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "crack2h")) { float num8 = (flag ? (-0.45f) : (-0.3f)); __result = __instance.GlobalAuraCurseModifyResist(__result, (DamageType)1, 0, num8); __result = __instance.GlobalAuraCurseModifyResist(__result, (DamageType)3, 0, num8); } break; case "shackle": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "shackle1f", CustomFunctions.AppliesTo.Monsters)) { shackle1fFlag = !shackle1fFlag; if (!shackle1fFlag) { break; } int num = val.GetSpeed()[1]; __result.IncreasedDamageReceivedType = (DamageType)10; float num2 = 1f; __result.IncreasedDirectDamageReceivedPerStack = Mathf.RoundToInt((float)num * num2); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "shackle1c")) { __result.Preventable = false; } break; case "mitigate": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mitigate1a", CustomFunctions.AppliesTo.ThisHero)) { __result.MaxCharges = 5; __result.MaxMadnessCharges = 5; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mitigate1b", CustomFunctions.AppliesTo.ThisHero)) { __result.ConsumedAtTurnBegin = false; __result.MaxCharges = 12; __result.MaxMadnessCharges = 12; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mitigate1d", CustomFunctions.AppliesTo.ThisHero)) { __result.ConsumeAll = true; __result.IncreasedDirectDamageReceivedPerStack = -2f; __result.ChargesMultiplierDescription = 2; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mitigate1e")) { __result.AuraDamageType = (DamageType)10; __result.AuraDamageIncreasedPercentPerStack = 10f; } break; case "poison": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkpoison2c", CustomFunctions.AppliesTo.Monsters)) { __result.ConsumedAtTurnBegin = true; __result.ConsumedAtTurn = false; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "poison2d")) { __result.MaxMadnessCharges = (flag ? 450 : 300); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "poison2e")) { __result.ResistModified3 = (DamageType)1; __result.ResistModifiedPercentagePerStack3 = (flag ? (-0.3f) : (-0.2f)); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "poison2f", CustomFunctions.AppliesTo.Monsters)) { __result.DamageTypeWhenConsumed = (DamageType)9; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "decay1e")) { int auraCharges = val.GetAuraCharges("decay"); float num4 = 1f + 0.2f * (float)auraCharges; AuraCurseData obj3 = __result; obj3.DamageWhenConsumedPerCharge *= num4; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "rust1c")) { float num5 = 2f / 3f; AuraCurseData obj4 = __result; obj4.DamageWhenConsumedPerCharge *= num5; int auraCharges2 = val.GetAuraCharges("rust"); float num6 = Mathf.Min(1f + 0.1f * (float)auraCharges2, 3f); AuraCurseData obj5 = __result; obj5.DamageWhenConsumedPerCharge *= num6; } break; case "bleed": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkbleed2b", CustomFunctions.AppliesTo.ThisHero)) { __result.MaxCharges = 50; __result.MaxMadnessCharges = 50; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkbleed2c", CustomFunctions.AppliesTo.Monsters)) { __result.Removable = false; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "bleed2d")) { __result.MaxMadnessCharges = 300; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "bleed2f", CustomFunctions.AppliesTo.Monsters)) { __result.ResistModified3 = (DamageType)3; __result.ResistModifiedPercentagePerStack3 = -0.25f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "decay1f")) { int auraCharges4 = val.GetAuraCharges("decay"); float num9 = 1f + 0.2f * (float)auraCharges4; AuraCurseData obj7 = __result; obj7.DamageWhenConsumedPerCharge *= num9; } break; case "thorns": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "thorns1d", CustomFunctions.AppliesTo.ThisHero)) { __result.Removable = false; } break; case "reinforce": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkreinforce1b", CustomFunctions.AppliesTo.Heroes)) { __result.ResistModifiedValue = 40; __result.ResistModifiedValue2 = 40; __result.ResistModifiedValue3 = 40; } break; case "block": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "block5b", CustomFunctions.AppliesTo.Heroes)) { __result.MaxMadnessCharges = 600; } break; case "vulnerable": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "crack2i", CustomFunctions.AppliesTo.Monsters)) { int num3 = Mathf.FloorToInt(0.04f * (float)val.GetAuraCharges("crack")); AuraCurseData obj = __result; obj.MaxCharges += num3; AuraCurseData obj2 = __result; obj2.MaxMadnessCharges += num3; } break; case "taunt": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "taunt1e", CustomFunctions.AppliesTo.ThisHero)) { __result.GainCharges = true; __result.AuraDamageType = (DamageType)10; __result.AuraDamageIncreasedPerStack = 1f; } break; } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "GlobalAuraCurseModificationByTraitsAndItems")] public static void GlobalAuraCurseModificationByTraitsAndItemsPostfixElemental(ref AtOManager __instance, ref AuraCurseData __result, string _type, string _acId, Character _characterCaster, Character _characterTarget) { Character val = ((_type == "set") ? _characterTarget : _characterCaster); Character val2 = ((_type == "set") ? _characterCaster : _characterTarget); if (val == null) { return; } bool flag = false; if (val != null) { flag = val.HasEffect("rust"); } if ((Object)(object)__result == (Object)null || (_characterCaster == null && _type == "consume") || (_characterTarget == null && _type == "set")) { return; } switch (_acId) { case "rust": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "rust1d", CustomFunctions.AppliesTo.ThisHero)) { AuraCurseData auraCurseData = CustomFunctions.GetAuraCurseData("None"); __result.PreventedAuraCurse = auraCurseData; __result.PreventedAuraCurseStackPerStack = 0; __result.RemoveAuraCurse = auraCurseData; } break; case "powerful": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "taunt1f", CustomFunctions.AppliesTo.Heroes)) { int auraCharges = val.GetAuraCharges("taunt"); AuraCurseData obj = __result; obj.MaxCharges += auraCharges; AuraCurseData obj2 = __result; obj2.MaxMadnessCharges += auraCharges; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "powerful1e", CustomFunctions.AppliesTo.ThisHero)) { __result.AuraDamageIncreasedPercentPerStack = 2f; AuraCurseData obj3 = __result; int maxCharges = (__result.MaxMadnessCharges = -1); obj3.MaxCharges = maxCharges; } break; case "inspire": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "inspire0e", CustomFunctions.AppliesTo.ThisHero)) { __result.AuraDamageType = (DamageType)8; __result.AuraDamageType2 = (DamageType)7; __result.AuraDamageIncreasedPerStack = 0.5f; __result.AuraDamageIncreasedPerStack2 = 0.5f; } break; case "insulate": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkinsulate1b", CustomFunctions.AppliesTo.Heroes)) { __result.ResistModifiedValue = 40; __result.ResistModifiedValue2 = 40; __result.ResistModifiedValue3 = 40; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "insulate1e", CustomFunctions.AppliesTo.ThisHero)) { __result.AuraDamageType = (DamageType)4; __result.AuraDamageType2 = (DamageType)5; __result.AuraDamageType3 = (DamageType)6; __result.AuraDamageIncreasedPercentPerStack = 5f; __result.AuraDamageIncreasedPercentPerStack2 = 5f; __result.AuraDamageIncreasedPercentPerStack3 = 5f; __result.ResistModifiedValue = 15; __result.ResistModifiedValue2 = 15; __result.ResistModifiedValue3 = 15; __result.GainCharges = true; __result.MaxCharges = 8; __result.MaxMadnessCharges = 8; } break; case "spellsword": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "spellsword1a", CustomFunctions.AppliesTo.Heroes)) { AuraCurseData obj5 = __result; obj5.MaxCharges += 2; if (__result.MaxMadnessCharges != -1) { AuraCurseData obj6 = __result; obj6.MaxMadnessCharges += 2; } } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "spellsword1b", CustomFunctions.AppliesTo.Heroes)) { __result.AuraDamageType = (DamageType)0; __result.AuraDamageIncreasedPerStack = 0f; __result.IncreasedDirectDamageReceivedPerStack = -2f; __result.ChargesMultiplierDescription = 2; } break; case "energize": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "energize1b", CustomFunctions.AppliesTo.ThisHero)) { __result.MaxCharges = 1; __result.MaxMadnessCharges = 1; __result.CharacterStatModifiedValuePerStack = 2; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "energize1c", CustomFunctions.AppliesTo.ThisHero)) { __result.AuraDamageType = (DamageType)10; __result.AuraDamageIncreasedPerStack = 1f; } break; case "burn": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkburn2d", CustomFunctions.AppliesTo.Monsters)) { __result.DoubleDamageIfCursesLessThan = 4; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "scourge1e", CustomFunctions.AppliesTo.Heroes)) { int auraCharges2 = val.GetAuraCharges("scourge"); float num2 = 0.15f * (float)auraCharges2 + 1f; AuraCurseData obj4 = __result; obj4.DamageWhenConsumedPerCharge *= num2; } break; case "chill": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "chill2e")) { __result.ResistModified = (DamageType)5; __result.ResistModified2 = (DamageType)7; __result.ResistModifiedPercentagePerStack = -0.5f; __result.ResistModifiedPercentagePerStack2 = -0.5f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "chill2f", CustomFunctions.AppliesTo.ThisHero)) { __result.CharacterStatChargesMultiplierNeededForOne = 10; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "chill2g", CustomFunctions.AppliesTo.ThisHero)) { __result.CharacterStatChargesMultiplierNeededForOne = 3; __result.ResistModified = (DamageType)0; __result.ResistModifiedPercentagePerStack = 0f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "insulate1d", CustomFunctions.AppliesTo.ThisHero)) { __result.CharacterStatModified = (CharacterStat)0; __result.CharacterStatAbsoluteValuePerStack = 0; } break; case "wet": { if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "zeal1d")) { __result.ResistModified3 = (DamageType)10; __result = __instance.GlobalAuraCurseModifyResist(__result, (DamageType)10, 0, 0.5f); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "wet1d")) { AuraCurseData auraCurseData2 = CustomFunctions.GetAuraCurseData("None"); __result.PreventedAuraCurse = auraCurseData2; __result.PreventedAuraCurseStackPerStack = 0; __result.RemoveAuraCurse = auraCurseData2; } bool flag2 = CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "rust1b", CustomFunctions.AppliesTo.Monsters); if (flag2) { __result.IncreasedDirectDamageReceivedPerStack = 1.5f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkwet1a", CustomFunctions.AppliesTo.Monsters) && flag2) { __result.IncreasedDamageReceivedType2 = (DamageType)5; __result.IncreasedDirectDamageReceivedPerStack2 = 1.5f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkwet1b", CustomFunctions.AppliesTo.Monsters) && flag2) { __result = __instance.GlobalAuraCurseModifyResist(__result, (DamageType)6, 0, -1.5f); __result.AuraConsumed = 0; } break; } case "spark": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "spark2d", CustomFunctions.AppliesTo.ThisHero)) { __result.AuraDamageType = (DamageType)6; __result.AuraDamageIncreasedPerStack = 1f; __result.ChargesAuxNeedForOne1 = 5; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "spark2e", CustomFunctions.AppliesTo.Monsters)) { __result.DamageTypeWhenConsumed = (DamageType)4; __result.ResistModified = (DamageType)6; __result.ResistModified2 = (DamageType)4; __result.ResistModifiedPercentagePerStack = -0.5f; __result.ResistModifiedPercentagePerStack2 = -0.5f; } break; case "shield": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "shield5b")) { __result.MaxMadnessCharges = 300; } break; } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "GlobalAuraCurseModificationByTraitsAndItems")] public static void GlobalAuraCurseModificationByTraitsAndItemsPostfixMystical(ref AtOManager __instance, ref AuraCurseData __result, string _type, string _acId, Character _characterCaster, Character _characterTarget) { if (_characterCaster != null) { } if (_characterTarget != null) { } Character val = ((_type == "set") ? _characterTarget : _characterCaster); Character val2 = ((_type == "set") ? _characterCaster : _characterTarget); if (val == null) { return; } bool flag = false; if (val != null) { flag = val.HasEffect("rust"); } switch (_acId) { case "regeneration": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "regeneration1d", CustomFunctions.AppliesTo.Heroes)) { __result.PreventedAuraCurse = CustomFunctions.GetAuraCurseData("vulnerable"); __result.PreventedAuraCurseStackPerStack = 1; } break; case "dark": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkdark2b", CustomFunctions.AppliesTo.ThisHero)) { __result.Removable = false; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "dark2e")) { __result.DamageTypeWhenConsumed = (DamageType)4; __result.ResistModified2 = (DamageType)4; __result.ResistModifiedPercentagePerStack2 = -0.5f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "sanctify2d")) { int auraCharges = val.GetAuraCharges("sanctify"); AuraCurseData obj2 = __result; obj2.ExplodeAtStacks += Mathf.FloorToInt(0.2f * (float)auraCharges); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "burn2e")) { int auraCharges2 = val.GetAuraCharges("burn"); float num = 1f + 0.05f * (float)auraCharges2; AuraCurseData obj3 = __result; obj3.DamageWhenConsumedPerCharge *= num; } break; case "decay": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "decay1d")) { __result.RemoveAuraCurse = CustomFunctions.GetAuraCurseData("insulate"); } break; case "courage": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "mainperkcourage1b", CustomFunctions.AppliesTo.Heroes)) { __result.ResistModifiedValue = 40; __result.ResistModifiedValue2 = 40; __result.ResistModifiedValue3 = 40; } break; case "zeal": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "zeal1f", CustomFunctions.AppliesTo.ThisHero)) { __result.GainCharges = true; __result.ResistModified = (DamageType)0; __result.ResistModifiedPercentagePerStack = 0f; __result.GainAuraCurseConsumption = CustomFunctions.GetAuraCurseData("burn"); __result.GainAuraCurseConsumptionPerCharge = 5; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "zeal1b", CustomFunctions.AppliesTo.ThisHero)) { __result.ConsumeAll = false; __result.AuraConsumed = 3; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "zeal1c", CustomFunctions.AppliesTo.Heroes)) { __result.GainCharges = true; __result.MaxCharges = Plugin.ZealCap.Value; __result.MaxMadnessCharges = Plugin.ZealCap.Value; __result.CharacterStatModified = (CharacterStat)2; __result.CharacterStatModifiedValuePerStack = -2; } break; case "scourge": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "scourge1b")) { __result.ConsumeAll = false; __result.AuraConsumed = ((!CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Trait, "moontouchedtrait4a")) ? 3 : 0); } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "scourge1c", CustomFunctions.AppliesTo.Monsters)) { __result.GainCharges = true; __result.ResistModified2 = (DamageType)10; __result.ResistModifiedPercentagePerStack2 = 3f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "scourge1d")) { __result.ConsumedDamageChargesBasedOnACCharges = CustomFunctions.GetAuraCurseData("sight"); __result.DamageWhenConsumedPerCharge = 2f; } if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "scourge1g") && val.GetCurseList().Count <= 2) { AuraCurseData obj = __result; obj.DamageWhenConsumedPerCharge *= 4f; } break; case "weak": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "weak1c", CustomFunctions.AppliesTo.Monsters)) { __result.Preventable = false; __result.AuraDamageIncreasedPercent = -20; __result.HealDonePercent = -20; } break; case "vitality": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "vitality1d", CustomFunctions.AppliesTo.ThisHero)) { __result.RemoveAuraCurse = CustomFunctions.GetAuraCurseData("poison"); } break; case "bless": if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Perk, "bless1d", CustomFunctions.AppliesTo.Heroes)) { __result.AuraDamageType = (DamageType)1; __result.AuraDamageType2 = (DamageType)4; __result.AuraDamageType3 = (DamageType)8; __result.AuraDamageIncreasedPercentPerStack = 3f; __result.AuraDamageIncreasedPercentPerStack2 = 3f; __result.AuraDamageIncreasedPercentPerStack3 = 3f; __result.AuraDamageIncreasedPerStack = 0f; } break; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetTraitAuraCurseModifiers")] public static void GetTraitAuraCurseModifiersPostfix(ref Character __instance, ref Dictionary<string, int> __result) { string text = Plugin.perkBase + "sharp1f"; if (CustomFunctions.IsLivingHero(__instance) && AtOManager.Instance.CharacterHavePerk(__instance.SubclassName, text)) { Plugin.LogDebug("Executing Perk " + text); int num = __instance.EffectCharges("sharp"); int num2 = Mathf.FloorToInt((float)num * 0.125f); if (num2 != 0) { __result["bleed"] = num2; } } } } [HarmonyPatch] public class PerkRewrites { [HarmonyPrefix] [HarmonyPatch(typeof(Functions), "GetCardByRarity")] public static bool GetCardByRarityPrefix(ref string __result, int rarity, CardData _cardData, bool isChallenge = false) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Invalid comparison between Unknown and I4 //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Invalid comparison between Unknown and I4 //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Invalid comparison between Unknown and I4 //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Invalid comparison between Unknown and I4 //IL_0226: Unknown result type (might be due to invalid IL or missing references) int num = 78; int num2 = 88; int num3 = 98; int num4 = 0; if (!GameManager.Instance.IsObeliskChallenge()) { num4 = AtOManager.Instance.GetMadnessDifficulty(); if (num4 > 0) { num = 75; num2 = 85; num3 = 95; } } else { num4 = AtOManager.Instance.GetObeliskMadness(); } CustomFunctions.PLog("GetCardByRarityPrefix - CardDataId - " + _cardData.Id); if (AtOManager.Instance.TeamHavePerk(Plugin.perkBase + "shards5c")) { int num5 = 2; num -= num5; num2 -= num5; num3 -= num5; Plugin.Log.LogDebug((object)(Plugin.debugBase + "Testing Perk shards5c: Modified value " + num3)); } if (num4 > 0) { num -= num4; num2 -= Functions.FuncRoundToInt((float)num4 * 0.5f); } if (rarity < num) { __result = (((int)_cardData.CardUpgraded == 0 || !(_cardData.UpgradedFrom != "")) ? _cardData.Id.ToLower() : _cardData.UpgradedFrom.ToLower()); CustomFunctions.PLog("GetCardByRarityPrefix Exit 1"); return false; } if (rarity >= num && rarity < num2) { if ((int)_cardData.CardUpgraded == 1) { __result = _cardData.Id.ToLower(); CustomFunctions.PLog("GetCardByRarityPrefix Exit 2"); return false; } if ((int)_cardData.CardUpgraded == 0) { __result = _cardData.UpgradesTo1.ToLower(); CustomFunctions.PLog("GetCardByRarityPrefix Exit 3"); return false; } if ((int)_cardData.CardUpgraded == 2) { __result = (_cardData.UpgradedFrom + "A").ToLower(); CustomFunctions.PLog("GetCardByRarityPrefix Exit 4"); return false; } } else { if (rarity >= num2 && rarity < num3) { if ((int)_cardData.CardUpgraded == 2) { __result = _cardData.Id.ToLower(); CustomFunctions.PLog("GetCardByRarityPrefix Exit 5"); return false; } __result = (((int)_cardData.CardUpgraded == 0) ? _cardData.UpgradesTo2.ToLower() : (_cardData.UpgradedFrom + "B").ToLower()); CustomFunctions.PLog("GetCardByRarityPrefix Exit 6"); return false; } if ((int)_cardData.CardUpgraded == 0) { __result = (((Object)(object)_cardData.UpgradesToRare != (Object)null) ? _cardData.UpgradesToRare.Id.ToLower() : _cardData.Id.ToLower()); CustomFunctions.PLog("GetCardByRarityPrefix Exit 7"); return false; } CardData cardData = Globals.Instance.GetCardData(_cardData.UpgradedFrom, false); if ((Object)(object)cardData != (Object)null && (Object)(object)cardData.UpgradesToRare != (Object)null) { __result = cardData.UpgradesToRare.Id.ToLower(); CustomFunctions.PLog("GetCardByRarityPrefix Exit 8"); return false; } } __result = _cardData.Id.ToLower(); CustomFunctions.PLog("GetCardByRarityPrefix - END"); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "BonusResists")] public static bool BonusResistsPrefix(ref Character __instance, ref int __result, DamageType damageType, string acId = "", bool countChargesConsumedPre = false, bool countChargesConsumedPost = false) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected I4, but got Unknown //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) int num = 0; switch (damageType - 1) { case 0: if (__instance.IsImmune((DamageType)1)) { num = 1000; break; } num += Traverse.Create((object)__instance).Field("resistSlashing").GetValue<int>(); if (!__instance.IsHero && AtOManager.Instance.IsChallengeTraitActive("reinforcedmonsters")) { num += 10; } break; case 1: if (__instance.IsImmune((DamageType)2)) { num = 1000; break; } num += Traverse.Create((object)__instance).Field("resistBlunt").GetValue<int>(); if (!__instance.IsHero && AtOManager.Instance.IsChallengeTraitActive("reinforcedmonsters")) { num += 10; } break; case 2: if (__instance.IsImmune((DamageType)3)) { num = 1000; break; } num += Traverse.Create((object)__instance).Field("resistPiercing").GetValue<int>(); if (!__instance.IsHero && AtOManager.Instance.IsChal