diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 6f0f6e9de7..f34800a78e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3422,6 +3422,18 @@ namespace CalamityMod.CalPlayer } } + // Add a cooldown display for the vanilla lifesteal cooldown, which is active when negative + if (Player.whoAmI == Main.myPlayer && Player.lifeSteal < 0f) + { + float duration = Player.lifeSteal; + float baseCooldown = Main.expertMode ? 0.5f : 0.6f; + float lifeStealNerf = BossRushEvent.BossRushActive ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; + duration /= baseCooldown - lifeStealNerf; + duration *= -1f; + if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < (int)duration)) + Player.AddCooldown(LifeSteal.ID, (int)duration); + } + ForceVariousEffects(); } #endregion diff --git a/Cooldowns/LifeSteal.cs b/Cooldowns/LifeSteal.cs new file mode 100644 index 0000000000..0cb11b571e --- /dev/null +++ b/Cooldowns/LifeSteal.cs @@ -0,0 +1,15 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class LifeSteal : CooldownHandler + { + public static new string ID => "LifeSteal"; + public override bool ShouldDisplay => instance.player.lifeSteal < 0f; + public override string DisplayName => "Life Steal Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/LifeSteal"; + public override Color OutlineColor => new Color(255, 142, 165); + public override Color CooldownStartColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion); + } +} diff --git a/Cooldowns/LifeSteal.png b/Cooldowns/LifeSteal.png new file mode 100644 index 0000000000..ff204d7181 Binary files /dev/null and b/Cooldowns/LifeSteal.png differ diff --git a/Cooldowns/LifeStealOutline.png b/Cooldowns/LifeStealOutline.png new file mode 100644 index 0000000000..86633b605a Binary files /dev/null and b/Cooldowns/LifeStealOutline.png differ diff --git a/Cooldowns/LifeStealOverlay.png b/Cooldowns/LifeStealOverlay.png new file mode 100644 index 0000000000..3abb76845e Binary files /dev/null and b/Cooldowns/LifeStealOverlay.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bf5ffee473..a720944b9d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5778,18 +5778,20 @@ namespace CalamityMod.NPCs #endregion #region Any Events - public static bool AnyEvents(Player player) + public static bool AnyEvents(Player player, bool checkBloodMoon = false) { - if (Main.invasionType > InvasionID.None) + if (Main.invasionType > InvasionID.None && Main.invasionProgressNearInvasion) return true; if (player.PillarZone()) return true; - if (DD2Event.Ongoing) + if (DD2Event.Ongoing && player.ZoneOldOneArmy) return true; - if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && (Main.eclipse || Main.bloodMoon || Main.pumpkinMoon || Main.snowMoon)) + if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && (Main.eclipse || Main.pumpkinMoon || Main.snowMoon)) return true; if (AcidRainEvent.AcidRainEventIsOngoing && player.InSulphur()) return true; + if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.bloodMoon && checkBloodMoon) + return true; return false; } #endregion diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index a9c2f05aca..63e70e5222 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -113,21 +113,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs index 7ea9afb07a..cd9473268d 100644 --- a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs +++ b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs @@ -132,21 +132,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override void FindFrame(int frameHeight) { NPC.frameCounter++; diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index 445bb73802..c272e37e4f 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -337,21 +337,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas return false; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override bool CheckActive() { return false; diff --git a/NPCs/SupremeCalamitas/SepulcherTail.cs b/NPCs/SupremeCalamitas/SepulcherTail.cs index f293098ba7..7893de23af 100644 --- a/NPCs/SupremeCalamitas/SepulcherTail.cs +++ b/NPCs/SupremeCalamitas/SepulcherTail.cs @@ -163,21 +163,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas return false; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override void HitEffect(int hitDirection, double damage) { if (NPC.life <= 0)