From f012b636e2d5d3c5678467d957338f3883df7814 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 19 Mar 2024 21:26:03 -0400 Subject: [PATCH] Brimstone Monsters deal massively increased damage if you attempt to move through them quickly. --- Projectiles/Boss/BrimstoneMonster.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 20ab4c64bd..5fd63ffc2c 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.Boss public static int MinimumDamagePerFrame = 4; public static int MaximumDamagePerFrame = 16; public static float AdrenalineLossPerFrame = 0.04f; + public static float SpeedToForceMaxDamage = 25f; private float speedAdd = 0f; private float speedLimit = 0f; @@ -257,7 +258,9 @@ namespace CalamityMod.Projectiles.Boss return false; // If Journey God Mode is active, or any effects which simulate, provide or equivalent to it, do not harm the player. - if (player.creativeGodMode) + // Likewise, if the player has immunity frames, do not harm them. + bool cannotBeHurt = player.HasIFrames() || player.creativeGodMode; + if (cannotBeHurt) return true; // Applies Vulnerability Hex and/or the effects of Supreme Cirrus' HAGE faces. @@ -266,7 +269,16 @@ namespace CalamityMod.Projectiles.Boss // Compute distance for direct health reduction from overlap. float distSQ = Projectile.DistanceSQ(player.Center); float radiusSQ = CircularHitboxRadius * CircularHitboxRadius * Projectile.scale * Projectile.scale; - int healthToDrain = (int)MathHelper.Lerp(MaximumDamagePerFrame, MinimumDamagePerFrame, distSQ / radiusSQ); + float radiusRatio = distSQ / radiusSQ; + + // Check the player's speed. If they are moving fast enough, damage them more severely; this prevents trying to rush straight through the vortex. + float playerSpeed = player.velocity.LengthSquared(); + float speedRatio = playerSpeed / SpeedToForceMaxDamage * SpeedToForceMaxDamage; + + // Take the higher of the two to determine the damage application ratio. + float damageApplicationRatio = MathHelper.Max(radiusRatio, speedRatio); + + int healthToDrain = (int)MathHelper.Lerp(MaximumDamagePerFrame, MinimumDamagePerFrame, damageApplicationRatio); if (healthToDrain < MinimumDamagePerFrame) healthToDrain = MinimumDamagePerFrame;