DoG targeting fix and fast turning while far away

This commit is contained in:
mountaindrew10 committed 2024-05-16 16:45:01 -05:00
1 parent 4131dde698
commit 8343aeb488
1 file changed
+6 -4
+6 -4
View File
@@ -355,12 +355,10 @@ namespace CalamityMod.NPCs.DevourerofGods
if (CalamityConfig.Instance.BossesStopWeather)
CalamityMod.StopRain();
// Get a target
// Get a target (time is checked in the second check to ensure a new target isn't being set constantly)
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
// Despawn safety, make sure to target another player if the current player target is too far away
if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles)
else if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles && Main.time % 60D == 0D)
NPC.TargetClosest();
Player player = Main.player[NPC.target];
@@ -2354,6 +2352,10 @@ namespace CalamityMod.NPCs.DevourerofGods
}
}
// There is no escape...
if (NPC.Distance(player.Center) > 2400f)
NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed;
// Calculate contact damage based on velocity
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
float minimalDamageVelocity = segmentVelocity * 0.5f;