diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 67b5ec5794..d57155929a 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -63,6 +63,7 @@ namespace CalamityMod.ILEditing // Mechanics / features On_NPC.ApplyTileCollision += AllowFusionFeederToDigThroughSand; + On_NPC.RerollVariation += AllowPatronNameRerollsOnLicenseUse; IL_Player.ApplyEquipFunctional += ScopesRequireVisibilityToZoom; IL_Player.Hurt_PlayerDeathReason_int_int_refHurtInfo_bool_bool_int_bool_float_float_float += DodgeMechanicAdjustments; On_Player.PutHallowedArmorSetBonusOnCooldown += AddHolyProtectionCooldown; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index f7466891f6..0a75a8e37e 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -30,6 +30,7 @@ using CalamityMod.Tiles; using CalamityMod.Utilities.Daybreak; using CalamityMod.Walls; using CalamityMod.Walls.UnsafeWalls; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil.Cil; @@ -326,6 +327,27 @@ namespace CalamityMod.ILEditing } #endregion + #region Allow Patron Name Rerolls on License Use + private static bool AllowPatronNameRerollsOnLicenseUse(On_NPC.orig_RerollVariation orig, NPC self) + { + bool success = orig(self); + if (success) + { + if (self.type == NPCID.TownBunny) + CalamityWorld.bunnyName = false; + if (self.type == NPCID.TownCat) + CalamityWorld.catName = false; + if (self.type == NPCID.TownDog) + CalamityWorld.dogName = false; + + if (!self.TryGetGlobalNPC(out var calGlobalTownNPC)) + return success; + calGlobalTownNPC.setNewName = true; + } + return success; + } + #endregion + #region Prevent Diabolists from Dropping Stuff in GFB Before Plantera private static void PreventDiabolistLootLogic(On_NPC.orig_NPCLoot orig, NPC self) {