From 7dfc7d95684d7114b31fcb5a0bdda97c3f2c8a8b Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sat, 16 Mar 2024 07:22:02 -0500 Subject: [PATCH] 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. --- .../CalamityBossAIs/AstrumDeusAI.cs | 2 +- NPCs/DesertScourge/DesertNuisanceHead.cs | 2 +- NPCs/DesertScourge/DesertScourgeHead.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 4 +-- NPCs/Perforator/PerforatorBodyMedium.cs | 5 ++-- NPCs/Perforator/PerforatorBodySmall.cs | 5 ++-- NPCs/Perforator/PerforatorHeadLarge.cs | 2 +- NPCs/Perforator/PerforatorHeadMedium.cs | 2 +- NPCs/Perforator/PerforatorHeadSmall.cs | 2 +- NPCs/Perforator/PerforatorTailMedium.cs | 5 ++-- NPCs/Perforator/PerforatorTailSmall.cs | 5 ++-- .../Bosses/EaterOfWorldsAI.cs | 30 +++++++++++-------- 12 files changed, 38 insertions(+), 28 deletions(-) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index 7f38adff7c..073b69b2ed 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -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) diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index e5446fe48c..0b9c25d636 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -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) diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index a43451ef15..0c76c0a71e 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -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) diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index ab8457cf22..f04132ec01 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -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) diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index f08082c394..9aef865bdd 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -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) { diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index d17ea9ba89..183e7ebbc1 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -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) { diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 01e374ea26..f1531e8358 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -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) diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 582c625649..1fa31758bf 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -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) diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 92c1e4a826..d7f6e98b84 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -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) diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 57f55dfdc0..e918cfe157 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -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) { diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 1b184b4bbd..63932a1536 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -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) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index 62cbff6ca1..4a93783589 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -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); } }