From 574ed2f4aaa94161c36bdaa306a5cdab8fb80670 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 6 May 2024 13:08:22 -0400 Subject: [PATCH] Desert Scourge deals no damage while hiding --- NPCs/DesertScourge/DesertScourgeBody.cs | 2 +- NPCs/DesertScourge/DesertScourgeHead.cs | 17 +++++++++++------ NPCs/DesertScourge/DesertScourgeTail.cs | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 798cb3b9e5..c44d91cf26 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.DesertScourge float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; float minimalDamageVelocity = maxChaseSpeed * 0.5f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) + if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) { NPC.damage = 0; } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index bade3ea88f..39d24c54ed 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -653,14 +653,19 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; float minimalDamageVelocity = maxChaseSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } + if (hide) + NPC.damage = 0; else { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 25172418c3..a9fcfafe36 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -182,7 +182,7 @@ namespace CalamityMod.NPCs.DesertScourge float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; float minimalDamageVelocity = maxChaseSpeed * 0.5f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) + if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) { NPC.damage = 0; }