diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index d1db382e64..2cf433a89a 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -82,10 +82,19 @@ namespace CalamityMod.Projectiles.Ranged Projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.GetLerpValue(0f, 25f, Time, true)); if (Projectile.localAI[0] == 0f) { + float currentDist = 25000f; foreach (NPC n in Main.ActiveNPCs) { if (n.CanBeChasedBy(Projectile.GetSource_FromThis(), false)) - NPCDestination = n.Center + n.velocity * 5f; + { + Vector2 potentialDest = n.Center + n.velocity * 5f; + float newDist = potentialDest.Distance(Projectile.Center); + if (newDist < currentDist) + { + currentDist = newDist; + NPCDestination = potentialDest; + } + } } InitialCenter = Projectile.Center; Projectile.localAI[0] = 1f;