Worm boss contact damage with velocity update, it's now 0 when velocity is at or below 2 units per frame, also added support for Aquatic Scourge and Astrum Deus.
This commit is contained in:
1 parent
2a51ebbbee
commit
276ef8d901
3 files changed
+71
-10
No files matched your search
+41
-2
@@ -62,7 +62,25 @@ namespace CalamityMod.NPCs
|
||||
npc.chaseable = true;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
npc.damage = npc.defDamage;
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = 2f;
|
||||
float minimalDamageVelocity = 8f;
|
||||
if (npc.velocity.Length() <= minimalContactDamageVelocity)
|
||||
{
|
||||
if (head)
|
||||
npc.damage = (int)(npc.defDamage * 0.5f);
|
||||
else
|
||||
npc.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
if (head)
|
||||
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
|
||||
else
|
||||
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
else
|
||||
npc.damage = 0;
|
||||
@@ -3529,9 +3547,30 @@ namespace CalamityMod.NPCs
|
||||
|
||||
// Deus cannot hit for 3 seconds or while invulnerable
|
||||
if (calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage)
|
||||
{
|
||||
npc.damage = 0;
|
||||
}
|
||||
else
|
||||
npc.damage = npc.defDamage;
|
||||
{
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = 2f;
|
||||
float minimalDamageVelocity = 8f;
|
||||
if (npc.velocity.Length() <= minimalContactDamageVelocity)
|
||||
{
|
||||
if (head)
|
||||
npc.damage = (int)(npc.defDamage * 0.5f);
|
||||
else
|
||||
npc.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
if (head)
|
||||
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
|
||||
else
|
||||
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
|
||||
// Get a target
|
||||
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
|
||||
|
||||
@@ -79,12 +79,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
|
||||
npc.realLife = (int)npc.ai[3];
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = 2f;
|
||||
float minimalDamageVelocity = 8f;
|
||||
float velocityDamageScalar = MathHelper.Clamp(npc.velocity.Length() / minimalDamageVelocity, 0f, 1f);
|
||||
if (npc.type == NPCID.TheDestroyer)
|
||||
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
|
||||
if (npc.velocity.Length() <= minimalContactDamageVelocity)
|
||||
{
|
||||
if (npc.type == NPCID.TheDestroyer)
|
||||
npc.damage = (int)(npc.defDamage * 0.5f);
|
||||
else
|
||||
npc.damage = 0;
|
||||
}
|
||||
else
|
||||
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
if (npc.type == NPCID.TheDestroyer)
|
||||
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
|
||||
else
|
||||
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
|
||||
}
|
||||
|
||||
// Get a target
|
||||
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
|
||||
|
||||
@@ -30,12 +30,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
|
||||
npc.reflectsProjectiles = true;
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = 2f;
|
||||
float minimalDamageVelocity = 8f;
|
||||
float velocityDamageScalar = MathHelper.Clamp(npc.velocity.Length() / minimalDamageVelocity, 0f, 1f);
|
||||
if (npc.type == NPCID.EaterofWorldsHead)
|
||||
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
|
||||
if (npc.velocity.Length() <= minimalContactDamageVelocity)
|
||||
{
|
||||
if (npc.type == NPCID.EaterofWorldsHead)
|
||||
npc.damage = (int)(npc.defDamage * 0.5f);
|
||||
else
|
||||
npc.damage = 0;
|
||||
}
|
||||
else
|
||||
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
if (npc.type == NPCID.EaterofWorldsHead)
|
||||
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
|
||||
else
|
||||
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
|
||||
}
|
||||
|
||||
// Get a target
|
||||
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
|
||||
|
||||
Reference in new issue
Block a user