Fixed some worm boss anti-wiggle issues and made Eater of Worlds and Small and Medium Perf body and tail take more velocity to deal contact damage.

This commit is contained in:
mountaindrew10 committed 2024-03-16 07:22:02 -05:00
1 parent 659f6096cd
commit 7dfc7d9568
12 files changed
+38 -28

No files matched your search

@@ -576,7 +576,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
npc.velocity.Y = segmentVelocity;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(npc.velocity.X) > segmentVelocity;
bool slowXVelocity = Math.Abs(npc.velocity.X) > speed;
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4)
{
if (npc.velocity.X < 0f)
+1 -1
View File
@@ -233,7 +233,7 @@ namespace CalamityMod.NPCs.DesertScourge
NPC.velocity.Y = maxChaseSpeed;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChaseSpeed;
bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy;
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
+1 -1
View File
@@ -487,7 +487,7 @@ namespace CalamityMod.NPCs.DesertScourge
NPC.velocity.Y = maxChaseSpeed;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChaseSpeed;
bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy;
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
+2 -2
View File
@@ -1373,7 +1373,7 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.velocity.Y = segmentVelocity;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(NPC.velocity.X) > segmentVelocity;
bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy;
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2)
{
if (NPC.velocity.X < 0f)
@@ -2149,7 +2149,7 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.velocity.Y = segmentVelocity;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(NPC.velocity.X) > segmentVelocity;
bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy;
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2)
{
if (NPC.velocity.X < 0f)
+3 -2
View File
@@ -180,9 +180,10 @@ namespace CalamityMod.NPCs.Perforator
}
// Calculate contact damage based on velocity
// This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc.
float maxChaseSpeed = 16f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.25f;
float minimalDamageVelocity = maxChaseSpeed * 0.5f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.4f;
float minimalDamageVelocity = maxChaseSpeed * 0.8f;
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
{
+3 -2
View File
@@ -152,9 +152,10 @@ namespace CalamityMod.NPCs.Perforator
}
// Calculate contact damage based on velocity
// This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc.
float maxChaseSpeed = 16f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.25f;
float minimalDamageVelocity = maxChaseSpeed * 0.5f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.4f;
float minimalDamageVelocity = maxChaseSpeed * 0.8f;
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
{
+1 -1
View File
@@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.Perforator
NPC.velocity.Y = maxChargeSpeed;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChargeSpeed;
bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy;
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
+1 -1
View File
@@ -287,7 +287,7 @@ namespace CalamityMod.NPCs.Perforator
NPC.velocity.Y = maxChargeSpeed;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChargeSpeed;
bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy;
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChargeSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
+1 -1
View File
@@ -326,7 +326,7 @@ namespace CalamityMod.NPCs.Perforator
NPC.velocity.Y = maxChargeSpeed;
// This bool exists to stop the strange wiggle behavior when worms are falling down
bool slowXVelocity = Math.Abs(NPC.velocity.X) > maxChargeSpeed;
bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy;
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
+3 -2
View File
@@ -151,9 +151,10 @@ namespace CalamityMod.NPCs.Perforator
}
// Calculate contact damage based on velocity
// This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc.
float maxChaseSpeed = 16f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.25f;
float minimalDamageVelocity = maxChaseSpeed * 0.5f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.4f;
float minimalDamageVelocity = maxChaseSpeed * 0.8f;
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
{
+3 -2
View File
@@ -153,9 +153,10 @@ namespace CalamityMod.NPCs.Perforator
}
// Calculate contact damage based on velocity
// This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc.
float maxChaseSpeed = 16f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.25f;
float minimalDamageVelocity = maxChaseSpeed * 0.5f;
float minimalContactDamageVelocity = maxChaseSpeed * 0.4f;
float minimalDamageVelocity = maxChaseSpeed * 0.8f;
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
{
@@ -634,30 +634,33 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
// Calculate contact damage based on velocity
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
float minimalDamageVelocity = segmentVelocity * 0.5f;
// This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc.
float minimalContactDamageHeadVelocity = segmentVelocity * 0.25f;
float minimalDamageHeadVelocity = segmentVelocity * 0.5f;
float minimalContactDamageBodyVelocity = segmentVelocity * 0.4f;
float minimalDamageBodyVelocity = segmentVelocity * 0.8f;
if (npc.type == NPCID.EaterofWorldsHead)
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
if (npc.velocity.Length() <= minimalContactDamageHeadVelocity)
{
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
{
float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length();
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity)
{
npc.damage = 0;
}
else
{
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
}
}
@@ -1140,30 +1143,33 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
// Calculate contact damage based on velocity
float minimalContactDamageVelocity = num52 * 0.25f;
float minimalDamageVelocity = num52 * 0.5f;
// This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc.
float minimalContactDamageHeadVelocity = num52 * 0.25f;
float minimalDamageHeadVelocity = num52 * 0.5f;
float minimalContactDamageBodyVelocity = num52 * 0.4f;
float minimalDamageBodyVelocity = num52 * 0.8f;
if (npc.type == NPCID.EaterofWorldsHead)
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
if (npc.velocity.Length() <= minimalContactDamageHeadVelocity)
{
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
{
float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length();
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity)
{
npc.damage = 0;
}
else
{
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar);
}
}