diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2fc0b260aa..c9cb6b7a34 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2820,9 +2820,9 @@ namespace CalamityMod.CalPlayer int duration = chaosStateDuration; if (areThereAnyDamnBosses || areThereAnyDamnEvents) duration = (int)(chaosStateDurationBoss * 1.5); - if (Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(EvasionScarfCooldown))) + if (Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.EvasionScarf))) duration = (int)(duration * 1.5); - else if (Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(CounterScarfCooldown))) + else if (Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.CounterScarf))) duration *= 2; player.AddBuff(BuffID.ChaosState, duration, true); //Add a cooldown here so it can have the custom NR icon @@ -2831,10 +2831,10 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityMod.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == player.whoAmI && !divineBless && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(DivineBlessCooldown))) + if (CalamityMod.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == player.whoAmI && !divineBless && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.DivineBless))) { int seconds = CalamityUtils.SecondsToFrames(15f); - player.AddBuff(ModContent.BuffType(), seconds, false); + player.AddBuff(ModContent.BuffType(), seconds, false); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AngelicAllianceActivation"), player.Center); // Spawn an archangel for every minion you have @@ -2859,12 +2859,12 @@ namespace CalamityMod.CalPlayer } } if (CalamityMod.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && - wearingRogueArmor && rogueStealthMax > 0 && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(SandCloakCooldown))) + wearingRogueArmor && rogueStealthMax > 0 && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.SandCloak))) { - Cooldowns.Add(new SandCloakCooldown(CalamityUtils.SecondsToFrames(30f), player)); - rogueStealth -= rogueStealthMax * 0.25f; - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI); - Main.PlaySound(SoundID.Item, player.position, 45); + Cooldowns.Add(new Cooldowns.SandCloakCooldown(CalamityUtils.SecondsToFrames(30f), player)); + rogueStealth -= rogueStealthMax * 0.25f; + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI); + Main.PlaySound(SoundID.Item, player.position, 45); } if (CalamityMod.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0) @@ -2897,9 +2897,9 @@ namespace CalamityMod.CalPlayer int duration = chaosStateDuration; if (areThereAnyDamnBosses || areThereAnyDamnEvents) duration = chaosStateDurationBoss; - if (Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(EvasionScarfCooldown))) + if (Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.EvasionScarf))) duration = (int)(duration * 1.5); - else if (Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(CounterScarfCooldown))) + else if (Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.CounterScarf))) duration *= 2; player.AddBuff(BuffID.ChaosState, duration, true); @@ -2922,18 +2922,18 @@ namespace CalamityMod.CalPlayer } } if (CalamityMod.PlaguePackHotKey.JustPressed && hasJetpack && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && - wearingRogueArmor && rogueStealthMax > 0 && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(JetpackCooldown)) && !player.mount.Active) + wearingRogueArmor && rogueStealthMax > 0 && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(RogueBooster)) && !player.mount.Active) { jetPackDash = blunderBooster ? 15 : 10; jetPackDirection = player.direction; - Cooldowns.Add(new JetpackCooldown(60, player, blunderBooster ? "birb" : "default")); + Cooldowns.Add(new RogueBooster(60, player, blunderBooster ? "birb" : "default")); rogueStealth -= rogueStealthMax * 0.25f; Main.PlaySound(SoundID.Item66, player.Center); Main.PlaySound(SoundID.Item34, player.Center); } if (CalamityMod.TarraHotKey.JustPressed) { - if (brimflameSet && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(BrimflameFrenzyCooldown))) + if (brimflameSet && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(BrimflameFrenzy))) { if (player.whoAmI == Main.myPlayer) { @@ -2967,18 +2967,18 @@ namespace CalamityMod.CalPlayer } } } - if (tarraMelee && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(TarragonCloakCooldown)) && !tarragonCloak) + if (tarraMelee && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.TarragonCloak)) && !tarragonCloak) { if (player.whoAmI == Main.myPlayer) { - player.AddBuff(ModContent.BuffType(), 602, false); + player.AddBuff(ModContent.BuffType(), 602, false); } } - if (bloodflareRanged && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(BloodflareSoulCooldown))) + if (bloodflareRanged && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(BloodflareRangedSet))) { if (player.whoAmI == Main.myPlayer) { - Cooldowns.Add(new BloodflareSoulCooldown(1800, player)); + Cooldowns.Add(new BloodflareRangedSet(1800, player)); } Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BloodflareRangerActivation"), player.Center); for (int d = 0; d < 64; d++) @@ -3020,7 +3020,7 @@ namespace CalamityMod.CalPlayer } } } - if (omegaBlueSet && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(OmegaBlueCooldown))) + if (omegaBlueSet && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(OmegaBlue))) { if (player.whoAmI == Main.myPlayer) { @@ -3075,10 +3075,10 @@ namespace CalamityMod.CalPlayer } } } - if (plagueReaper && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PlagueBlackoutCooldown))) + if (plagueReaper && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PlagueBlackout))) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueReaperAbility"), player.Center); - Cooldowns.Add(new PlagueBlackoutCooldown(1800, player)); + Cooldowns.Add(new PlagueBlackout(1800, player)); } if (forbiddenCirclet && forbiddenCooldown <= 0) { @@ -3111,7 +3111,7 @@ namespace CalamityMod.CalPlayer } } } - if (prismaticSet && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PrismaticLaserCooldown)) && prismaticLasers <= 0) + if (prismaticSet && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PrismaticLaser)) && prismaticLasers <= 0) prismaticLasers = CalamityUtils.SecondsToFrames(35f); } if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum && !areThereAnyDamnBosses) @@ -3142,7 +3142,7 @@ namespace CalamityMod.CalPlayer } // Trigger for pressing the God Slayer dash key - if (CalamityMod.GodSlayerDashHotKey.JustPressed && (player.controlUp || player.controlDown || player.controlLeft || player.controlRight) && !player.pulley && player.grappling[0] == -1 && !player.tongued && !player.mount.Active && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GodslayerDashCooldown)) && player.dashDelay == 0) + if (CalamityMod.GodSlayerDashHotKey.JustPressed && (player.controlUp || player.controlDown || player.controlLeft || player.controlRight) && !player.pulley && player.grappling[0] == -1 && !player.tongued && !player.mount.Active && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GodSlayerDash)) && player.dashDelay == 0) godSlayerDashHotKeyPressed = true; // Trigger for pressing the Rage hotkey. @@ -3876,7 +3876,7 @@ namespace CalamityMod.CalPlayer } if (sirenBoobs && NPC.downedBoss3) { - if (player.whoAmI == Main.myPlayer && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(SirenIceShieldCooldown))) + if (player.whoAmI == Main.myPlayer && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(AquaticHeartIceShield))) { player.AddBuff(ModContent.BuffType(), 2); } @@ -4013,7 +4013,7 @@ namespace CalamityMod.CalPlayer //Add a cooldown display for potion sickness if (player.potionDelay > 0) { - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PotionSicknessDisplay))) + if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PotionSickness))) { Cooldowns.Add(new PotionSicknessDisplay(player.potionDelay, player)); } @@ -4021,7 +4021,7 @@ namespace CalamityMod.CalPlayer if (player.chaosState) { - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(ChaosStateDisplay))) + if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(ChaosState))) { for (int l = 0; l < Player.MaxBuffs; l++) { @@ -4159,14 +4159,14 @@ namespace CalamityMod.CalPlayer return true; } // Neither scarf can be used if either is on cooldown - if (playerDashing && dashMod == 1 && player.dashDelay < 0 && dodgeScarf && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(CounterScarfCooldown) || cooldown.GetType() == typeof(EvasionScarfCooldown))) + if (playerDashing && dashMod == 1 && player.dashDelay < 0 && dodgeScarf && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.CounterScarf) || cooldown.GetType() == typeof(Cooldowns.EvasionScarf))) { - CounterScarfDodge(); + CounterScarfDodge(); return true; } // Neither mirror can be used if either is on cooldown - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodgeCooldown))) + if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodge))) { if (eclipseMirror) { @@ -4234,9 +4234,9 @@ namespace CalamityMod.CalPlayer private void CounterScarfDodge() { if (evasionScarf) - Cooldowns.Add(new EvasionScarfCooldown(player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f), player)); + Cooldowns.Add(new Cooldowns.EvasionScarf(player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f), player)); else - Cooldowns.Add(new CounterScarfCooldown(player.chaosState ? 1800 : 900, player)); + Cooldowns.Add(new Cooldowns.CounterScarf(player.chaosState ? 1800 : 900, player)); player.GiveIFrames(player.longInvince ? 100 : 60, true); @@ -4263,7 +4263,7 @@ namespace CalamityMod.CalPlayer { if (player.whoAmI == Main.myPlayer && abyssalMirror && !eclipseMirror) { - Cooldowns.Add(new GlobalDodgeCooldown(MirrorDodgeCooldown, player, "abyssmirror")); + Cooldowns.Add(new GlobalDodge(MirrorDodgeCooldown, player, "abyssmirror")); // TODO -- why is this here? player.noKnockback = true; @@ -4293,7 +4293,7 @@ namespace CalamityMod.CalPlayer { if (player.whoAmI == Main.myPlayer && eclipseMirror) { - Cooldowns.Add(new GlobalDodgeCooldown(MirrorDodgeCooldown, player, "eclipsemirror")); + Cooldowns.Add(new GlobalDodge(MirrorDodgeCooldown, player, "eclipsemirror")); // TODO -- why is this here? player.noKnockback = true; @@ -4406,7 +4406,7 @@ namespace CalamityMod.CalPlayer } } - if (nCore && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(NebulousCoreCooldown))) + if (nCore && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.NebulousCore))) { Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 67); @@ -4429,7 +4429,7 @@ namespace CalamityMod.CalPlayer if (player.statLife > player.statLifeMax2) player.statLife = player.statLifeMax2; - Cooldowns.Add(new NebulousCoreCooldown(CalamityUtils.SecondsToFrames(90f), player)); + Cooldowns.Add(new Cooldowns.NebulousCore(CalamityUtils.SecondsToFrames(90f), player)); return false; } @@ -4450,7 +4450,7 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), silvaReviveDuration); - if (draconicSurge && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(DraconicElixirCooldown))) + if (draconicSurge && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(DraconicElixir))) { player.statLife += player.statLifeMax2 / 2; player.HealEffect(player.statLifeMax2 / 2); @@ -4461,7 +4461,7 @@ namespace CalamityMod.CalPlayer if (player.FindBuffIndex(ModContent.BuffType()) > -1) { player.ClearBuff(ModContent.BuffType()); - Cooldowns.Add(new DraconicElixirCooldown(CalamityUtils.SecondsToFrames(60f), player)); + Cooldowns.Add(new DraconicElixir(CalamityUtils.SecondsToFrames(60f), player)); // Additional potion sickness time int additionalTime = 0; @@ -4493,9 +4493,9 @@ namespace CalamityMod.CalPlayer return false; } - if (permafrostsConcoction && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PermafrostConcoctionCooldown))) + if (permafrostsConcoction && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PermafrostConcoction))) { - Cooldowns.Add(new PermafrostConcoctionCooldown(CalamityUtils.SecondsToFrames(180f), player)); + Cooldowns.Add(new PermafrostConcoction(CalamityUtils.SecondsToFrames(180f), player)); player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(3f)); @@ -5413,16 +5413,16 @@ namespace CalamityMod.CalPlayer contactDamageReduction += 0.5; } - if (fleshTotem && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(FleshTotemCooldown))) + if (fleshTotem && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.FleshTotem))) { - Cooldowns.Add(new FleshTotemCooldown(1200, player, coreOfTheBloodGod ? "bloodgod" : "default")); //20 seconds - contactDamageReduction += 0.5; + Cooldowns.Add(new Cooldowns.FleshTotem(1200, player, coreOfTheBloodGod ? "bloodgod" : "default")); //20 seconds + contactDamageReduction += 0.5; } - if (tarragonCloak && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(TarragonCloakCooldown)) && tarraMelee) - contactDamageReduction += 0.5; + if (tarragonCloak && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.TarragonCloak)) && tarraMelee) + contactDamageReduction += 0.5; - if (bloodflareMelee && bloodflareFrenzy && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(BloodflareFrenzyCooldown))) + if (bloodflareMelee && bloodflareFrenzy && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(BloodflareFrenzy))) contactDamageReduction += 0.5; if (npc.Calamity().tSad > 0) @@ -5430,7 +5430,7 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().relicOfResilienceWeakness > 0) { - contactDamageReduction += RelicOfResilience.WeaknessDR; + contactDamageReduction += Items.Weapons.Typeless.RelicOfResilience.WeaknessDR; npc.Calamity().relicOfResilienceWeakness = 0; } @@ -5556,7 +5556,7 @@ namespace CalamityMod.CalPlayer if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && damage > 0) { // Reflects count as dodges. They share the timer and can be disabled by Armageddon right click. - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodgeCooldown)) && !disableAllDodges) + if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodge)) && !disableAllDodges) { // The Evolution if (projRefRare) @@ -5572,7 +5572,7 @@ namespace CalamityMod.CalPlayer projRefRareLifeRegenCounter = 300; projTypeJustHitBy = proj.type; - Cooldowns.Add(new GlobalDodgeCooldown(EvolutionReflectCooldown, player)); + Cooldowns.Add(new GlobalDodge(EvolutionReflectCooldown, player)); // Send a Calamity dodge cooldown packet. if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) SyncCooldown(false); @@ -5726,7 +5726,7 @@ namespace CalamityMod.CalPlayer } if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && damage > 0) { - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodgeCooldown)) && !disableAllDodges && daedalusReflect && !projRefRare) + if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodge)) && !disableAllDodges && daedalusReflect && !projRefRare) { projectileDamageReduction += 0.5; } @@ -6475,7 +6475,7 @@ namespace CalamityMod.CalPlayer } // Reflects count as dodges. They share the timer and can be disabled by Armageddon right click. - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodgeCooldown)) && !disableAllDodges) + if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(GlobalDodge)) && !disableAllDodges) { if (daedalusReflect && !projRefRare) { @@ -6487,7 +6487,7 @@ namespace CalamityMod.CalPlayer damage /= 2; - Cooldowns.Add(new GlobalDodgeCooldown(DaedalusReflectCooldown, player)); + Cooldowns.Add(new GlobalDodge(DaedalusReflectCooldown, player)); // No return because the projectile hit isn't canceled -- it only does half damage. } @@ -6665,7 +6665,7 @@ namespace CalamityMod.CalPlayer player.body = mod.GetEquipSlot("MeldTransformationBody", EquipType.Body); player.head = mod.GetEquipSlot("MeldTransformationHead", EquipType.Head); } - else if ((omegaBlueTransformationPower || omegaBlueTransformationForce) && Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(OmegaBlueCooldown) && cooldown.TimeLeft > 1500)) + else if ((omegaBlueTransformationPower || omegaBlueTransformationForce) && Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(OmegaBlue) && cooldown.TimeLeft > 1500)) { player.head = mod.GetEquipSlot("OmegaBlueTransformationHead", EquipType.Head); } @@ -7172,7 +7172,7 @@ namespace CalamityMod.CalPlayer public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) { if (!profanedCrystal && pArtifact) - Cooldowns.Add(new ProfanedSoulArtifactCooldown(300, player)); + Cooldowns.Add(new Cooldowns.ProfanedSoulArtifact(300, player)); // Bloodflare Core defense shattering if (bloodflareCore) @@ -7354,16 +7354,16 @@ namespace CalamityMod.CalPlayer } if (inkBomb && !abyssalMirror && !eclipseMirror) { - if (player.whoAmI == Main.myPlayer && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(InkBombCooldown))) + if (player.whoAmI == Main.myPlayer && !Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.InkBomb))) { - Cooldowns.Add(new InkBombCooldown(1200, player)); - rogueStealth += 0.5f; + Cooldowns.Add(new Cooldowns.InkBomb(1200, player)); + rogueStealth += 0.5f; for (int i = 0; i < 5; i++) { - Main.PlaySound(SoundID.Item, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); + Main.PlaySound(SoundID.Item, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); int ink = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); if (ink.WithinBounds(Main.maxProjectiles)) - Main.projectile[ink].Calamity().forceTypeless = true; + Main.projectile[ink].Calamity().forceTypeless = true; } } } @@ -8109,7 +8109,7 @@ namespace CalamityMod.CalPlayer // Cooldown for God Slayer Armor dash if (dashMod == 9) { - Cooldowns.Add(new GodslayerDashCooldown(CalamityUtils.SecondsToFrames(35f), player)); + Cooldowns.Add(new GodSlayerDash(CalamityUtils.SecondsToFrames(35f), player)); godSlayerDashHotKeyPressed = false; } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ab09d49869..f1d4e2b564 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -868,7 +868,7 @@ namespace CalamityMod.CalPlayer bool canProvideBuffs = profanedCrystalBuffs || (!profanedCrystal && pArtifact) || (profanedCrystal && CalamityWorld.downedSCal && CalamityWorld.downedExoMechs); bool attack = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; // Guardian bonuses if not burnt out - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(ProfanedSoulArtifactCooldown)) && canProvideBuffs) + if (!Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.ProfanedSoulArtifact)) && canProvideBuffs) { bool healer = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; bool defend = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; @@ -1165,7 +1165,7 @@ namespace CalamityMod.CalPlayer Main.dust[green].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } } - if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(SilvaReviveCooldown)) && hasSilvaEffect && silvaCountdown <= 0 && !areThereAnyDamnBosses && !areThereAnyDamnEvents) + if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(SilvaRevive)) && hasSilvaEffect && silvaCountdown <= 0 && !areThereAnyDamnBosses && !areThereAnyDamnEvents) { silvaCountdown = 480; hasSilvaEffect = false; @@ -1179,7 +1179,7 @@ namespace CalamityMod.CalPlayer { tarraDefenseTime = 600; if (player.whoAmI == Main.myPlayer) - Cooldowns.Add(new TarragonCloakCooldown(1800, player)); + Cooldowns.Add(new Cooldowns.TarragonCloak(1800, player)); } for (int j = 0; j < 2; j++) @@ -1209,16 +1209,16 @@ namespace CalamityMod.CalPlayer { tarraThrowingCrits = 0; if (player.whoAmI == Main.myPlayer && !disableAllDodges) - player.AddBuff(ModContent.BuffType(), 180, false); + player.AddBuff(ModContent.BuffType(), 180, false); } for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; - if (player.buffTime[l] <= 1 && hasBuff == ModContent.BuffType()) + if (player.buffTime[l] <= 1 && hasBuff == ModContent.BuffType()) { if (player.whoAmI == Main.myPlayer) - Cooldowns.Add(new TarragonImmunityCooldown(1500, player)); + Cooldowns.Add(new Cooldowns.TarragonImmunityCooldown(1500, player)); } bool shouldAffect = CalamityLists.debuffList.Contains(hasBuff); @@ -1607,7 +1607,7 @@ namespace CalamityMod.CalPlayer { brimflameFrenzy = false; player.ClearBuff(ModContent.BuffType()); - Cooldowns.Add(new BrimflameFrenzyCooldown(BrimflameScowl.CooldownLength, player)); + Cooldowns.Add(new BrimflameFrenzy(BrimflameScowl.CooldownLength, player)); } if (!bloodflareMelee && bloodflareFrenzy) { @@ -1618,23 +1618,23 @@ namespace CalamityMod.CalPlayer if (!tarraMelee && tarragonCloak) { tarragonCloak = false; - player.ClearBuff(ModContent.BuffType()); - Cooldowns.Add(new TarragonCloakCooldown(1800, player)); + player.ClearBuff(ModContent.BuffType()); + Cooldowns.Add(new Cooldowns.TarragonCloak(1800, player)); } if (!tarraThrowing && tarragonImmunity) { tarragonImmunity = false; - player.ClearBuff(ModContent.BuffType()); - Cooldowns.Add(new TarragonCloakCooldown(1500, player)); + player.ClearBuff(ModContent.BuffType()); + Cooldowns.Add(new Cooldowns.TarragonCloak(1500, player)); } - if (!omegaBlueSet && Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(OmegaBlueCooldown) && cooldown.TimeLeft > 1500)) + if (!omegaBlueSet && Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(OmegaBlue) && cooldown.TimeLeft > 1500)) { - Cooldowns.Find(cooldown => cooldown.GetType() == typeof(OmegaBlueCooldown)).TimeLeft = 1500; + Cooldowns.Find(cooldown => cooldown.GetType() == typeof(OmegaBlue)).TimeLeft = 1500; player.ClearBuff(ModContent.BuffType()); } - if (!plagueReaper && Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PlagueBlackoutCooldown) && cooldown.TimeLeft > 1500)) + if (!plagueReaper && Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(PlagueBlackout) && cooldown.TimeLeft > 1500)) { - Cooldowns.Find(cooldown => cooldown.GetType() == typeof(PlagueBlackoutCooldown)).TimeLeft = 1500; + Cooldowns.Find(cooldown => cooldown.GetType() == typeof(PlagueBlackout)).TimeLeft = 1500; } if (!prismaticSet && prismaticLasers > 1800) @@ -1645,9 +1645,9 @@ namespace CalamityMod.CalPlayer if (!angelicAlliance && divineBless) { divineBless = false; - player.ClearBuff(ModContent.BuffType()); + player.ClearBuff(ModContent.BuffType()); int seconds = CalamityUtils.SecondsToFrames(60f); - Cooldowns.Add(new DivineBlessCooldown(seconds, player)); + Cooldowns.Add(new Cooldowns.DivineBless(seconds, player)); } // Armageddon's Dodge Disable feature puts Shadow Dodge/Holy Protection on permanent cooldown @@ -2608,7 +2608,7 @@ namespace CalamityMod.CalPlayer if (blueCandle) player.moveSpeed += 0.1f; - if (Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(DraconicElixirCooldown))) // Weird mod conflicts with like Luiafk + if (Cooldowns.Exists((object cooldown) => cooldown.GetType() == typeof(Cooldowns.DraconicElixir))) // Weird mod conflicts with like Luiafk { draconicSurge = false; if (player.FindBuffIndex(ModContent.BuffType()) > -1) @@ -3478,19 +3478,19 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; - if (hasBuff == ModContent.BuffType()) + if (hasBuff == ModContent.BuffType()) { angelicActivate = player.buffTime[l]; } } - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) angelicActivate = -1; if (angelicActivate == 1) { int seconds = CalamityUtils.SecondsToFrames(60f); - Cooldowns.Add(new DivineBlessCooldown(seconds, player)); + Cooldowns.Add(new Cooldowns.DivineBless(seconds, player)); } } diff --git a/Cooldowns/SirenIceShieldCooldown.cs b/Cooldowns/AquaticHeartIceShield.cs similarity index 63% rename from Cooldowns/SirenIceShieldCooldown.cs rename to Cooldowns/AquaticHeartIceShield.cs index 2404af9cee..7e5a8ac71e 100644 --- a/Cooldowns/SirenIceShieldCooldown.cs +++ b/Cooldowns/AquaticHeartIceShield.cs @@ -4,19 +4,15 @@ using Terraria; namespace CalamityMod.Cooldowns { - public class SirenIceShieldCooldown : Cooldown + public class AquaticHeartIceShield : CooldownHandler { - public override string SyncID => "SirenHeartShield"; + public AquaticHeartIceShield(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Ice Shield Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/SirenIceShield"; + public override string Texture => "CalamityMod/Cooldowns/AquaticHeartIceShield"; public override Color OutlineColor => Color.Lerp(new Color(163, 186, 198), new Color(146, 187, 255), (float)Math.Sin(Main.GlobalTime) * 0.5f + 0.5f); public override Color CooldownStartColor => new Color(124, 195, 214); public override Color CooldownEndColor => new Color(147, 230, 253); - - - public SirenIceShieldCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/SirenIceShield.png b/Cooldowns/AquaticHeartIceShield.png similarity index 100% rename from Cooldowns/SirenIceShield.png rename to Cooldowns/AquaticHeartIceShield.png diff --git a/Cooldowns/SirenIceShieldOutline.png b/Cooldowns/AquaticHeartIceShieldOutline.png similarity index 100% rename from Cooldowns/SirenIceShieldOutline.png rename to Cooldowns/AquaticHeartIceShieldOutline.png diff --git a/Cooldowns/SirenIceShieldOverlay.png b/Cooldowns/AquaticHeartIceShieldOverlay.png similarity index 100% rename from Cooldowns/SirenIceShieldOverlay.png rename to Cooldowns/AquaticHeartIceShieldOverlay.png diff --git a/Cooldowns/BloodflareFrenzy.cs b/Cooldowns/BloodflareFrenzy.cs new file mode 100644 index 0000000000..c2f091d7db --- /dev/null +++ b/Cooldowns/BloodflareFrenzy.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class BloodflareFrenzy : CooldownHandler + { + public BloodflareFrenzy(CooldownInstance? c) : base(c) { } + + public override bool ShouldDisplay => true; + public override string DisplayName => "Blood Frenzy Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/BloodflareFrenzy"; + public override Color OutlineColor => new Color(229, 171, 124); + public override Color CooldownStartColor => Color.Lerp(new Color(149, 127, 109), new Color(220, 101, 101), 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(149, 127, 109), new Color(220, 101, 101), 1 - instance.Completion); + } +} \ No newline at end of file diff --git a/Cooldowns/BloodflareFrenzyCooldown.cs b/Cooldowns/BloodflareFrenzyCooldown.cs deleted file mode 100644 index 2873ef0ecc..0000000000 --- a/Cooldowns/BloodflareFrenzyCooldown.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class BloodflareFrenzyCooldown : Cooldown - { - public override string ID => "BloodflareFrenzy"; - public override bool ShouldDisplay => true; - public override string DisplayName => "Blood Frenzy Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/BloodflareFrenzy"; - public override Color OutlineColor => new Color(229, 171, 124); - public override Color CooldownStartColor => Color.Lerp(new Color(149, 127, 109), new Color(220, 101, 101), 1 - Completion); - public override Color CooldownEndColor => Color.Lerp(new Color(149, 127, 109), new Color(220, 101, 101), 1 - Completion); - - public BloodflareFrenzyCooldown(int duration, Player player) : base(duration, player) - { - } - } -} \ No newline at end of file diff --git a/Cooldowns/BloodflareSoulCooldown.cs b/Cooldowns/BloodflareRangedSet.cs similarity index 59% rename from Cooldowns/BloodflareSoulCooldown.cs rename to Cooldowns/BloodflareRangedSet.cs index 25fae8032c..4cc9645add 100644 --- a/Cooldowns/BloodflareSoulCooldown.cs +++ b/Cooldowns/BloodflareRangedSet.cs @@ -1,23 +1,19 @@ using Microsoft.Xna.Framework; -using Terraria; using Terraria.Audio; namespace CalamityMod.Cooldowns { - public class BloodflareSoulCooldown : Cooldown + public class BloodflareRangedSet : CooldownHandler { - public override string SyncID => "BloodflareSoul"; + public BloodflareRangedSet(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Bloodflare Soul Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/BloodflareSoul"; + public override string Texture => "CalamityMod/Cooldowns/BloodflareSoul"; public override Color OutlineColor => new Color(255, 205, 219); public override Color CooldownStartColor => new Color(216, 60, 90); public override Color CooldownEndColor => new Color(251, 106, 150); - public override LegacySoundStyle EndSound => AfflictedPlayer.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/BloodflareRangerRecharge"); - - public BloodflareSoulCooldown(int duration, Player player) : base(duration, player) - { - } + public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/BloodflareRangerRecharge"); } } \ No newline at end of file diff --git a/Cooldowns/BloodflareSoul.png b/Cooldowns/BloodflareRangedSet.png similarity index 100% rename from Cooldowns/BloodflareSoul.png rename to Cooldowns/BloodflareRangedSet.png diff --git a/Cooldowns/BloodflareSoulOutline.png b/Cooldowns/BloodflareRangedSetOutline.png similarity index 100% rename from Cooldowns/BloodflareSoulOutline.png rename to Cooldowns/BloodflareRangedSetOutline.png diff --git a/Cooldowns/BloodflareSoulOverlay.png b/Cooldowns/BloodflareRangedSetOverlay.png similarity index 100% rename from Cooldowns/BloodflareSoulOverlay.png rename to Cooldowns/BloodflareRangedSetOverlay.png diff --git a/Cooldowns/BrimflameFrenzyCooldown.cs b/Cooldowns/BrimflameFrenzy.cs similarity index 64% rename from Cooldowns/BrimflameFrenzyCooldown.cs rename to Cooldowns/BrimflameFrenzy.cs index 8729dd5203..c2951c3b13 100644 --- a/Cooldowns/BrimflameFrenzyCooldown.cs +++ b/Cooldowns/BrimflameFrenzy.cs @@ -6,21 +6,18 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Cooldowns { - public class BrimflameFrenzyCooldown : Cooldown + public class BrimflameFrenzy : CooldownHandler { - public override string SyncID => "BrimflameFrenzy"; + public BrimflameFrenzy(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Brimflame Frenzy Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/BrimflameFrenzy"; + public override string Texture => "CalamityMod/Cooldowns/BrimflameFrenzy"; public override Color OutlineColor => new Color(211, 124, 93); - public override Color CooldownStartColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - Completion); - public override Color CooldownEndColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - Completion); + public override Color CooldownStartColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - instance.Completion); - public override LegacySoundStyle EndSound => AfflictedPlayer.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/BrimflameRecharge"); - - public BrimflameFrenzyCooldown(int duration, Player player) : base(duration, player) - { - } + public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/BrimflameRecharge"); public override bool UseCustomExpandedDraw => true; @@ -31,7 +28,7 @@ namespace CalamityMod.Cooldowns Texture2D sprite = GetTexture(Texture + "Eyes"); //Draw the icon - spriteBatch.Draw(sprite, position, null, Color.Crimson * opacity * (1 - Completion), 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(sprite, position, null, Color.Crimson * opacity * (1 - instance.Completion), 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); } } } \ No newline at end of file diff --git a/Cooldowns/ChaosState.cs b/Cooldowns/ChaosState.cs new file mode 100644 index 0000000000..0a4698ceff --- /dev/null +++ b/Cooldowns/ChaosState.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class ChaosState : CooldownHandler + { + public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.chaosState; + public override string DisplayName => "Teleportation Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/ChaosState" + skinTexture; + public override Color OutlineColor => outlineColor; + public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); + + //It's the same cooldown with different skins each time, basically. + public string skinTexture; + public Color outlineColor; + public Color cooldownColorStart; + public Color cooldownColorEnd; + + public ChaosState(CooldownInstance? c, string skin = "") : base(c) + { + switch (skin) + { + case "spectralveil": + skinTexture = "Veil"; + outlineColor = new Color(138, 120, 222); + cooldownColorStart = new Color(46, 46, 134); + cooldownColorEnd = new Color(81, 90, 156); + break; + + case "normalityrelocator": + skinTexture = "NR"; + outlineColor = new Color(129, 239, 246); + cooldownColorStart = new Color(134, 143, 151); + cooldownColorEnd = new Color(129, 239, 246); + break; + + default: + skinTexture = ""; + outlineColor = new Color(246, 116, 181); + cooldownColorStart = new Color(223, 58, 140); + cooldownColorEnd = new Color(255, 179, 218); + break; + } + } + } +} \ No newline at end of file diff --git a/Cooldowns/ChaosStateDisplay.cs b/Cooldowns/ChaosStateDisplay.cs deleted file mode 100644 index 453d4d86ab..0000000000 --- a/Cooldowns/ChaosStateDisplay.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class ChaosStateDisplay : Cooldown - { - public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && AfflictedPlayer.chaosState; - public override string DisplayName => "Teleportation Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/ChaosState" + skinTexture; - public override Color OutlineColor => outlineColor; - public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion); - public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion); - - //It's the same cooldown with different skins each time, basically. - public string skinTexture; - public Color outlineColor; - public Color cooldownColorStart; - public Color cooldownColorEnd; - - public ChaosStateDisplay(int duration, Player player, string skin = "default") : base(duration, player) - { - switch (skin) - { - case "spectralveil": - skinTexture = "Veil"; - outlineColor = new Color(138, 120, 222); - cooldownColorStart = new Color(46, 46, 134); - cooldownColorEnd = new Color(81, 90, 156); - break; - - case "normalityrelocator": - skinTexture = "NR"; - outlineColor = new Color(129, 239, 246); - cooldownColorStart = new Color(134, 143, 151); - cooldownColorEnd = new Color(129, 239, 246); - break; - - default: - skinTexture = ""; - outlineColor = new Color(246, 116, 181); - cooldownColorStart = new Color(223, 58, 140); - cooldownColorEnd = new Color(255, 179, 218); - break; - } - } - } -} \ No newline at end of file diff --git a/Cooldowns/Cooldown.cs b/Cooldowns/Cooldown.cs index 2db3731585..240bb45545 100644 --- a/Cooldowns/Cooldown.cs +++ b/Cooldowns/Cooldown.cs @@ -44,8 +44,40 @@ namespace CalamityMod.Cooldowns registry = new Cooldown[defaultSize]; nameToNetID = new Dictionary(defaultSize); - Register("AbyssalDivingSuitBreakingPlates", new DivingPlatesBreaking(null)); - Register("AbyssalDivingSuitBrokenPlates", new DivingPlatesBroken(null)); + // TODO -- CooldownHandlers should be ILoadable in 1.4 + + // Vanilla cooldowns represented by the interface + Cooldown potionSickness = Register("PotionSickness", new PotionSickness(null)); + Cooldown chaosState = Register("ChaosState", new ChaosState(null)); + Cooldown globalDodge = Register("GlobalDodge", new GlobalDodge(null)); + + // Calamity cooldowns + Cooldown aquaticHeartIceShield = Register("AquaticHeartIceShield", new AquaticHeartIceShield(null)); + Cooldown bloodflareFrenzy = Register("BloodflareFrenzy", new BloodflareFrenzy(null)); + Cooldown bloodflareRanged = Register("BloodflareRangedSet", new BloodflareRangedSet(null)); + Cooldown brimflameFrenzy = Register("BrimflameFrenzy", new BrimflameFrenzy(null)); + Cooldown counterScarf = Register("CounterScarf", new CounterScarf(null)); + Cooldown divineBless = Register("DivineBless", new DivineBless(null)); + Cooldown divingPlatesBreaking = Register("DivingPlatesBreaking", new DivingPlatesBreaking(null)); + Cooldown divingPlatesBroken = Register("DivingPlatesBroken", new DivingPlatesBroken(null)); + Cooldown draconicElixir = Register("DraconicElixir", new DraconicElixir(null)); + Cooldown evasionScarf = Register("EvasionScarf", new EvasionScarf(null)); + Cooldown fleshTotem = Register("FleshTotem", new FleshTotem(null)); + Cooldown godSlayerDash = Register("GodSlayerDash", new GodSlayerDash(null)); + Cooldown inkBomb = Register("InkBomb", new InkBomb(null)); + Cooldown lionHeartShield = Register("LionHeartShield", new LionHeartShield(null)); + Cooldown nebulousCore = Register("NebulousCore", new NebulousCore(null)); + Cooldown omegaBlue = Register("OmegaBlue", new OmegaBlue(null)); + Cooldown permafrostConcoction = Register("PermafrostConcoction", new PermafrostConcoction(null)); + Cooldown plagueBlackout = Register("PlagueBlackout", new PlagueBlackout(null)); + Cooldown prismaticLaser = Register("PrismaticLaser", new PrismaticLaser(null)); + Cooldown profanedSoulArtifact = Register("ProfanedSoulArtifact", new ProfanedSoulArtifact(null)); + Cooldown relicOfResilience = Register("RelicOfResilience", new RelicOfResilience(null)); + Cooldown rogueBooster = Register("RogueBooster", new RogueBooster(null)); + Cooldown sandCloak = Register("SandCloak", new SandCloak(null)); + Cooldown silvaRevive = Register("SilvaRevive", new SilvaRevive(null)); + Cooldown tarragonCloak = Register("TarragonCloak", new TarragonCloak(null)); + Cooldown universeSplitter = Register("UniverseSplitter", new UniverseSplitter(null)); } public static void Unload() @@ -56,17 +88,17 @@ namespace CalamityMod.Cooldowns } /// - /// Registers a cooldown for use in netcode. Cooldowns are useless until this has been done. + /// Registers a CooldownHandler for use in netcode, assigning it a Cooldown and thus a netID. Cooldowns are useless until this has been done. /// - /// - public static bool Register(string id, CooldownHandler h) + /// The registered Cooldown. + public static Cooldown Register(string id, CooldownHandler h) { int currentMaxID = registry.Length; // This case only happens when you cap out at 65,536 cooldown registrations (which should never occur). // It just stops you from registering more cooldowns. if (nextCDNetID == currentMaxID) - return false; + return null; Cooldown cd = new Cooldown(id, h); cd.netID = nextCDNetID; @@ -82,7 +114,7 @@ namespace CalamityMod.Cooldowns registry = largerArray; } - return true; + return cd; } #endregion } diff --git a/Cooldowns/CooldownHandler.cs b/Cooldowns/CooldownHandler.cs index 292c1e8caf..5b252c8b76 100644 --- a/Cooldowns/CooldownHandler.cs +++ b/Cooldowns/CooldownHandler.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Cooldowns { public class CooldownHandler { - public readonly CooldownInstance instance; + public CooldownInstance instance; public CooldownHandler(CooldownInstance? c) { @@ -35,7 +35,7 @@ namespace CalamityMod.Cooldowns /// For example, this is useful for cooldowns that don't tick down if there are any bosses alive.
/// You can also use it so that cooldowns which persist through death do not tick down while the player is dead. /// - public virtual bool CanTickDown() => true; + public virtual bool CanTickDown => true; /// /// Set this to true to make this cooldown remain even when the player dies.
@@ -53,12 +53,12 @@ namespace CalamityMod.Cooldowns /// /// The name of the cooldown instance, appears when the player hovers over the indicator /// - public virtual string DisplayName() => ""; + public virtual string DisplayName => ""; /// /// Whether or not this cooldown instance should appear in the cooldown rack UI. /// - public virtual bool ShouldDisplay() => true; + public virtual bool ShouldDisplay => true; /// /// The texture of the cooldown indicator.
@@ -93,17 +93,17 @@ namespace CalamityMod.Cooldowns /// The color used for the icon outline when rendering in expanded mode.
/// In compact mode, this color is used for the overlay that goes above the icon. ///
- public virtual Color GetOutlineColor() => Color.White; + public virtual Color OutlineColor => Color.White; /// /// The color used for the start of the circular cooldown timer rendered by shaders.
/// This color is only used when drawing in expanded mode and is ignored if a charge bar texture is provided. ///
- public virtual Color GetCooldownStartColor() => Color.Gray; + public virtual Color CooldownStartColor => Color.Gray; /// /// The color used for the end of the circular cooldown timer rendered by shaders.
/// This color is only used when drawing in expanded mode and is ignored if a charge bar texture is provided. ///
- public virtual Color GetCooldownEndColor() => Color.White; + public virtual Color CooldownEndColor => Color.White; /// /// Set this to true to disable default drawing and instead call the function DrawExpanded.
@@ -114,12 +114,11 @@ namespace CalamityMod.Cooldowns /// /// This method is called to render the cooldown when the cooldown rack is in expanded mode and UseCustomExpandedDraw is set to true. /// - public virtual void DrawExpanded(CooldownInstance instance, SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + public virtual void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) { Texture2D sprite = ModContent.GetTexture(Texture); Texture2D outline = ModContent.GetTexture(OutlineTexture); Texture2D barBase = ModContent.GetTexture(ChargeBarTexture); - Color outlineColor = GetOutlineColor(); //Draw the ring spriteBatch.End(); @@ -132,7 +131,7 @@ namespace CalamityMod.Cooldowns spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix); //Draw the outline - spriteBatch.Draw(outline, position, null, outlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); //Draw the icon spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); @@ -152,7 +151,7 @@ namespace CalamityMod.Cooldowns Texture2D sprite = ModContent.GetTexture(Texture); Texture2D outline = ModContent.GetTexture(OutlineTexture); Texture2D overlay = ModContent.GetTexture(OverlayTexture); - Color outlineColor = GetOutlineColor(); + Color outlineColor = OutlineColor; //Draw the outline spriteBatch.Draw(outline, position, null, outlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); @@ -174,12 +173,10 @@ namespace CalamityMod.Cooldowns { if (ChargeBarTexture == DefaultChargeBarTexture) { - Color startColor = GetCooldownStartColor(); - Color endColor = GetCooldownEndColor(); GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(1 - instance.Completion); - GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(startColor); - GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(endColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); } else diff --git a/Cooldowns/CounterScarfCooldown.cs b/Cooldowns/CounterScarf.cs similarity index 63% rename from Cooldowns/CounterScarfCooldown.cs rename to Cooldowns/CounterScarf.cs index 71bf618801..e28b535d64 100644 --- a/Cooldowns/CounterScarfCooldown.cs +++ b/Cooldowns/CounterScarf.cs @@ -4,19 +4,15 @@ using Terraria; namespace CalamityMod.Cooldowns { - public class CounterScarfCooldown : Cooldown + public class CounterScarf : CooldownHandler { - public override string SyncID => "CounterScarf"; + public CounterScarf(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Scarf Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/CounterScarf"; + public override string Texture => "CalamityMod/Cooldowns/CounterScarf"; public override Color OutlineColor => Color.Lerp(new Color(255, 115, 178), new Color(255, 76, 76), (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f); public override Color CooldownStartColor => new Color(194, 75, 97); public override Color CooldownEndColor => new Color(255, 76, 76); - - - public CounterScarfCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/DivineBlessCooldown.cs b/Cooldowns/DivineBless.cs similarity index 53% rename from Cooldowns/DivineBlessCooldown.cs rename to Cooldowns/DivineBless.cs index af7fa1b3da..bcd0e073a7 100644 --- a/Cooldowns/DivineBlessCooldown.cs +++ b/Cooldowns/DivineBless.cs @@ -5,25 +5,21 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Cooldowns { - public class DivineBlessCooldown : Cooldown + public class DivineBless : CooldownHandler { - public override string SyncID => "DivineBless"; + public DivineBless(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Divine Bless Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/DivineRecharge"; + public override string Texture => "CalamityMod/Cooldowns/DivineBless"; public override Color OutlineColor => new Color(233, 192, 68); public override Color CooldownStartColor => new Color(177, 105, 33); public override Color CooldownEndColor => new Color(233, 192, 68); - - public DivineBlessCooldown(int duration, Player player) : base(duration, player) - { - } - public override void OnCompleted() { - if (AfflictedPlayer.whoAmI == Main.myPlayer) - Projectile.NewProjectile(AfflictedPlayer.Center, Vector2.Zero, ProjectileType(), 0, 0f, AfflictedPlayer.whoAmI); + if (instance.player.whoAmI == Main.myPlayer) + Projectile.NewProjectile(instance.player.Center, Vector2.Zero, ProjectileType(), 0, 0f, instance.player.whoAmI); } } } \ No newline at end of file diff --git a/Cooldowns/DivineRecharge.png b/Cooldowns/DivineBless.png similarity index 100% rename from Cooldowns/DivineRecharge.png rename to Cooldowns/DivineBless.png diff --git a/Cooldowns/DivineRechargeOutline.png b/Cooldowns/DivineBlessOutline.png similarity index 100% rename from Cooldowns/DivineRechargeOutline.png rename to Cooldowns/DivineBlessOutline.png diff --git a/Cooldowns/DivineRechargeOverlay.png b/Cooldowns/DivineBlessOverlay.png similarity index 100% rename from Cooldowns/DivineRechargeOverlay.png rename to Cooldowns/DivineBlessOverlay.png diff --git a/Cooldowns/AbyssalDivingSuitBreakingPlates.png b/Cooldowns/DivingSuitBreakingPlates.png similarity index 100% rename from Cooldowns/AbyssalDivingSuitBreakingPlates.png rename to Cooldowns/DivingSuitBreakingPlates.png diff --git a/Cooldowns/AbyssalDivingSuitBrokenPlates.png b/Cooldowns/DivingSuitBrokenPlates.png similarity index 100% rename from Cooldowns/AbyssalDivingSuitBrokenPlates.png rename to Cooldowns/DivingSuitBrokenPlates.png diff --git a/Cooldowns/AbyssalDivingSuitBrokenPlatesOutline.png b/Cooldowns/DivingSuitBrokenPlatesOutline.png similarity index 100% rename from Cooldowns/AbyssalDivingSuitBrokenPlatesOutline.png rename to Cooldowns/DivingSuitBrokenPlatesOutline.png diff --git a/Cooldowns/AbyssalDivingSuitBrokenPlatesOverlay.png b/Cooldowns/DivingSuitBrokenPlatesOverlay.png similarity index 100% rename from Cooldowns/AbyssalDivingSuitBrokenPlatesOverlay.png rename to Cooldowns/DivingSuitBrokenPlatesOverlay.png diff --git a/Cooldowns/AbyssalDivingSuitCooldowns.cs b/Cooldowns/DivingSuitCooldowns.cs similarity index 56% rename from Cooldowns/AbyssalDivingSuitCooldowns.cs rename to Cooldowns/DivingSuitCooldowns.cs index 3787b44645..23b75977a5 100644 --- a/Cooldowns/AbyssalDivingSuitCooldowns.cs +++ b/Cooldowns/DivingSuitCooldowns.cs @@ -16,22 +16,25 @@ namespace CalamityMod.Cooldowns public DivingPlatesBreaking(CooldownInstance? c) : base(c) { } - public override bool CanTickDown() => !instance.player.Calamity().abyssalDivingSuit; - public override bool ShouldDisplay() => instance.player.Calamity().abyssalDivingSuit; - public override string DisplayName() => "Abyssal Diving Suit Plates Durability"; - public override string Texture => "CalamityMod/Cooldowns/AbyssalDivingSuitBreakingPlates"; - public override string OutlineTexture => "CalamityMod/Cooldowns/AbyssalDivingSuitBrokenPlatesOutline"; - public override string OverlayTexture => "CalamityMod/Cooldowns/AbyssalDivingSuitBrokenPlatesOverlay"; - public override Color GetOutlineColor() + public override bool CanTickDown => !instance.player.Calamity().abyssalDivingSuit; + public override bool ShouldDisplay => instance.player.Calamity().abyssalDivingSuit; + public override string DisplayName => "Abyssal Diving Suit Plates Durability"; + public override string Texture => "CalamityMod/Cooldowns/DivingSuitBreakingPlates"; + public override string OutlineTexture => "CalamityMod/Cooldowns/DivingSuitBrokenPlatesOutline"; + public override string OverlayTexture => "CalamityMod/Cooldowns/DivingSuitBrokenPlatesOverlay"; + public override Color OutlineColor { - if (instance.timeLeft == 0) - return phase0Color; - else if (instance.timeLeft == 1) - return phase1Color; - return phase2Color; + get + { + if (instance.timeLeft == 0) + return phase0Color; + else if (instance.timeLeft == 1) + return phase1Color; + return phase2Color; + } } - public override Color GetCooldownStartColor() => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); - public override Color GetCooldownEndColor() => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); public override bool UseCustomCompactDraw => true; @@ -39,32 +42,29 @@ namespace CalamityMod.Cooldowns { Texture2D sprite = GetTexture(Texture); Texture2D outline = GetTexture(OutlineTexture); - Color outlineColor = GetOutlineColor(); - Color startColor = GetCooldownStartColor(); //Draw the outline - spriteBatch.Draw(outline, position, null, outlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); //Draw the icon spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); - DrawBorderStringEightWay(spriteBatch, Main.fontMouseText, (3 - instance.timeLeft).ToString(), position + new Vector2(-3, -3) * scale, startColor, Color.Black, scale); + DrawBorderStringEightWay(spriteBatch, Main.fontMouseText, (3 - instance.timeLeft).ToString(), position + new Vector2(-3, -3) * scale, CooldownStartColor, Color.Black, scale); } } public class DivingPlatesBroken : CooldownHandler { - private static Color outlineColor = new Color(194, 173, 146); private static Color ringColorLerpStart = new Color(91, 121, 150); private static Color ringColorLerpEnd = new Color(30, 50, 77); public DivingPlatesBroken(CooldownInstance? c) : base(c) { } - public override bool ShouldDisplay() => true; - public override string DisplayName() => "Abyssal Diving Suit Broken Plates"; - public override string Texture => "CalamityMod/Cooldowns/AbyssalDivingSuitBrokenPlates"; - public override Color GetOutlineColor() => outlineColor; - public override Color GetCooldownStartColor() => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); - public override Color GetCooldownEndColor() => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override bool ShouldDisplay => true; + public override string DisplayName => "Abyssal Diving Suit Broken Plates"; + public override string Texture => "CalamityMod/Cooldowns/DivingSuitBrokenPlates"; + public override Color OutlineColor => new Color(194, 173, 146); + public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); public override void OnCompleted() => instance.player.Calamity().abyssalDivingSuitPlateHits = 0; } diff --git a/Cooldowns/DraconicElixirCooldown.cs b/Cooldowns/DraconicElixir.cs similarity index 63% rename from Cooldowns/DraconicElixirCooldown.cs rename to Cooldowns/DraconicElixir.cs index 604e706b9b..00033f7616 100644 --- a/Cooldowns/DraconicElixirCooldown.cs +++ b/Cooldowns/DraconicElixir.cs @@ -4,19 +4,15 @@ using Terraria; namespace CalamityMod.Cooldowns { - public class DraconicElixirCooldown : Cooldown + public class DraconicElixir : CooldownHandler { - public override string SyncID => "DraconicElixir"; + public DraconicElixir(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Draconic Surge Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/DraconicElixir"; + public override string Texture => "CalamityMod/Cooldowns/DraconicElixir"; public override Color OutlineColor => Color.Lerp(new Color(141, 199, 90), new Color(221, 187, 106), (float)Math.Sin(Main.GlobalTime) * 0.5f + 0.5f); public override Color CooldownStartColor => new Color(165, 22, 46); public override Color CooldownEndColor => new Color(216, 103, 43); - - - public DraconicElixirCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/EvasionScarfCooldown.cs b/Cooldowns/EvasionScarf.cs similarity index 63% rename from Cooldowns/EvasionScarfCooldown.cs rename to Cooldowns/EvasionScarf.cs index 7a7382c553..cf4af0665b 100644 --- a/Cooldowns/EvasionScarfCooldown.cs +++ b/Cooldowns/EvasionScarf.cs @@ -4,18 +4,16 @@ using Terraria; namespace CalamityMod.Cooldowns { - public class EvasionScarfCooldown : Cooldown + // TODO -- Why do the two scarves not use the same cooldown? They're both called "Scarf Cooldown". + public class EvasionScarf : CooldownHandler { - public override string SyncID => "EvasionScarf"; + public EvasionScarf(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Scarf Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/EvasionScarf"; + public override string Texture => "CalamityMod/Cooldowns/EvasionScarf"; public override Color OutlineColor => Color.Lerp(new Color(255, 194, 150), new Color(255, 160, 150), (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f); public override Color CooldownStartColor => new Color(132, 23, 32); public override Color CooldownEndColor => new Color(164, 52, 45); - - public EvasionScarfCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/FleshTotemCooldown.cs b/Cooldowns/FleshTotem.cs similarity index 76% rename from Cooldowns/FleshTotemCooldown.cs rename to Cooldowns/FleshTotem.cs index dc1ae80492..6ce04220e7 100644 --- a/Cooldowns/FleshTotemCooldown.cs +++ b/Cooldowns/FleshTotem.cs @@ -1,14 +1,12 @@ using Microsoft.Xna.Framework; -using Terraria; namespace CalamityMod.Cooldowns { - public class FleshTotemCooldown : Cooldown + public class FleshTotem : CooldownHandler { - public override string SyncID => "FleshTotem"; public override bool ShouldDisplay => true; public override string DisplayName => "Contact Damage Halving Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/" + skinTexture; + public override string Texture => "CalamityMod/Cooldowns/" + skinTexture; public override Color OutlineColor => outlineColor; public override Color CooldownStartColor => cooldownColorStart; public override Color CooldownEndColor => cooldownColorEnd; @@ -19,13 +17,13 @@ namespace CalamityMod.Cooldowns public Color cooldownColorStart; public Color cooldownColorEnd; - public FleshTotemCooldown(int duration, Player player, string skin = "default") : base(duration, player) + public FleshTotem(CooldownInstance? c, string skin = "") : base(c) { switch (skin) { case "bloodgod": skinTexture = "BloodGodTotem"; - outlineColor = new Color(255, 162, 205); + outlineColor = new Color(255, 162, 205); cooldownColorStart = new Color(193, 205, 255); cooldownColorEnd = new Color(255, 193, 219); break; diff --git a/Cooldowns/GlobalDodgeCooldown.cs b/Cooldowns/GlobalDodge.cs similarity index 82% rename from Cooldowns/GlobalDodgeCooldown.cs rename to Cooldowns/GlobalDodge.cs index c60aed3eba..0d518ba80e 100644 --- a/Cooldowns/GlobalDodgeCooldown.cs +++ b/Cooldowns/GlobalDodge.cs @@ -1,14 +1,12 @@ using Microsoft.Xna.Framework; -using Terraria; namespace CalamityMod.Cooldowns { - public class GlobalDodgeCooldown : Cooldown + public class GlobalDodge : CooldownHandler { - public override string SyncID => "GlobalDodge"; public override bool ShouldDisplay => true; public override string DisplayName => "Dodge Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/" + skinTexture; + public override string Texture => "CalamityMod/Cooldowns/" + skinTexture; public override Color OutlineColor => outlineColor; public override Color CooldownStartColor => cooldownColorStart; public override Color CooldownEndColor => cooldownColorEnd; @@ -19,7 +17,7 @@ namespace CalamityMod.Cooldowns public Color cooldownColorStart; public Color cooldownColorEnd; - public GlobalDodgeCooldown(int duration, Player player, string skin = "default") : base(duration, player) + public GlobalDodge(CooldownInstance? c, string skin = "") : base(c) { switch (skin) { diff --git a/Cooldowns/GodSlayerDash.cs b/Cooldowns/GodSlayerDash.cs new file mode 100644 index 0000000000..f6af83cccb --- /dev/null +++ b/Cooldowns/GodSlayerDash.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class GodSlayerDash : CooldownHandler + { + public GodSlayerDash(CooldownInstance? c) : base(c) { } + + public override bool ShouldDisplay => true; + public override string DisplayName => "God Slayer Dash Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/GodSlayerDash"; + public override Color OutlineColor => Color.Lerp(new Color(173, 66, 203), new Color(252, 109, 202), instance.Completion); + public override Color CooldownStartColor => new Color(252, 109, 202); + public override Color CooldownEndColor => new Color(119, 254, 254); + } +} \ No newline at end of file diff --git a/Cooldowns/GodslayerDashCooldown.cs b/Cooldowns/GodslayerDashCooldown.cs deleted file mode 100644 index 7e019d1159..0000000000 --- a/Cooldowns/GodslayerDashCooldown.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class GodslayerDashCooldown : Cooldown - { - public override string SyncID => "GodslayerDash"; - public override bool ShouldDisplay => true; - public override string DisplayName => "Godslayer Dash Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/GodslayerDash"; - public override Color OutlineColor => Color.Lerp(new Color(173, 66, 203), new Color(252, 109, 202), Completion); - public override Color CooldownStartColor => new Color(252, 109, 202); - public override Color CooldownEndColor => new Color(119, 254, 254); - - - public GodslayerDashCooldown(int duration, Player player) : base(duration, player) - { - } - } -} \ No newline at end of file diff --git a/Cooldowns/InkBomb.cs b/Cooldowns/InkBomb.cs new file mode 100644 index 0000000000..11f85ea565 --- /dev/null +++ b/Cooldowns/InkBomb.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class InkBomb : CooldownHandler + { + public InkBomb(CooldownInstance? c) : base(c) { } + + public override bool ShouldDisplay => true; + public override string DisplayName => "Ink Bomb Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/InkBomb"; + public override Color OutlineColor => new Color(205, 182, 137); + public override Color CooldownStartColor => Color.Lerp(new Color(177, 147, 89), new Color(105, 103, 126), instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(177, 147, 89), new Color(105, 103, 126), instance.Completion); + } +} \ No newline at end of file diff --git a/Cooldowns/InkBombCooldown.cs b/Cooldowns/InkBombCooldown.cs deleted file mode 100644 index bc74ca39c3..0000000000 --- a/Cooldowns/InkBombCooldown.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class InkBombCooldown : Cooldown - { - public override string SyncID => "InkBomb"; - public override bool ShouldDisplay => true; - public override string DisplayName => "Ink Bomb Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/InkBomb"; - public override Color OutlineColor => new Color(205, 182, 137); - public override Color CooldownStartColor => Color.Lerp(new Color(177, 147, 89), new Color(105, 103, 126), Completion); - public override Color CooldownEndColor => Color.Lerp(new Color(177, 147, 89), new Color(105, 103, 126), Completion); - - - public InkBombCooldown(int duration, Player player) : base(duration, player) - { - } - } -} \ No newline at end of file diff --git a/Cooldowns/LionsHeartShieldCooldown.cs b/Cooldowns/LionsHeartShield.cs similarity index 68% rename from Cooldowns/LionsHeartShieldCooldown.cs rename to Cooldowns/LionsHeartShield.cs index 7656e33f15..273192fb67 100644 --- a/Cooldowns/LionsHeartShieldCooldown.cs +++ b/Cooldowns/LionsHeartShield.cs @@ -1,20 +1,16 @@ using Microsoft.Xna.Framework; -using Terraria; namespace CalamityMod.Cooldowns { - public class LionHeartShieldCooldown : Cooldown + public class LionHeartShield : CooldownHandler { - public override string SyncID => "LionHeartShield"; + public LionHeartShield(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Energy Shell Cooldown"; public override string Texture => "CalamityMod/UI/CooldownIndicators/LionHeartShield"; public override Color OutlineColor => new Color(232, 239, 239); public override Color CooldownStartColor => new Color(17, 242, 244); public override Color CooldownEndColor => Color.White; - - public LionHeartShieldCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/NebulousCoreCooldown.cs b/Cooldowns/NebulousCore.cs similarity index 71% rename from Cooldowns/NebulousCoreCooldown.cs rename to Cooldowns/NebulousCore.cs index 17475a5490..19abdfcbf8 100644 --- a/Cooldowns/NebulousCoreCooldown.cs +++ b/Cooldowns/NebulousCore.cs @@ -3,17 +3,15 @@ using Terraria; namespace CalamityMod.Cooldowns { - public class NebulousCoreCooldown : Cooldown + public class NebulousCore : CooldownHandler { + public NebulousCore(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Nebulous Core Cooldown"; public override string Texture => "CalamityMod/UI/CooldownIndicators/NebulousCore"; - public override Color OutlineColor => Color.Lerp(new Color(252, 109, 203), new Color(58, 91, 146), Completion); + public override Color OutlineColor => Color.Lerp(new Color(252, 109, 203), new Color(58, 91, 146), instance.Completion); public override Color CooldownStartColor => new Color(148, 62, 216); public override Color CooldownEndColor => new Color(255, 187, 207); - - public NebulousCoreCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/AbyssalMadnessCooldown.cs b/Cooldowns/OmegaBlue.cs similarity index 58% rename from Cooldowns/AbyssalMadnessCooldown.cs rename to Cooldowns/OmegaBlue.cs index 3a2bec5006..b5bea30c75 100644 --- a/Cooldowns/AbyssalMadnessCooldown.cs +++ b/Cooldowns/OmegaBlue.cs @@ -1,5 +1,4 @@ -using CalamityMod.Cooldowns; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -9,28 +8,25 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Cooldowns { - public class OmegaBlueCooldown : Cooldown + public class OmegaBlue : CooldownHandler { - public override string ID => "OmegaBlue"; - public override bool ShouldDisplay(CooldownInstance instance) => true; - public override string DisplayName(CooldownInstance instance) => instance.timeLeft > 1500 ? "Abyssal Madness" : "Abyssal Madness Cooldown"; - public override string Texture => TimeLeft > 1500 ? "CalamityMod/UI/CooldownIndicators/AbyssalMadnessActive" : "CalamityMod/UI/CooldownIndicators/AbyssalMadness"; - public override string OutlineTexture => "CalamityMod/UI/CooldownIndicators/AbyssalMadnessOutline"; - public override string OverlayTexture => "CalamityMod/UI/CooldownIndicators/AbyssalMadnessOverlay"; - public override Color OutlineColor => TimeLeft > 1500 ? new Color(231, 164, 1) : new Color(72, 135, 205); - public override Color CooldownStartColor => TimeLeft > 1500 ? Color.Lerp(new Color(98, 110, 179), new Color(216, 176, 80), (TimeLeft - 1500) / 300f) : new Color(98, 110, 179); - public override Color CooldownEndColor => TimeLeft > 1500 ? Color.Lerp(new Color(179, 132, 98), new Color(216, 176, 80), (TimeLeft - 1500) / 300f) : new Color(179, 132, 98); - public override LegacySoundStyle EndSound => AfflictedPlayer.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/OmegaBlueRecharge"); + public OmegaBlue(CooldownInstance? c) : base(c) { } - public OmegaBlueCooldown(int duration, Player player) : base(duration, player) - { - } + public override bool ShouldDisplay => true; + public override string DisplayName => instance.timeLeft > 1500 ? "Abyssal Madness" : "Abyssal Madness Cooldown"; + public override string Texture => instance.timeLeft > 1500 ? "CalamityMod/Cooldowns/OmegaBlueActive" : "CalamityMod/Cooldowns/OmegaBlue"; + public override string OutlineTexture => "CalamityMod/Cooldowns/OmegaBlueOutline"; + public override string OverlayTexture => "CalamityMod/Cooldowns/OmegaBlueOverlay"; + public override Color OutlineColor => instance.timeLeft > 1500 ? new Color(231, 164, 1) : new Color(72, 135, 205); + public override Color CooldownStartColor => instance.timeLeft > 1500 ? Color.Lerp(new Color(98, 110, 179), new Color(216, 176, 80), (instance.timeLeft - 1500) / 300f) : new Color(98, 110, 179); + public override Color CooldownEndColor => instance.timeLeft > 1500 ? Color.Lerp(new Color(179, 132, 98), new Color(216, 176, 80), (instance.timeLeft - 1500) / 300f) : new Color(179, 132, 98); + public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/OmegaBlueRecharge"); public override void OnCompleted() { for (int i = 0; i < 66; i++) { - int d = Dust.NewDust(AfflictedPlayer.position, AfflictedPlayer.width, AfflictedPlayer.height, 20, 0, 0, 100, Color.Transparent, 2.6f); + int d = Dust.NewDust(instance.player.position, instance.player.width, instance.player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; @@ -39,7 +35,7 @@ namespace CalamityMod.Cooldowns } //Charge down at first, and then charge back up - private float AdjustedCompletion => TimeLeft > 1500 ? (TimeLeft - 1500) / 300f : 1 - TimeLeft / 1500f; + private float AdjustedCompletion => instance.timeLeft > 1500 ? (instance.timeLeft - 1500) / 300f : 1 - instance.timeLeft / 1500f; public override void ApplyBarShaders(float opacity) { diff --git a/Cooldowns/AbyssalMadness.png b/Cooldowns/OmegaBlue.png similarity index 100% rename from Cooldowns/AbyssalMadness.png rename to Cooldowns/OmegaBlue.png diff --git a/Cooldowns/AbyssalMadnessActive.png b/Cooldowns/OmegaBlueActive.png similarity index 100% rename from Cooldowns/AbyssalMadnessActive.png rename to Cooldowns/OmegaBlueActive.png diff --git a/Cooldowns/AbyssalMadnessOutline.png b/Cooldowns/OmegaBlueOutline.png similarity index 100% rename from Cooldowns/AbyssalMadnessOutline.png rename to Cooldowns/OmegaBlueOutline.png diff --git a/Cooldowns/AbyssalMadnessOverlay.png b/Cooldowns/OmegaBlueOverlay.png similarity index 100% rename from Cooldowns/AbyssalMadnessOverlay.png rename to Cooldowns/OmegaBlueOverlay.png diff --git a/Cooldowns/PermafrostConcoctionCooldown.cs b/Cooldowns/PermafrostConcoction.cs similarity index 57% rename from Cooldowns/PermafrostConcoctionCooldown.cs rename to Cooldowns/PermafrostConcoction.cs index 914c6e8fe3..0f018da43f 100644 --- a/Cooldowns/PermafrostConcoctionCooldown.cs +++ b/Cooldowns/PermafrostConcoction.cs @@ -3,18 +3,15 @@ using Terraria; namespace CalamityMod.Cooldowns { - public class PermafrostConcoctionCooldown : Cooldown + public class PermafrostConcoction : CooldownHandler { - public override string SyncID => "ConcoctionCooldown"; + public PermafrostConcoction(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Permafrost's Concoction Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/PermafrostConcoction"; + public override string Texture => "CalamityMod/Cooldowns/PermafrostConcoction"; public override Color OutlineColor => new Color(0, 218, 255); public override Color CooldownStartColor => new Color(144, 184, 205); public override Color CooldownEndColor => new Color(232, 246, 254); - - public PermafrostConcoctionCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/PlagueBlackoutCooldown.cs b/Cooldowns/PlagueBlackout.cs similarity index 55% rename from Cooldowns/PlagueBlackoutCooldown.cs rename to Cooldowns/PlagueBlackout.cs index 82644e6efd..61a5aef43b 100644 --- a/Cooldowns/PlagueBlackoutCooldown.cs +++ b/Cooldowns/PlagueBlackout.cs @@ -4,27 +4,26 @@ using Terraria.Audio; namespace CalamityMod.Cooldowns { - public class PlagueBlackoutCooldown : Cooldown + public class PlagueBlackout : CooldownHandler { - public override string SyncID => "PlagueBlackout"; - public override bool ShouldDisplay => TimeLeft <= 1500; + public PlagueBlackout(CooldownInstance? c) : base(c) => instance.duration = 1500; + + public override bool ShouldDisplay => instance.timeLeft <= 1500; public override string DisplayName => "Plague Blackout Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/PlagueBlackout"; + public override string Texture => "CalamityMod/Cooldowns/PlagueBlackout"; public override Color OutlineColor => new Color(174, 237, 122); public override Color CooldownStartColor => Color.DarkSlateGray; public override Color CooldownEndColor => Color.DarkSlateGray; - public override LegacySoundStyle EndSound => AfflictedPlayer.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/PlagueReaperRecharge"); - - public PlagueBlackoutCooldown(int duration, Player player) : base(duration, player) - { - Duration = 1500; - } + public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/PlagueReaperRecharge"); public override void OnCompleted() { + Vector2 pos = instance.player.position; + int w = instance.player.width; + int h = instance.player.height; for (int i = 0; i < 66; i++) { - int d = Dust.NewDust(AfflictedPlayer.position, AfflictedPlayer.width, AfflictedPlayer.height, 89, 0, 0, 100, default, 1.5f); + int d = Dust.NewDust(pos, w, h, 89, 0, 0, 100, default, 1.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 6.6f; } diff --git a/Cooldowns/PotionSickness.cs b/Cooldowns/PotionSickness.cs new file mode 100644 index 0000000000..3f1c5891cb --- /dev/null +++ b/Cooldowns/PotionSickness.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class PotionSickness : CooldownHandler + { + public PotionSickness(CooldownInstance? c) : base(c) { } + + public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.potionDelay > 0; + public override string DisplayName => "Healing Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/PotionSickness"; + public override Color OutlineColor => new Color(255, 142, 165); + public override Color CooldownStartColor => Color.Lerp(new Color(208, 234, 255), new Color(231, 3, 54), instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(208, 234, 255), new Color(231, 3, 54), instance.Completion); + } +} \ No newline at end of file diff --git a/Cooldowns/PotionSicknessDisplay.cs b/Cooldowns/PotionSicknessDisplay.cs deleted file mode 100644 index f7e37f934e..0000000000 --- a/Cooldowns/PotionSicknessDisplay.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class PotionSicknessDisplay : Cooldown - { - public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && AfflictedPlayer.potionDelay > 0; - public override string DisplayName => "Healing Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/PotionSickness"; - public override Color OutlineColor => new Color(255, 142, 165); - public override Color CooldownStartColor => Color.Lerp(new Color(208, 234, 255), new Color(231, 3, 54), Completion); - public override Color CooldownEndColor => Color.Lerp(new Color(208, 234, 255), new Color(231, 3, 54), Completion); - - - public PotionSicknessDisplay(int duration, Player player) : base(duration, player) - { - } - } -} \ No newline at end of file diff --git a/Cooldowns/PrismaticLaserCooldown.cs b/Cooldowns/PrismaticLaser.cs similarity index 66% rename from Cooldowns/PrismaticLaserCooldown.cs rename to Cooldowns/PrismaticLaser.cs index 2a58488668..2738f192eb 100644 --- a/Cooldowns/PrismaticLaserCooldown.cs +++ b/Cooldowns/PrismaticLaser.cs @@ -4,20 +4,17 @@ using static CalamityMod.CalamityUtils; namespace CalamityMod.Cooldowns { - public class PrismaticLaserCooldown : Cooldown + public class PrismaticLaser : CooldownHandler { - public override string SyncID => "PrismaticLaser"; + public PrismaticLaser(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Prismatic Laser Barrage Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/PrismaticLaser"; + public override string Texture => "CalamityMod/Cooldowns/PrismaticLaser"; public override Color OutlineColor => rainbowMode; public override Color CooldownStartColor => rainbowMode; public override Color CooldownEndColor => rainbowMode; internal Color rainbowMode => MulticolorLerp(Main.GlobalTime * 0.3f % 1, new Color[] { new Color(103, 244, 251), new Color(255, 167, 236), new Color(255, 225, 136) }); - - public PrismaticLaserCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/ProfanedSoulArtifact.cs b/Cooldowns/ProfanedSoulArtifact.cs new file mode 100644 index 0000000000..7a06252a01 --- /dev/null +++ b/Cooldowns/ProfanedSoulArtifact.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class ProfanedSoulArtifact : CooldownHandler + { + public ProfanedSoulArtifact(CooldownInstance? c) : base(c) { } + + public override bool ShouldDisplay => true; + public override string DisplayName => "Profaned Soul Artifact Burnout"; + public override string Texture => "CalamityMod/Cooldowns/ProfanedSoulArtifact"; + public override Color OutlineColor => new Color(255, 191, 73); + public override Color CooldownStartColor => new Color(181, 136, 177); + public override Color CooldownEndColor => new Color(255, 194, 161); + } +} \ No newline at end of file diff --git a/Cooldowns/ProfanedSoulArtifactCooldown.cs b/Cooldowns/ProfanedSoulArtifactCooldown.cs deleted file mode 100644 index cfce5d5606..0000000000 --- a/Cooldowns/ProfanedSoulArtifactCooldown.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class ProfanedSoulArtifactCooldown : Cooldown - { - public override string SyncID => "PSABurnout"; - public override bool ShouldDisplay => true; - public override string DisplayName => "Soul Artifact Burn Out"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/ProfanedSoulArtifact"; - public override Color OutlineColor => new Color(255, 191, 73); - public override Color CooldownStartColor => new Color(181, 136, 177); - public override Color CooldownEndColor => new Color(255, 194, 161); - - public ProfanedSoulArtifactCooldown(int duration, Player player) : base(duration, player) - { - } - } -} \ No newline at end of file diff --git a/Cooldowns/RelicOfResilienceCooldown.cs b/Cooldowns/RelicOfResilience.cs similarity index 57% rename from Cooldowns/RelicOfResilienceCooldown.cs rename to Cooldowns/RelicOfResilience.cs index 7b64b0339a..bc45a92780 100644 --- a/Cooldowns/RelicOfResilienceCooldown.cs +++ b/Cooldowns/RelicOfResilience.cs @@ -3,18 +3,15 @@ using Terraria; namespace CalamityMod.Cooldowns { - public class RelicOfResilienceCooldown : Cooldown + public class RelicOfResilience : CooldownHandler { - public override string SyncID => "RelicOfResilience"; + public RelicOfResilience(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Relic of Resilience Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/RelicOfResilience"; + public override string Texture => "CalamityMod/Cooldowns/RelicOfResilience"; public override Color OutlineColor => new Color(255, 191, 73); public override Color CooldownStartColor => new Color(122, 66, 59); public override Color CooldownEndColor => new Color(165, 103, 87); - - public RelicOfResilienceCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/JetpackCooldown.cs b/Cooldowns/RogueBooster.cs similarity index 70% rename from Cooldowns/JetpackCooldown.cs rename to Cooldowns/RogueBooster.cs index fc4a2c441f..fd0c3e5602 100644 --- a/Cooldowns/JetpackCooldown.cs +++ b/Cooldowns/RogueBooster.cs @@ -1,17 +1,15 @@ -using CalamityMod.Cooldowns; -using Microsoft.Xna.Framework; -using Terraria; +using Microsoft.Xna.Framework; namespace CalamityMod.Cooldowns { - public class JetpackCooldown : Cooldown + public class RogueBooster : CooldownHandler { public override bool ShouldDisplay => true; - public override string DisplayName => "Jet Boost Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/" + skinTexture; + public override string DisplayName => "Rogue Booster Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/" + skinTexture; public override Color OutlineColor => outlineColor; - public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion); - public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion); + public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); //It's the same cooldown with different skins each time, basically. public string skinTexture; @@ -19,7 +17,7 @@ namespace CalamityMod.Cooldowns public Color cooldownColorStart; public Color cooldownColorEnd; - public JetpackCooldown(int duration, Player player, string skin = "default") : base(duration, player) + public RogueBooster(CooldownInstance? c, string skin = "") : base(c) { switch (skin) { diff --git a/Cooldowns/SandCloakCooldown.cs b/Cooldowns/SandCloak.cs similarity index 62% rename from Cooldowns/SandCloakCooldown.cs rename to Cooldowns/SandCloak.cs index 8f9937c345..5610152875 100644 --- a/Cooldowns/SandCloakCooldown.cs +++ b/Cooldowns/SandCloak.cs @@ -1,20 +1,16 @@ using Microsoft.Xna.Framework; -using Terraria; namespace CalamityMod.Cooldowns { - public class SandCloakCooldown : Cooldown + public class SandCloak : CooldownHandler { + public SandCloak(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Sand Cloak Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/SandCloak"; + public override string Texture => "CalamityMod/Cooldowns/SandCloak"; public override Color OutlineColor => new Color(209, 176, 114); public override Color CooldownStartColor => new Color(100, 64, 44); public override Color CooldownEndColor => new Color(132, 95, 54); - - - public SandCloakCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/SilvaReviveCooldown.cs b/Cooldowns/SilvaRevive.cs similarity index 68% rename from Cooldowns/SilvaReviveCooldown.cs rename to Cooldowns/SilvaRevive.cs index 60b299e5fe..789f5b3dae 100644 --- a/Cooldowns/SilvaReviveCooldown.cs +++ b/Cooldowns/SilvaRevive.cs @@ -1,22 +1,19 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using Terraria; namespace CalamityMod.Cooldowns { - public class SilvaReviveCooldown : Cooldown + public class SilvaRevive : CooldownHandler { + public SilvaRevive(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Silva Revive Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/SilvaRevive"; + public override string Texture => "CalamityMod/Cooldowns/SilvaRevive"; public override Color OutlineColor => new Color(151, 211, 152); public override Color CooldownStartColor => new Color(226, 188, 74); public override Color CooldownEndColor => new Color(151, 211, 152); public override bool CanTickDown => !CalamityPlayer.areThereAnyDamnBosses && !CalamityPlayer.areThereAnyDamnEvents; - - public SilvaReviveCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file diff --git a/Cooldowns/TarragonCloak.cs b/Cooldowns/TarragonCloak.cs new file mode 100644 index 0000000000..4811a969d2 --- /dev/null +++ b/Cooldowns/TarragonCloak.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class TarragonCloak : CooldownHandler + { + public TarragonCloak(CooldownInstance? c) : base(c) { } + + public override bool ShouldDisplay => true; + public override string DisplayName => "Tarragon Cloak Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/TarragonCloak"; + public override Color OutlineColor => new Color(158, 204, 173); + public override Color CooldownStartColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - instance.Completion); + } +} \ No newline at end of file diff --git a/Cooldowns/TarragonCloakCooldown.cs b/Cooldowns/TarragonCloakCooldown.cs deleted file mode 100644 index df04565aa2..0000000000 --- a/Cooldowns/TarragonCloakCooldown.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class TarragonCloakCooldown : Cooldown - { - public override string SyncID => "TarraCloak"; - public override bool ShouldDisplay => true; - public override string DisplayName => "Tarragon Cloak Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/TarragonCloak"; - public override Color OutlineColor => new Color(158, 204, 173); - public override Color CooldownStartColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - Completion); - public override Color CooldownEndColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - Completion); - - public TarragonCloakCooldown(int duration, Player player) : base(duration, player) - { - } - } -} \ No newline at end of file diff --git a/Cooldowns/TarragonImmunity.cs b/Cooldowns/TarragonImmunity.cs new file mode 100644 index 0000000000..235b07136c --- /dev/null +++ b/Cooldowns/TarragonImmunity.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class TarragonImmunity : CooldownHandler + { + public TarragonImmunity(CooldownInstance? c) : base(c) { } + + public override bool ShouldDisplay => true; + public override string DisplayName => "Tarragon Immunity Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/TarragonImmunity"; + public override Color OutlineColor => new Color(215, 182, 82); + public override Color CooldownStartColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - instance.Completion); + } +} \ No newline at end of file diff --git a/Cooldowns/TarragonImmunityCooldown.cs b/Cooldowns/TarragonImmunityCooldown.cs deleted file mode 100644 index f30b8b1837..0000000000 --- a/Cooldowns/TarragonImmunityCooldown.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class TarragonImmunityCooldown : Cooldown - { - public override string SyncID => "TarraImmune"; - public override bool ShouldDisplay => true; - public override string DisplayName => "Tarragon Immunity Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/TarragonImmunity"; - public override Color OutlineColor => new Color(215, 182, 82); - public override Color CooldownStartColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - Completion); - public override Color CooldownEndColor => Color.Lerp(new Color(171, 106, 49), new Color(215, 182, 82), 1 - Completion); - - public TarragonImmunityCooldown(int duration, Player player) : base(duration, player) - { - } - } -} \ No newline at end of file diff --git a/Cooldowns/UniverseSplitterCooldown.cs b/Cooldowns/UniverseSplitter.cs similarity index 70% rename from Cooldowns/UniverseSplitterCooldown.cs rename to Cooldowns/UniverseSplitter.cs index 7245016a77..86f65a4f52 100644 --- a/Cooldowns/UniverseSplitterCooldown.cs +++ b/Cooldowns/UniverseSplitter.cs @@ -4,19 +4,17 @@ using static CalamityMod.CalamityUtils; namespace CalamityMod.Cooldowns { - public class UniverseSplitterCooldown : Cooldown + public class UniverseSplitter : CooldownHandler { + public UniverseSplitter(CooldownInstance? c) : base(c) { } + public override bool ShouldDisplay => true; public override string DisplayName => "Universe Splitter Cooldown"; - public override string Texture => "CalamityMod/UI/CooldownIndicators/UniverseSplitter"; + public override string Texture => "CalamityMod/Cooldowns/UniverseSplitter"; public override Color OutlineColor => rainbowMode; public override Color CooldownStartColor => rainbowMode; public override Color CooldownEndColor => rainbowMode; internal Color rainbowMode => MulticolorLerp(Main.GlobalTime * 0.3f % 1, new Color[] { new Color(236, 202, 255), new Color(192, 245, 255), new Color(255, 194, 205) }); - - public UniverseSplitterCooldown(int duration, Player player) : base(duration, player) - { - } } } \ No newline at end of file