diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 3ed6f97029..9d05f5f836 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2482,7 +2482,7 @@ namespace CalamityMod.NPCs } // Fire astral lasers while walking - else if (npc.ai[0] == 2f) + else if (npc.ai[0] == 2f && phase2) { float num179 = BossRushEvent.BossRushActive ? 24f : death ? 20f : 18.5f; int maxProjectiles = death ? 6 : 4; @@ -2719,7 +2719,7 @@ namespace CalamityMod.NPCs float maxStompAmt = death ? 2f : 3f; if (npc.ai[2] >= maxStompAmt) { - npc.ai[0] = (phase2 || revenge) ? 5f : 1f; + npc.ai[0] = phase3 ? 5f : 1f; npc.ai[2] = 0f; } else diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 59fbaedd96..4f569c3ab1 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -16,7 +16,6 @@ using Terraria.Enums; using Terraria.GameContent; using Terraria.GameContent.Events; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs @@ -653,8 +652,8 @@ namespace CalamityMod.NPCs npc.ai[1] = 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.target = Main.maxPlayers; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } else if (num16 < 500f) { @@ -745,14 +744,14 @@ namespace CalamityMod.NPCs { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = Main.maxPlayers; - npc.rotation = num8; + npc.TargetClosest(); + npc.rotation = num8; if (npc.ai[3] >= 3f) { npc.ai[1] = 0f; npc.ai[3] = 0f; - } + } else npc.ai[1] = 1f; } @@ -764,7 +763,8 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; if (npc.netSpam > 10) npc.netSpam = 10; @@ -947,8 +947,8 @@ namespace CalamityMod.NPCs if (phase4) npc.ai[1] = 3f; - npc.target = Main.maxPlayers; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -1007,8 +1007,8 @@ namespace CalamityMod.NPCs { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = Main.maxPlayers; - npc.rotation = num8; + npc.TargetClosest(); + npc.rotation = num8; if (npc.ai[3] >= 3f) { @@ -1019,7 +1019,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 3f; npc.ai[3] += Main.rand.Next(1, 4); } - npc.netUpdate = true; + npc.netUpdate = true; if (npc.netSpam > 10) npc.netSpam = 10; @@ -1157,7 +1157,7 @@ namespace CalamityMod.NPCs { npc.ai[1] = 0f; npc.ai[3] = 0f; - } + } else npc.ai[1] = 3f; } @@ -3595,7 +3595,8 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; npc.ai[1] = 0f; calamityGlobalNPC.newAI[1] = 0f; - } + npc.TargetClosest(); + } npc.rotation += npc.direction * 0.3f; Vector2 vector20 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -4401,7 +4402,8 @@ namespace CalamityMod.NPCs { npc.localAI[2] = 1f; npc.localAI[1] = 0f; - } + npc.TargetClosest(); + } } else if (npc.localAI[1] > 45f && (canHit || fireAcceleratingLasers) && !charging) { @@ -4469,7 +4471,10 @@ namespace CalamityMod.NPCs float newAISet = phase5 ? 900f : phase4 ? 450f : 0f; calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= 1800f) + { calamityGlobalNPC.newAI[3] = newAISet; + npc.TargetClosest(); + } // Set worm variable for worms if (npc.ai[3] > 0f) @@ -9996,8 +10001,6 @@ namespace CalamityMod.NPCs } else { - npc.TargetClosest(); - // Fall through if (!Main.player[npc.target].dead) {