diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs
index c9cb6b7a34..e672e27076 100644
--- a/CalPlayer/CalamityPlayer.cs
+++ b/CalPlayer/CalamityPlayer.cs
@@ -3866,7 +3866,6 @@ namespace CalamityMod.CalPlayer
Cooldown durability = Cooldowns.Find(cooldown => cooldown.GetType() == typeof(DivingPlatesBreaking));
durability.TimeLeft = abyssalDivingSuitPlateHits;
}
-
}
}
@@ -5573,9 +5572,6 @@ namespace CalamityMod.CalPlayer
projTypeJustHitBy = proj.type;
Cooldowns.Add(new GlobalDodge(EvolutionReflectCooldown, player));
- // Send a Calamity dodge cooldown packet.
- if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
- SyncCooldown(false);
return;
}
}
diff --git a/CalPlayer/CalamityPlayerNetcode.cs b/CalPlayer/CalamityPlayerNetcode.cs
index c782626d50..514cf2391c 100644
--- a/CalPlayer/CalamityPlayerNetcode.cs
+++ b/CalPlayer/CalamityPlayerNetcode.cs
@@ -7,7 +7,7 @@ using Terraria.ModLoader;
namespace CalamityMod.CalPlayer
{
- public partial class CalamityPlayer : ModPlayer
+ public partial class CalamityPlayer : ModPlayer
{
#region Standard Syncs
internal const int GlobalSyncPacketTimer = 15;
@@ -18,7 +18,6 @@ namespace CalamityMod.CalPlayer
SyncAdrenaline(false);
SyncMoveSpeed(false);
SyncDefenseDamage(false);
- SyncCooldown(false);
}
private void EnterWorldSync()
@@ -151,40 +150,6 @@ namespace CalamityMod.CalPlayer
player.SendPacket(packet, server);
}
- internal void SyncCooldown(bool server, string cooldownID = "")
- {
- //If no specific sync id is provided, sync all of the player's cooldowns. Ideally this doesn't happen though. Ideally. Do we even need it frankly? Like i guess we could call it on death but idk if it needs to be synced every frames since its
- //Already being synced when it gets created and then when it expires
- if (cooldownID == "")
- {
- foreach (string key in Cooldown.IDtoType.Keys)
- {
- ModPacket packet = mod.GetPacket();
- packet.Write((byte)CalamityModMessageType.CooldownSync);
- packet.Write(player.whoAmI);
- packet.Write(key);
- int timer = 0;
- if (Cooldowns.Exists(cooldown => cooldown.GetType() == Cooldown.IDtoType[key]))
- timer = Cooldowns.Find(cooldown => cooldown.GetType() == Cooldown.IDtoType[key]).TimeLeft;
- packet.Write(timer);
- player.SendPacket(packet, server);
- }
- }
-
- else
- {
- ModPacket packet = mod.GetPacket();
- packet.Write((byte)CalamityModMessageType.CooldownSync);
- packet.Write(player.whoAmI);
- packet.Write(cooldownID);
- int timer = 0;
- if (Cooldowns.Exists(cooldown => cooldown.GetType() == Cooldown.IDtoType[cooldownID]))
- timer = Cooldowns.Find(cooldown => cooldown.GetType() == Cooldown.IDtoType[cooldownID]).TimeLeft;
- packet.Write(timer);
- player.SendPacket(packet, server);
- }
- }
-
private void SyncDeathCount(bool server)
{
ModPacket packet = mod.GetPacket(256);
@@ -334,24 +299,6 @@ namespace CalamityMod.CalPlayer
SyncDefenseDamage(true);
}
- internal void HandleCooldowns(BinaryReader reader)
- {
- string syncID = reader.ReadString();
- int timer = reader.ReadInt32();
- Type cooldownType = Cooldown.IDtoType[syncID];
-
- // If this cooldown is present, edit the existing cooldown's timer.
- if (Cooldowns.Exists(cooldown => cooldown.GetType() == cooldownType))
- Cooldowns.Find(cooldown => cooldown.GetType() == cooldownType).TimeLeft = timer;
-
- // Otherwise create a new cooldown with this timer.
- else if (timer > 0)
- Cooldowns.Add((Cooldown)Activator.CreateInstance(cooldownType, timer, player));
-
- if (Main.netMode == NetmodeID.Server)
- SyncCooldown(true);
- }
-
internal void HandleRightClick(BinaryReader reader)
{
mouseRight = reader.ReadBoolean();
diff --git a/CalamityMod.cs b/CalamityMod.cs
index 82a106367e..3e8a572969 100644
--- a/CalamityMod.cs
+++ b/CalamityMod.cs
@@ -15,7 +15,6 @@ using CalamityMod.Items.Dyes.HairDye;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Localization;
using CalamityMod.NPCs;
-using CalamityMod.NPCs.Abyss;
using CalamityMod.NPCs.AdultEidolonWyrm;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
@@ -53,7 +52,6 @@ using CalamityMod.Skies;
using CalamityMod.TileEntities;
using CalamityMod.UI;
using CalamityMod.UI.CalamitasEnchants;
-using CalamityMod.UI.CooldownIndicators;
using CalamityMod.Waters;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -75,7 +73,7 @@ using Terraria.UI;
namespace CalamityMod
{
- public class CalamityMod : Mod
+ public class CalamityMod : Mod
{
// CONSIDER -- I have been advised by Jopo that Mods should never contain static variables
// TODO -- 1.4 fixes the crit reforge price calculation bug, so GetWeaponCrit everywhere can go.
diff --git a/Cooldowns/AquaticHeartIceShield.cs b/Cooldowns/AquaticHeartIceShield.cs
index 7e5a8ac71e..4a7a5e3592 100644
--- a/Cooldowns/AquaticHeartIceShield.cs
+++ b/Cooldowns/AquaticHeartIceShield.cs
@@ -6,6 +6,7 @@ namespace CalamityMod.Cooldowns
{
public class AquaticHeartIceShield : CooldownHandler
{
+ public static string ID => "AquaticHeartIceShield";
public AquaticHeartIceShield(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/BloodflareFrenzy.cs b/Cooldowns/BloodflareFrenzy.cs
index c2f091d7db..9efd7ff0ab 100644
--- a/Cooldowns/BloodflareFrenzy.cs
+++ b/Cooldowns/BloodflareFrenzy.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class BloodflareFrenzy : CooldownHandler
{
+ public static string ID => "BloodflareFrenzy";
public BloodflareFrenzy(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/BloodflareRangedSet.cs b/Cooldowns/BloodflareRangedSet.cs
index 4cc9645add..431be3031c 100644
--- a/Cooldowns/BloodflareRangedSet.cs
+++ b/Cooldowns/BloodflareRangedSet.cs
@@ -5,6 +5,7 @@ namespace CalamityMod.Cooldowns
{
public class BloodflareRangedSet : CooldownHandler
{
+ public static string ID => "BloodflareRangedSet";
public BloodflareRangedSet(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/BrimflameFrenzy.cs b/Cooldowns/BrimflameFrenzy.cs
index c2951c3b13..6b411c6be6 100644
--- a/Cooldowns/BrimflameFrenzy.cs
+++ b/Cooldowns/BrimflameFrenzy.cs
@@ -8,6 +8,7 @@ namespace CalamityMod.Cooldowns
{
public class BrimflameFrenzy : CooldownHandler
{
+ public static string ID => "BrimflameFrenzy";
public BrimflameFrenzy(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/ChaosState.cs b/Cooldowns/ChaosState.cs
index 0a4698ceff..b74748d67f 100644
--- a/Cooldowns/ChaosState.cs
+++ b/Cooldowns/ChaosState.cs
@@ -4,6 +4,8 @@ namespace CalamityMod.Cooldowns
{
public class ChaosState : CooldownHandler
{
+ public static string ID => "ChaosState";
+
public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.chaosState;
public override string DisplayName => "Teleportation Cooldown";
public override string Texture => "CalamityMod/Cooldowns/ChaosState" + skinTexture;
diff --git a/Cooldowns/Cooldown.cs b/Cooldowns/Cooldown.cs
index 240bb45545..821eb95ca9 100644
--- a/Cooldowns/Cooldown.cs
+++ b/Cooldowns/Cooldown.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace CalamityMod.Cooldowns
{
@@ -47,37 +46,38 @@ namespace CalamityMod.Cooldowns
// 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));
+ Cooldown potionSickness = Register(PotionSickness.ID, new PotionSickness(null));
+ Cooldown chaosState = Register(ChaosState.ID, new ChaosState(null));
+ Cooldown globalDodge = Register(GlobalDodge.ID, 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));
+ Cooldown aquaticHeartIceShield = Register(AquaticHeartIceShield.ID, new AquaticHeartIceShield(null));
+ Cooldown bloodflareFrenzy = Register(BloodflareFrenzy.ID, new BloodflareFrenzy(null));
+ Cooldown bloodflareRanged = Register(BloodflareRangedSet.ID, new BloodflareRangedSet(null));
+ Cooldown brimflameFrenzy = Register(BrimflameFrenzy.ID, new BrimflameFrenzy(null));
+ Cooldown counterScarf = Register(CounterScarf.ID, new CounterScarf(null));
+ Cooldown divineBless = Register(DivineBless.ID, new DivineBless(null));
+ Cooldown divingPlatesBreaking = Register(DivingPlatesBreaking.ID, new DivingPlatesBreaking(null));
+ Cooldown divingPlatesBroken = Register(DivingPlatesBroken.ID, new DivingPlatesBroken(null));
+ Cooldown draconicElixir = Register(DraconicElixir.ID, new DraconicElixir(null));
+ Cooldown evasionScarf = Register(EvasionScarf.ID, new EvasionScarf(null));
+ Cooldown fleshTotem = Register(FleshTotem.ID, new FleshTotem(null));
+ Cooldown godSlayerDash = Register(GodSlayerDash.ID, new GodSlayerDash(null));
+ Cooldown inkBomb = Register(InkBomb.ID, new InkBomb(null));
+ Cooldown lionHeartShield = Register(LionHeartShield.ID, new LionHeartShield(null));
+ Cooldown nebulousCore = Register(NebulousCore.ID, new NebulousCore(null));
+ Cooldown omegaBlue = Register(OmegaBlue.ID, new OmegaBlue(null));
+ Cooldown permafrostConcoction = Register(PermafrostConcoction.ID, new PermafrostConcoction(null));
+ Cooldown plagueBlackout = Register(PlagueBlackout.ID, new PlagueBlackout(null));
+ Cooldown prismaticLaser = Register(PrismaticLaser.ID, new PrismaticLaser(null));
+ Cooldown profanedSoulArtifact = Register(ProfanedSoulArtifact.ID, new ProfanedSoulArtifact(null));
+ Cooldown relicOfResilience = Register(RelicOfResilience.ID, new RelicOfResilience(null));
+ Cooldown rogueBooster = Register(RogueBooster.ID, new RogueBooster(null));
+ Cooldown sandCloak = Register(SandCloak.ID, new SandCloak(null));
+ Cooldown silvaRevive = Register(SilvaRevive.ID, new SilvaRevive(null));
+ Cooldown tarragonCloak = Register(TarragonCloak.ID, new TarragonCloak(null));
+ Cooldown tarragonImmunity = Register(TarragonImmunity.ID, new TarragonImmunity(null));
+ Cooldown universeSplitter = Register(UniverseSplitter.ID, new UniverseSplitter(null));
}
public static void Unload()
diff --git a/Cooldowns/CooldownHandler.cs b/Cooldowns/CooldownHandler.cs
index 17f8ffd109..b5dab7814a 100644
--- a/Cooldowns/CooldownHandler.cs
+++ b/Cooldowns/CooldownHandler.cs
@@ -10,6 +10,7 @@ namespace CalamityMod.Cooldowns
{
public class CooldownHandler
{
+ public static string ID => null;
public CooldownInstance instance;
public CooldownHandler(CooldownInstance? c)
diff --git a/Cooldowns/CounterScarf.cs b/Cooldowns/CounterScarf.cs
index e28b535d64..29ad955b4d 100644
--- a/Cooldowns/CounterScarf.cs
+++ b/Cooldowns/CounterScarf.cs
@@ -6,6 +6,7 @@ namespace CalamityMod.Cooldowns
{
public class CounterScarf : CooldownHandler
{
+ public static string ID => "CounterScarf";
public CounterScarf(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/DivineBless.cs b/Cooldowns/DivineBless.cs
index bcd0e073a7..b20c1d99db 100644
--- a/Cooldowns/DivineBless.cs
+++ b/Cooldowns/DivineBless.cs
@@ -7,6 +7,7 @@ namespace CalamityMod.Cooldowns
{
public class DivineBless : CooldownHandler
{
+ public static string ID => "DivineBless";
public DivineBless(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/DivingSuitCooldowns.cs b/Cooldowns/DivingSuitCooldowns.cs
index 23b75977a5..2d57c9ae8f 100644
--- a/Cooldowns/DivingSuitCooldowns.cs
+++ b/Cooldowns/DivingSuitCooldowns.cs
@@ -14,6 +14,7 @@ namespace CalamityMod.Cooldowns
private static Color ringColorLerpStart = new Color(160, 174, 174);
private static Color ringColorLerpEnd = new Color(192, 11, 107);
+ public static string ID => "DivingPlatesBreaking";
public DivingPlatesBreaking(CooldownInstance? c) : base(c) { }
public override bool CanTickDown => !instance.player.Calamity().abyssalDivingSuit;
@@ -57,6 +58,7 @@ namespace CalamityMod.Cooldowns
private static Color ringColorLerpStart = new Color(91, 121, 150);
private static Color ringColorLerpEnd = new Color(30, 50, 77);
+ public static string ID => "DivingPlatesBroken";
public DivingPlatesBroken(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/DraconicElixir.cs b/Cooldowns/DraconicElixir.cs
index 00033f7616..c9db629503 100644
--- a/Cooldowns/DraconicElixir.cs
+++ b/Cooldowns/DraconicElixir.cs
@@ -6,6 +6,7 @@ namespace CalamityMod.Cooldowns
{
public class DraconicElixir : CooldownHandler
{
+ public static string ID => "DraconicElixir";
public DraconicElixir(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/EvasionScarf.cs b/Cooldowns/EvasionScarf.cs
index cf4af0665b..4d4430e5c8 100644
--- a/Cooldowns/EvasionScarf.cs
+++ b/Cooldowns/EvasionScarf.cs
@@ -7,6 +7,7 @@ namespace CalamityMod.Cooldowns
// TODO -- Why do the two scarves not use the same cooldown? They're both called "Scarf Cooldown".
public class EvasionScarf : CooldownHandler
{
+ public static string ID => "EvasionScarf";
public EvasionScarf(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/FleshTotem.cs b/Cooldowns/FleshTotem.cs
index 6ce04220e7..f2c6ec3240 100644
--- a/Cooldowns/FleshTotem.cs
+++ b/Cooldowns/FleshTotem.cs
@@ -4,6 +4,8 @@ namespace CalamityMod.Cooldowns
{
public class FleshTotem : CooldownHandler
{
+ public static string ID => "FleshTotem";
+
public override bool ShouldDisplay => true;
public override string DisplayName => "Contact Damage Halving Cooldown";
public override string Texture => "CalamityMod/Cooldowns/" + skinTexture;
diff --git a/Cooldowns/GlobalDodge.cs b/Cooldowns/GlobalDodge.cs
index 0d518ba80e..f669da3fd4 100644
--- a/Cooldowns/GlobalDodge.cs
+++ b/Cooldowns/GlobalDodge.cs
@@ -4,6 +4,8 @@ namespace CalamityMod.Cooldowns
{
public class GlobalDodge : CooldownHandler
{
+ public static string ID => "GlobalDodge";
+
public override bool ShouldDisplay => true;
public override string DisplayName => "Dodge Cooldown";
public override string Texture => "CalamityMod/Cooldowns/" + skinTexture;
diff --git a/Cooldowns/GodSlayerDash.cs b/Cooldowns/GodSlayerDash.cs
index f6af83cccb..82d8b089a7 100644
--- a/Cooldowns/GodSlayerDash.cs
+++ b/Cooldowns/GodSlayerDash.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class GodSlayerDash : CooldownHandler
{
+ public static string ID => "GodSlayerDash";
public GodSlayerDash(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/InkBomb.cs b/Cooldowns/InkBomb.cs
index 11f85ea565..833705e5fa 100644
--- a/Cooldowns/InkBomb.cs
+++ b/Cooldowns/InkBomb.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class InkBomb : CooldownHandler
{
+ public static string ID => "InkBomb";
public InkBomb(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/LionsHeartShield.cs b/Cooldowns/LionsHeartShield.cs
index 273192fb67..16f054c1eb 100644
--- a/Cooldowns/LionsHeartShield.cs
+++ b/Cooldowns/LionsHeartShield.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class LionHeartShield : CooldownHandler
{
+ public static string ID => "LionHeartShield";
public LionHeartShield(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/NebulousCore.cs b/Cooldowns/NebulousCore.cs
index 19abdfcbf8..2a5c92f1a7 100644
--- a/Cooldowns/NebulousCore.cs
+++ b/Cooldowns/NebulousCore.cs
@@ -5,6 +5,7 @@ namespace CalamityMod.Cooldowns
{
public class NebulousCore : CooldownHandler
{
+ public static string ID => "NebulousCore";
public NebulousCore(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/OmegaBlue.cs b/Cooldowns/OmegaBlue.cs
index b5bea30c75..a7effe4ce2 100644
--- a/Cooldowns/OmegaBlue.cs
+++ b/Cooldowns/OmegaBlue.cs
@@ -10,6 +10,7 @@ namespace CalamityMod.Cooldowns
{
public class OmegaBlue : CooldownHandler
{
+ public static string ID => "OmegaBlue";
public OmegaBlue(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/PermafrostConcoction.cs b/Cooldowns/PermafrostConcoction.cs
index 0f018da43f..eb47ac5759 100644
--- a/Cooldowns/PermafrostConcoction.cs
+++ b/Cooldowns/PermafrostConcoction.cs
@@ -5,6 +5,7 @@ namespace CalamityMod.Cooldowns
{
public class PermafrostConcoction : CooldownHandler
{
+ public static string ID => "PermafrostConcoction";
public PermafrostConcoction(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/PlagueBlackout.cs b/Cooldowns/PlagueBlackout.cs
index 61a5aef43b..8d71a890a1 100644
--- a/Cooldowns/PlagueBlackout.cs
+++ b/Cooldowns/PlagueBlackout.cs
@@ -6,6 +6,7 @@ namespace CalamityMod.Cooldowns
{
public class PlagueBlackout : CooldownHandler
{
+ public static string ID => "PlagueBlackout";
public PlagueBlackout(CooldownInstance? c) : base(c) => instance.duration = 1500;
public override bool ShouldDisplay => instance.timeLeft <= 1500;
diff --git a/Cooldowns/PotionSickness.cs b/Cooldowns/PotionSickness.cs
index 3f1c5891cb..5190a4633e 100644
--- a/Cooldowns/PotionSickness.cs
+++ b/Cooldowns/PotionSickness.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class PotionSickness : CooldownHandler
{
+ public static string ID => "PotionSickness";
public PotionSickness(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.potionDelay > 0;
diff --git a/Cooldowns/PrismaticLaser.cs b/Cooldowns/PrismaticLaser.cs
index 2738f192eb..bed1daaab5 100644
--- a/Cooldowns/PrismaticLaser.cs
+++ b/Cooldowns/PrismaticLaser.cs
@@ -6,6 +6,7 @@ namespace CalamityMod.Cooldowns
{
public class PrismaticLaser : CooldownHandler
{
+ public static string ID => "PrismaticLaser";
public PrismaticLaser(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/ProfanedSoulArtifact.cs b/Cooldowns/ProfanedSoulArtifact.cs
index 7a06252a01..3ef6972b77 100644
--- a/Cooldowns/ProfanedSoulArtifact.cs
+++ b/Cooldowns/ProfanedSoulArtifact.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class ProfanedSoulArtifact : CooldownHandler
{
+ public static string ID => "ProfanedSoulArtifact";
public ProfanedSoulArtifact(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/RelicOfResilience.cs b/Cooldowns/RelicOfResilience.cs
index bc45a92780..5bfbd1db53 100644
--- a/Cooldowns/RelicOfResilience.cs
+++ b/Cooldowns/RelicOfResilience.cs
@@ -5,6 +5,7 @@ namespace CalamityMod.Cooldowns
{
public class RelicOfResilience : CooldownHandler
{
+ public static string ID => "RelicOfResilience";
public RelicOfResilience(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/RogueBooster.cs b/Cooldowns/RogueBooster.cs
index fd0c3e5602..ea69201994 100644
--- a/Cooldowns/RogueBooster.cs
+++ b/Cooldowns/RogueBooster.cs
@@ -4,6 +4,8 @@ namespace CalamityMod.Cooldowns
{
public class RogueBooster : CooldownHandler
{
+ public static string ID => "RogueBooster";
+
public override bool ShouldDisplay => true;
public override string DisplayName => "Rogue Booster Cooldown";
public override string Texture => "CalamityMod/Cooldowns/" + skinTexture;
diff --git a/Cooldowns/SandCloak.cs b/Cooldowns/SandCloak.cs
index 5610152875..ed5a01b064 100644
--- a/Cooldowns/SandCloak.cs
+++ b/Cooldowns/SandCloak.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class SandCloak : CooldownHandler
{
+ public static string ID => "SandCloak";
public SandCloak(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/SilvaRevive.cs b/Cooldowns/SilvaRevive.cs
index 789f5b3dae..c6a6e54519 100644
--- a/Cooldowns/SilvaRevive.cs
+++ b/Cooldowns/SilvaRevive.cs
@@ -5,6 +5,7 @@ namespace CalamityMod.Cooldowns
{
public class SilvaRevive : CooldownHandler
{
+ public static string ID => "SilvaRevive";
public SilvaRevive(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/TarragonCloak.cs b/Cooldowns/TarragonCloak.cs
index 4811a969d2..94d81467be 100644
--- a/Cooldowns/TarragonCloak.cs
+++ b/Cooldowns/TarragonCloak.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class TarragonCloak : CooldownHandler
{
+ public static string ID => "TarragonCloak";
public TarragonCloak(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/TarragonImmunity.cs b/Cooldowns/TarragonImmunity.cs
index 235b07136c..cbf75111c6 100644
--- a/Cooldowns/TarragonImmunity.cs
+++ b/Cooldowns/TarragonImmunity.cs
@@ -4,6 +4,7 @@ namespace CalamityMod.Cooldowns
{
public class TarragonImmunity : CooldownHandler
{
+ public static string ID => "TarragonImmunity";
public TarragonImmunity(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/Cooldowns/UniverseSplitter.cs b/Cooldowns/UniverseSplitter.cs
index 86f65a4f52..2d906b789f 100644
--- a/Cooldowns/UniverseSplitter.cs
+++ b/Cooldowns/UniverseSplitter.cs
@@ -6,6 +6,7 @@ namespace CalamityMod.Cooldowns
{
public class UniverseSplitter : CooldownHandler
{
+ public static string ID => "UniverseSplitter";
public UniverseSplitter(CooldownInstance? c) : base(c) { }
public override bool ShouldDisplay => true;
diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs
index 4af57a3239..e9fde92a31 100644
--- a/ILEditing/MechanicILChanges.cs
+++ b/ILEditing/MechanicILChanges.cs
@@ -137,9 +137,6 @@ namespace CalamityMod.ILEditing
{
CalamityPlayer calPlayer = p.Calamity();
calPlayer.Cooldowns.Add(new GlobalDodgeCooldown(CalamityPlayer.BeltDodgeCooldown, p));
-
- if (Main.netMode == NetmodeID.MultiplayerClient)
- calPlayer.SyncCooldown(false, "GlobalDodge");
});
}
#endregion Removal of Black Belt Dodge RNG
diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs
index 307ec896f6..4504c165e5 100644
--- a/Utilities/PlayerUtils.cs
+++ b/Utilities/PlayerUtils.cs
@@ -13,6 +13,7 @@ namespace CalamityMod
{
public static partial class CalamityUtils
{
+ #region Damage
// These functions factor in TML 0.11 allDamage to get the player's total damage boost which affects the specified class.
public static float MeleeDamage(this Player player) => player.allDamage + player.meleeDamage - 1f;
public static float RangedDamage(this Player player) => player.allDamage + player.rangedDamage - 1f;
@@ -21,9 +22,12 @@ namespace CalamityMod
public static float ThrownDamage(this Player player) => player.allDamage + player.thrownDamage - 1f;
public static float RogueDamage(this Player player) => player.allDamage + player.thrownDamage + player.Calamity().throwingDamage - 2f;
public static float AverageDamage(this Player player) => player.allDamage + (player.meleeDamage + player.rangedDamage + player.magicDamage + player.minionDamage + player.Calamity().throwingDamage - 5f) / 5f;
+ #endregion
- public static bool IsUnderwater(this Player player) => Collision.DrownCollision(player.position, player.width, player.height, player.gravDir);
public static bool StandingStill(this Player player, float velocity = 0.05f) => player.velocity.Length() < velocity;
+
+ #region Location & Biomes
+ public static bool IsUnderwater(this Player player) => Collision.DrownCollision(player.position, player.width, player.height, player.gravDir);
public static bool InSpace(this Player player)
{
float x = Main.maxTilesX / 4200f;
@@ -72,6 +76,8 @@ namespace CalamityMod
return player.Calamity().ZoneAbyss;
}
}
+ #endregion
+
public static bool InventoryHas(this Player player, params int[] items)
{
return player.inventory.Any(item => items.Contains(item.type));
@@ -88,6 +94,7 @@ namespace CalamityMod
return hasItem;
}
+ #region Immunity Frames
///
/// Gives the player the specified number of immunity frames (or "iframes" for short).
If the player already has more iframes than you want to give them, this function does nothing.
///
@@ -117,6 +124,10 @@ namespace CalamityMod
return true;
}
+ ///
+ /// Removes all immunity frames (or "iframes" for short) from the specified player immediately.
+ ///
+ /// The player whose iframes should be removed.
public static void RemoveAllIFrames(this Player player)
{
player.immune = false;
@@ -125,8 +136,9 @@ namespace CalamityMod
for (int i = 0; i < player.hurtCooldowns.Length; ++i)
player.hurtCooldowns[i] = 0;
}
+ #endregion
-
+ #region Rage and Adrenaline
///
/// Returns the damage multiplier Adrenaline Mode provides for the given player.
///
@@ -161,6 +173,19 @@ namespace CalamityMod
if (mp.adrenalineModeActive)
damageMult += trueMelee ? mp.GetAdrenalineDamage() * rageAndAdrenalineTrueMeleeDamageMult : mp.GetAdrenalineDamage();
}
+ #endregion
+
+ #region Cooldowns
+ public static bool HasCooldown(this Player p, string id)
+ {
+ if (p is null)
+ return false;
+ CalamityPlayer modPlayer = p.Calamity();
+ if (modPlayer is null)
+ return false;
+
+ return modPlayer.Cooldowns.ContainsKey(id);
+ }
public static IList GetDisplayedCooldowns(this Player p)
{
@@ -173,7 +198,9 @@ namespace CalamityMod
ret.Add(instance);
return ret;
}
+ #endregion
+ #region Debuffs
public static void Inflict246DebuffsPvp(Player target, int buff, float timeBase = 2f)
{
if (Main.rand.NextBool(4))
@@ -203,6 +230,7 @@ namespace CalamityMod
target.AddBuff(BuffID.Frostburn, (int)(150 * multiplier));
target.AddBuff(BuffID.OnFire, (int)(180 * multiplier));
}
+ #endregion
///
/// Checks if the player is ontop of solid ground. May also check for solid ground for X tiles in front of them