From d9938f24837779c475e2647db10b43e367647fc0 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Wed, 23 Mar 2022 17:22:31 -0500 Subject: [PATCH] 1 - Ares, Artemis and Apollo movement code are now a separate method in CalamityGlobalNPC. --- NPCs/CalamityGlobalNPC.cs | 28 +++++++- NPCs/ExoMechs/Apollo/Apollo.cs | 72 +++---------------- NPCs/ExoMechs/Ares/AresBody.cs | 19 +---- NPCs/ExoMechs/Ares/AresGaussNuke.cs | 19 +---- NPCs/ExoMechs/Ares/AresLaserCannon.cs | 54 ++------------ NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 19 +---- NPCs/ExoMechs/Ares/AresTeslaCannon.cs | 19 +---- NPCs/ExoMechs/Artemis/Artemis.cs | 75 +++----------------- 8 files changed, 55 insertions(+), 250 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 20ead22f14..f9f5fd25d7 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5634,10 +5634,32 @@ namespace CalamityMod.NPCs } } } - #endregion + #endregion - #region Astral things - public static void DoHitDust(NPC npc, int hitDirection, int dustType = 5, float xSpeedMult = 1f, int numHitDust = 5, int numDeathDust = 20) + #region Smooth Movement + public static void SmoothMovement(NPC npc, float movementDistanceGateValue, Vector2 distanceFromDestination, float baseVelocity) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + #endregion + + #region Astral things + public static void DoHitDust(NPC npc, int hitDirection, int dustType = 5, float xSpeedMult = 1f, int numHitDust = 5, int numDeathDust = 20) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 7982a00938..578f8726d5 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -953,22 +953,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Fly to the right of the target case (int)Phase.Normal: - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + // Smooth movement towards the location Apollo is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Default animation for 60 frames and then go to telegraph animation // newAI[3] tells Apollo what animation state it's currently in @@ -1039,22 +1025,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Charge case (int)Phase.RocketBarrage: - // Inverse lerp returns the percentage of progress between A and B - float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity2 = distanceFromDestination.Length(); - float minVelocityCap2 = baseVelocity; - if (minVelocity2 > minVelocityCap2) - minVelocity2 = minVelocityCap2; - - // Max velocity - Vector2 maxVelocity2 = distanceFromDestination / 24f; - float maxVelocityCap2 = minVelocityCap2 * 3f; - if (maxVelocity2.Length() > maxVelocityCap2) - maxVelocity2 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap2; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity2, maxVelocity2, lerpValue2); + // Smooth movement towards the location Apollo is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] % (rocketPhaseDuration / numRockets) == 0f && canFire) @@ -1090,22 +1062,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (!readyToCharge) { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue3 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity3 = distanceFromDestination.Length(); - float minVelocityCap3 = baseVelocity; - if (minVelocity3 > minVelocityCap3) - minVelocity3 = minVelocityCap3; - - // Max velocity - Vector2 maxVelocity3 = distanceFromDestination / 24f; - float maxVelocityCap3 = minVelocityCap3 * 3f; - if (maxVelocity3.Length() > maxVelocityCap3) - maxVelocity3 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap3; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity3, maxVelocity3, lerpValue3); + // Smooth movement towards the location Apollo is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); } else { @@ -1299,22 +1257,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Phase transition animation, that's all this exists for case (int)Phase.PhaseTransition: - // Inverse lerp returns the percentage of progress between A and B - float lerpValue4 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity4 = distanceFromDestination.Length(); - float minVelocityCap4 = baseVelocity; - if (minVelocity4 > minVelocityCap4) - minVelocity4 = minVelocityCap4; - - // Max velocity - Vector2 maxVelocity4 = distanceFromDestination / 24f; - float maxVelocityCap4 = minVelocityCap4 * 3f; - if (maxVelocity4.Length() > maxVelocityCap4) - maxVelocity4 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap4; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity4, maxVelocity4, lerpValue4); + // Smooth movement towards the location Apollo is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Shoot lens gore at the target at the proper time if (calamityGlobalNPC.newAI[2] == lensPopTime) diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index ad7777eaab..e51c230a67 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -640,22 +640,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fly above the target case (int)Phase.Normal: - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + // Smooth movement towards the location Ares is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); if (shouldGetBuffedByBerserkPhase) { @@ -732,7 +718,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares int totalProjectiles = malice ? 12 : death ? 10 : revenge ? 9 : expertMode ? 8 : 6; float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); bool normalLaserRotation = npc.localAI[0] % 2f == 0f; float velocity = 6f; double angleA = radians * 0.5; diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index dfa7f1d749..39e602beaa 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -455,23 +455,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.Update(); - // Movement - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + // Smooth movement towards the location Ares Gauss Nuke is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 34e6e2cc60..4e911ee407 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -374,22 +374,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Do nothing, rotate to aim at the target and fly in place case (int)Phase.Nothing: - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + // Smooth movement towards the location Ares Laser Cannon is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] >= deathrayPhaseGateValue) @@ -410,22 +396,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration - 100f && !fireNormalLasers) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), npc.Center); - // Inverse lerp returns the percentage of progress between A and B - float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity2 = distanceFromDestination.Length(); - float minVelocityCap2 = baseVelocity; - if (minVelocity2 > minVelocityCap2) - minVelocity2 = minVelocityCap2; - - // Max velocity - Vector2 maxVelocity2 = distanceFromDestination / 24f; - float maxVelocityCap2 = minVelocityCap2 * 3f; - if (maxVelocity2.Length() > maxVelocityCap2) - maxVelocity2 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap2; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity2, maxVelocity2, lerpValue2); + // Smooth movement towards the location Ares Laser Cannon is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Set frames to deathray charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) @@ -449,22 +421,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fire regular Thanatos lasers if Ares is in deathray phase, otherwise, fire deathray if (fireNormalLasers) { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue3 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity3 = distanceFromDestination.Length(); - float minVelocityCap3 = baseVelocity; - if (minVelocity3 > minVelocityCap3) - minVelocity3 = minVelocityCap3; - - // Max velocity - Vector2 maxVelocity3 = distanceFromDestination / 24f; - float maxVelocityCap3 = minVelocityCap3 * 3f; - if (maxVelocity3.Length() > maxVelocityCap3) - maxVelocity3 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap3; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity3, maxVelocity3, lerpValue3); + // Smooth movement towards the location Ares Laser Cannon is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Fire Thanatos lasers int numLasers = enraged ? 9 : lastMechAlive ? 3 : 2; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index da0c740b1e..3ff4fa6418 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -455,23 +455,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.Update(); - // Movement - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + // Smooth movement towards the location Ares Plasma Flamethrower is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index a86f37209d..632dd005a6 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -449,23 +449,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.Update(); - // Movement - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + // Smooth movement towards the location Ares Tesla Cannon is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index eb7b21ec32..328fb75d29 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -586,9 +586,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } - // Destination variables - Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; - // Duration of deathray spin to do a full circle // Normal = 120, Expert = 104, Rev = 96, Death = 88, Malice = 72 float spinTime = 120f - 320f * (baseVelocityMult - 1.25f); @@ -657,22 +654,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Set charge variable to default chargeVelocityNormalized = default; - // Inverse lerp returns the percentage of progress between A and B - float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity2 = distanceFromDestination.Length(); - float minVelocityCap2 = baseVelocity; - if (minVelocity2 > minVelocityCap2) - minVelocity2 = minVelocityCap2; - - // Max velocity - Vector2 maxVelocity2 = distanceFromDestination / 24f; - float maxVelocityCap2 = minVelocityCap2 * 3f; - if (maxVelocity2.Length() > maxVelocityCap2) - maxVelocity2 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap2; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity2, maxVelocity2, lerpValue2); + // Smooth movement towards the location Artemis is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); } else { @@ -829,22 +812,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser shotgun barrage case (int)Phase.LaserShotgun: - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + // Smooth movement towards the location Artemis is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Fire lasers int numSpreads = lastMechAlive ? 3 : 2; @@ -1040,22 +1009,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } else { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue3 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity3 = distanceFromDestination.Length(); - float minVelocityCap3 = baseVelocity; - if (minVelocity3 > minVelocityCap3) - minVelocity3 = minVelocityCap3; - - // Max velocity - Vector2 maxVelocity3 = distanceFromDestination / 24f; - float maxVelocityCap3 = minVelocityCap3 * 3f; - if (maxVelocity3.Length() > maxVelocityCap3) - maxVelocity3 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap3; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity3, maxVelocity3, lerpValue3); + // Smooth movement towards the location Artemis is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); } // Reset phase and variables @@ -1105,22 +1060,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Phase transition animation, that's all this exists for case (int)Phase.PhaseTransition: - // Inverse lerp returns the percentage of progress between A and B - float lerpValue4 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - - // Min velocity - float minVelocity4 = distanceFromDestination.Length(); - float minVelocityCap4 = baseVelocity; - if (minVelocity4 > minVelocityCap4) - minVelocity4 = minVelocityCap4; - - // Max velocity - Vector2 maxVelocity4 = distanceFromDestination / 24f; - float maxVelocityCap4 = minVelocityCap4 * 3f; - if (maxVelocity4.Length() > maxVelocityCap4) - maxVelocity4 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap4; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity4, maxVelocity4, lerpValue4); + // Smooth movement towards the location Artemis is meant to be at + CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Shoot lens gore at the target at the proper time if (calamityGlobalNPC.newAI[2] == lensPopTime)