From 5bc83ffc75ac7823e4b78fc3b7c1d2bed09ed349 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Fri, 31 May 2024 20:05:39 -0500 Subject: [PATCH] Aquatic Scourge, Brimstone Elemental, and Cal Clone targeting changes. --- NPCs/CalClone/SoulSeeker.cs | 6 ++--- .../CalamityBossAIs/AquaticScourgeAI.cs | 4 ---- .../CalamityBossAIs/BrimstoneElementalAI.cs | 4 ---- .../CalamityBossAIs/CalamitasCloneAI.cs | 22 +------------------ 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 2731b95647..adbefe7503 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -108,10 +108,8 @@ namespace CalamityMod.NPCs.CalClone start = false; } - NPC.TargetClosest(); - float projectileSpeed = 9f; - Vector2 velocity = Main.player[NPC.target].Center - NPC.Center; + Vector2 velocity = Main.player[parent.target].Center - NPC.Center; velocity.Normalize(); velocity *= projectileSpeed; NPC.rotation = velocity.ToRotation() + MathHelper.Pi; @@ -126,7 +124,7 @@ namespace CalamityMod.NPCs.CalClone int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 1f, NPC.target, 1f, 0f, projectileSpeed * 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 1f, parent.target, 1f, 0f, projectileSpeed * 2f); } timer = 0; } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs index b1086e7143..2ddd4e677e 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs @@ -87,10 +87,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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) - npc.TargetClosest(); - Player player = Main.player[npc.target]; bool notOcean = player.position.Y < 300f || diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs index 89ff485601..6cc79b9e1b 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs @@ -46,10 +46,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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) - npc.TargetClosest(); - Player player = Main.player[npc.target]; bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs index 2551962926..885505f155 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -185,10 +185,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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) - npc.TargetClosest(); - // Target variable Player player = Main.player[npc.target]; @@ -556,7 +552,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (death) npc.localAI[0] = 1f; - npc.TargetClosest(); npc.netUpdate = true; } @@ -645,7 +640,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (death) npc.localAI[0] = 1f; - npc.TargetClosest(); npc.netUpdate = true; } } @@ -706,11 +700,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] = 0f; npc.rotation = rotation; - npc.TargetClosest(); npc.netUpdate = true; if (npc.ai[3] >= 2f) { + npc.TargetClosest(); npc.ai[1] = 0f; npc.ai[3] = 0f; return; @@ -727,8 +721,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] += 1f; if (npc.ai[2] >= (phase4 ? 15f : 30f)) { - npc.TargetClosest(); - npc.ai[1] = 2f; npc.ai[2] = 0f; if (death) @@ -768,10 +760,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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) - npc.TargetClosest(); - Player player = Main.player[npc.target]; float enrageScale = bossRush ? 1f : 0f; @@ -914,7 +902,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] += 1f; if (npc.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(); npc.ai[1] = 1f; npc.ai[2] = 0f; npc.target = 255; @@ -1047,7 +1034,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] = 0f; npc.target = 255; npc.rotation = calCloneBroRotation; - npc.TargetClosest(); if (npc.ai[3] >= 3f) { npc.ai[1] = 0f; @@ -1089,10 +1075,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs 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) - npc.TargetClosest(); - Player player = Main.player[npc.target]; float enrageScale = bossRush ? 1f : 0f; @@ -1235,7 +1217,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] += 1f; if (npc.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(); npc.ai[1] = 1f; npc.ai[2] = 0f; npc.target = 255; @@ -1366,7 +1347,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.TargetClosest(); npc.rotation = calCloneBroRotation; if (npc.ai[3] >= 4f) {