Fixed the IL edit + Siren Ice shield cooldown

This commit is contained in:
IbanPlay authored and Cameron Ewell committed 2022-03-09 00:02:13 -05:00
1 parent f0f786ab92
commit cbcbdfaa23
6 files changed
+25 -10

No files matched your search

-1
View File
@@ -18,7 +18,6 @@ namespace CalamityMod.Buffs.Cooldowns
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().sirenIceCooldown = true;
}
}
}
+3 -5
View File
@@ -511,7 +511,6 @@ namespace CalamityMod.CalPlayer
public int abyssalDivingSuitPlateHits = 0;
public bool sirenWaterBuff = false;
public bool sirenIce = false;
public bool sirenIceCooldown = false;
public bool aSpark = false;
public bool aSparkRare = false;
public bool aBulwarkRare = false;
@@ -1576,7 +1575,6 @@ namespace CalamityMod.CalPlayer
sirenWaterBuff = false;
sirenIce = false;
sirenIceCooldown = false;
draedonsHeart = false;
@@ -2292,7 +2290,6 @@ namespace CalamityMod.CalPlayer
godSlayerCooldown = false;
abyssalDivingSuitCooldown = false;
abyssalDivingSuitPlateHits = 0;
sirenIceCooldown = false;
inkBombCooldown = false;
abyssalMirrorCooldown = false;
eclipseMirrorCooldown = false;
@@ -3937,7 +3934,7 @@ namespace CalamityMod.CalPlayer
}
if (sirenBoobs && NPC.downedBoss3)
{
if (player.whoAmI == Main.myPlayer && !sirenIceCooldown)
if (player.whoAmI == Main.myPlayer && !Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(IceShieldCooldown)))
{
player.AddBuff(ModContent.BuffType<IceShieldBuff>(), 2);
}
@@ -7067,7 +7064,8 @@ namespace CalamityMod.CalPlayer
if (sirenIce)
{
Main.PlaySound(SoundID.NPCKilled, (int)player.Center.X, (int)player.Center.Y, 7);
player.AddBuff(ModContent.BuffType<IceShieldBrokenBuff>(), 1800);
Cooldowns.Add(new IceShieldCooldown(1800, player));
for (int d = 0; d < 10; d++)
{
int ice = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 2f);
+3 -3
View File
@@ -163,7 +163,7 @@ namespace CalamityMod.CalPlayer
packet.Write(player.whoAmI);
packet.Write(key);
int timer = 0;
if (Cooldowns.ContainsType(CooldownIndicator.IDtoType[key]))
if (Cooldowns.Exists(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[key]))
timer = Cooldowns.Find(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[key]).TimeLeft;
packet.Write(timer);
player.SendPacket(packet, server);
@@ -177,7 +177,7 @@ namespace CalamityMod.CalPlayer
packet.Write(player.whoAmI);
packet.Write(cooldownID);
int timer = 0;
if (Cooldowns.ContainsType(CooldownIndicator.IDtoType[cooldownID]))
if (Cooldowns.Exists(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[cooldownID]))
timer = Cooldowns.Find(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[cooldownID]).TimeLeft;
packet.Write(timer);
player.SendPacket(packet, server);
@@ -339,7 +339,7 @@ namespace CalamityMod.CalPlayer
int timer = reader.ReadInt32();
Type cooldownType = CooldownIndicator.IDtoType[syncID];
if (Cooldowns.ContainsType(cooldownType))
if (Cooldowns.Exists(cooldown => cooldown.GetType() == cooldownType))
Cooldowns.Find(cooldown => cooldown.GetType() == cooldownType).TimeLeft = timer;
else if (timer > 0)
+1 -1
View File
@@ -109,7 +109,7 @@ namespace CalamityMod.ILEditing
cursor.EmitDelegate<Func<Player, int>>((Player p) =>
{
CalamityPlayer mp = p.Calamity();
return mp.disableAllDodges ? 1 : p.Calamity().Cooldowns.ContainsType(typeof(GlobalDodgeCooldown)) ? p.Calamity().Cooldowns.Find(cooldown => cooldown.GetType() == typeof(GlobalDodgeCooldown)).TimeLeft : 0;
return mp.disableAllDodges ? 1 : p.Calamity().Cooldowns.Exists(cooldown => cooldown.GetType() == (typeof(GlobalDodgeCooldown))) ? p.Calamity().Cooldowns.Find(cooldown => cooldown.GetType() == typeof(GlobalDodgeCooldown)).TimeLeft : 0;
});
// Bitwise OR the "RNG result" (always zero) with the dodge cooldown. This will only return zero if both values were zero.
@@ -23,6 +23,8 @@ namespace CalamityMod.UI.CooldownIndicators
Type baseCooldownType = typeof(CooldownIndicator);
CalamityMod calamity = ModContent.GetInstance<CalamityMod>();
IDtoType = new Dictionary<string, Type>();
foreach (Type type in calamity.Code.GetTypes())
{
if (type.IsSubclassOf(baseCooldownType) && !type.IsAbstract && type != baseCooldownType)
+16
View File
@@ -36,4 +36,20 @@ namespace CalamityMod.UI.CooldownIndicators
{
}
}
public class IceShieldCooldown : CooldownIndicator
{
public override string SyncID => "SirenHeartShield";
public override bool DisplayMe => true;
public override string Name => "Ice Shield Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/SirenIceShield";
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 CooldownColorStart => new Color(124, 195, 214);
public override Color CooldownColorEnd => new Color(147, 230, 253);
public IceShieldCooldown(int duration, Player player) : base(duration, player)
{
}
}
}