diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 9c9d5d0e92..85e05f4776 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -82,36 +82,6 @@ namespace CalamityMod.CalPlayer if (fearmongerRegenFrames > 0) fearmongerRegenFrames--; - // Reduce the expert+ debuff time multiplier to the normal mode multiplier - // TODO -- This should be a ModSystem, why is this in CalamityPlayer - if (CalamityConfig.Instance.NerfExpertDebuffs) - { - var copy = Main.RegisteredGameModes[GameModeID.Expert]; - copy.DebuffTimeMultiplier = 1f; - Main.RegisteredGameModes[GameModeID.Expert] = copy; - - copy = Main.RegisteredGameModes[GameModeID.Master]; - copy.DebuffTimeMultiplier = 1f; - Main.RegisteredGameModes[GameModeID.Master] = copy; - - // NOTE -- While this may seem at a glance to be redundant and nonsensical, the underlying setter for this property is what causes the game mode properties to - // be refreshed and copied from RegisteredGameModes. Without this, the above behavior is not reflected ingame, as GameModeData is a value type, not a reference type. - Main.GameMode = Main.GameMode; - } - // If people want to suffer, let them suffer - else - { - var copy = Main.RegisteredGameModes[GameModeID.Expert]; - copy.DebuffTimeMultiplier = 2f; - Main.RegisteredGameModes[GameModeID.Expert] = copy; - - copy = Main.RegisteredGameModes[GameModeID.Master]; - copy.DebuffTimeMultiplier = 2.5f; - Main.RegisteredGameModes[GameModeID.Master] = copy; - - Main.GameMode = Main.GameMode; - } - // Go through the old positions for the player. for (int i = Player.Calamity().OldPositions.Length - 1; i > 0; i--) { diff --git a/Systems/NerfExpertDebuffsSystem.cs b/Systems/NerfExpertDebuffsSystem.cs new file mode 100644 index 0000000000..6837336977 --- /dev/null +++ b/Systems/NerfExpertDebuffsSystem.cs @@ -0,0 +1,42 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class NerfExpertDebuffsSystem : ModSystem + { + public override void PostUpdateTime() + { + // Reduce the expert+ debuff time multiplier to the normal mode multiplier + if (CalamityConfig.Instance.NerfExpertDebuffs) + { + var copy = Main.RegisteredGameModes[GameModeID.Expert]; + copy.DebuffTimeMultiplier = 1f; + Main.RegisteredGameModes[GameModeID.Expert] = copy; + + copy = Main.RegisteredGameModes[GameModeID.Master]; + copy.DebuffTimeMultiplier = 1f; + Main.RegisteredGameModes[GameModeID.Master] = copy; + + // NOTE -- While this may seem at a glance to be redundant and nonsensical, the underlying setter for this property is what causes the game mode properties to + // be refreshed and copied from RegisteredGameModes. Without this, the above behavior is not reflected ingame, as GameModeData is a value type, not a reference type. + Main.GameMode = Main.GameMode; + } + // If people want to suffer, let them suffer + else + { + var copy = Main.RegisteredGameModes[GameModeID.Expert]; + copy.DebuffTimeMultiplier = 2f; + Main.RegisteredGameModes[GameModeID.Expert] = copy; + + copy = Main.RegisteredGameModes[GameModeID.Master]; + copy.DebuffTimeMultiplier = 2.5f; + Main.RegisteredGameModes[GameModeID.Master] = copy; + + Main.GameMode = Main.GameMode; + } + } + } +}