Desert Scourge deals no damage while hiding
This commit is contained in:
1 parent
bcc4f8affc
commit
574ed2f4aa
3 files changed
+13
-8
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user