diff --git a/src/Patches/EnemyPatch.cs b/src/Patches/EnemyPatch.cs index 8b44a1e..fcf500d 100644 --- a/src/Patches/EnemyPatch.cs +++ b/src/Patches/EnemyPatch.cs @@ -7,7 +7,7 @@ namespace DebugUtilityMod { class EnemyPatch { - + // Weak elites and bosses [HarmonyPatch(typeof(BossSpawner), "LoadSpawners")] [HarmonyPrefix] @@ -15,8 +15,8 @@ static void BossLoadSpawners_prefix(ref List spawners) { foreach (BossSpawn bs in spawners) { - Health h = bs.bossPrefab.GetComponent(); - h.maxHP = 100; + Health bossHealth = bs.bossPrefab.GetComponent(); + bossHealth.maxHP = 100; } } @@ -24,11 +24,11 @@ static void BossLoadSpawners_prefix(ref List spawners) [HarmonyPrefix] static void HordeLoadSpawners_prefix(ref List spawnSessions) { - foreach (SpawnSession ss in spawnSessions) + foreach (SpawnSession spawnSession in spawnSessions) { - if (ss.isElite) + if (spawnSession.isElite) { - ss.HP = 100; + spawnSession.HP = 100; } } diff --git a/src/Patches/FastGamePatch.cs b/src/Patches/FastGamePatch.cs index bce2503..db1b4cb 100644 --- a/src/Patches/FastGamePatch.cs +++ b/src/Patches/FastGamePatch.cs @@ -77,7 +77,7 @@ static void HordeLoadSpawners_prefix(ref List spawnSessions) } } - // This is useful trust me, avoid reducing twice spawn timers, + // This is useful trust me, avoid reducing twice spawn timers, static private bool IsDone(bool isBoss) { bool isStandard = SelectedMap.MapData.nameStringID.key == "standard_mode_name"; @@ -92,7 +92,6 @@ static private bool IsDone(bool isBoss) return false; } - [HarmonyPatch(typeof(SummonEgg), "Start")] [HarmonyPrefix] static void SummonnEggStart_prefix(ref float ___secondsToHatch) diff --git a/src/Patches/InvincibilityPatch.cs b/src/Patches/InvincibilityPatch.cs index c3ff29b..d1b1521 100644 --- a/src/Patches/InvincibilityPatch.cs +++ b/src/Patches/InvincibilityPatch.cs @@ -6,9 +6,9 @@ namespace DebugUtilityMod { class InvincibilityPatch { - [HarmonyPatch(typeof(CombatState), "Enter")] + [HarmonyPatch(typeof(InitState), "Exit")] [HarmonyPostfix] - static void CombatStateEnter_postfix(ref CombatState __instance) + static void InitStateExit_postfix(ref InitState __instance) { //Flip invincibility bool ((Health)Traverse.Create(__instance).Property("playerHealth").GetValue()).isInvincible.Flip(); diff --git a/src/Patches/RerollPatch.cs b/src/Patches/RerollPatch.cs index aa0a41d..a8b335b 100644 --- a/src/Patches/RerollPatch.cs +++ b/src/Patches/RerollPatch.cs @@ -7,29 +7,23 @@ namespace DebugUtilityMod { static class RerollPatch { + static Button reroolButton; [HarmonyPatch(typeof(InitState), "Enter")] [HarmonyPrefix] - static void Enter_prefix(ref PowerupMenuState __instance) + static void InitStateEnter_prefix(ref PowerupMenuState __instance) { // Set reroll button active to give the reroll passive to every character //((Button)Traverse.Create(__instance).Property("powerupRerollButton").GetValue()).gameObject.SetActive(true); PowerupGenerator.CanReroll = true; + reroolButton = ((Button)Traverse.Create(__instance).Property("powerupRerollButton").GetValue()); } - /* - [HarmonyPatch(typeof(PowerupMenuState), "Enter")] - [HarmonyPostfix] - static void Enter_postfix(ref PowerupMenuState __instance) - { - // Set reroll button active to give the reroll passive to every character - ((Button)Traverse.Create(__instance).Property("powerupRerollButton").GetValue()).gameObject.SetActive(true); - } - */ + [HarmonyPatch(typeof(PowerupMenuState), "OnReroll")] [HarmonyPostfix] static void OnReroll_postfix(ref PowerupMenuState __instance) { // Set reroll button active after reroll, to obtain infinite reroll - ((Button)Traverse.Create(__instance).Property("powerupRerollButton").GetValue()).gameObject.SetActive(true); + reroolButton.gameObject.SetActive(true); } } } diff --git a/src/Patches/XPPatch.cs b/src/Patches/XPPatch.cs index f103321..002bd7d 100644 --- a/src/Patches/XPPatch.cs +++ b/src/Patches/XPPatch.cs @@ -9,6 +9,7 @@ static class XPPatch { static bool doGainXP = true; static int lvl = 1; + [HarmonyPatch(typeof(PlayerXP), "Awake")] [HarmonyPostfix] static void PlayerXPAwake_postfix(ref StatMod ___xpMultiplier) @@ -24,9 +25,10 @@ static void PlayerXPAwake_postfix(ref StatMod ___xpMultiplier) [HarmonyPrefix] static bool GainXP_prefix() { + //Skip XP gain if playerLVL >= maxLVL return doGainXP; } - + [HarmonyPatch(typeof(CombatState), "OnLevelUP")] [HarmonyPrefix] static void OnLevelUp_prefix()