diff --git a/Items/DifficultyItems/Armageddon.cs b/Items/DifficultyItems/Armageddon.cs index ac7865f068..c42330f06d 100644 --- a/Items/DifficultyItems/Armageddon.cs +++ b/Items/DifficultyItems/Armageddon.cs @@ -45,8 +45,7 @@ namespace CalamityMod.Items.DifficultyItems for (int doom = 0; doom < 200; doom++) { if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0 || - Main.npc[doom].type == NPCID.TheDestroyerBody || Main.npc[doom].type == NPCID.TheDestroyerTail) + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); Main.npc[doom].active = false; diff --git a/Items/DifficultyItems/Death.cs b/Items/DifficultyItems/Death.cs index 9e234c1008..43393fddfc 100644 --- a/Items/DifficultyItems/Death.cs +++ b/Items/DifficultyItems/Death.cs @@ -52,8 +52,7 @@ namespace CalamityMod.Items.DifficultyItems for (int doom = 0; doom < 200; doom++) { if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0 || - Main.npc[doom].type == NPCID.TheDestroyerBody || Main.npc[doom].type == NPCID.TheDestroyerTail) + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); Main.npc[doom].active = false; diff --git a/Items/DifficultyItems/DefiledRune.cs b/Items/DifficultyItems/DefiledRune.cs index 288e2f3009..8a633f5557 100644 --- a/Items/DifficultyItems/DefiledRune.cs +++ b/Items/DifficultyItems/DefiledRune.cs @@ -46,8 +46,7 @@ namespace CalamityMod.Items.DifficultyItems for (int doom = 0; doom < 200; doom++) { if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0 || - Main.npc[doom].type == NPCID.TheDestroyerBody || Main.npc[doom].type == NPCID.TheDestroyerTail) + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); Main.npc[doom].active = false; diff --git a/Items/DifficultyItems/IronHeart.cs b/Items/DifficultyItems/IronHeart.cs index 33946ef2af..58236f96e4 100644 --- a/Items/DifficultyItems/IronHeart.cs +++ b/Items/DifficultyItems/IronHeart.cs @@ -47,8 +47,7 @@ namespace CalamityMod.Items.DifficultyItems for (int doom = 0; doom < 200; doom++) { if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0 || - Main.npc[doom].type == NPCID.TheDestroyerBody || Main.npc[doom].type == NPCID.TheDestroyerTail) + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) { player.KillMeForGood(); Main.npc[doom].active = false; diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index d11f17398a..5c5b4c2dbb 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -60,8 +60,7 @@ namespace CalamityMod.Items.DifficultyItems for (int doom = 0; doom < 200; doom++) { if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0 || - Main.npc[doom].type == NPCID.TheDestroyerBody || Main.npc[doom].type == NPCID.TheDestroyerTail) + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); Main.npc[doom].active = false; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index b370b0f1f5..c8b3003f50 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -4260,20 +4260,27 @@ namespace CalamityMod.NPCs // Check if other segments are still alive, if not, die if (npc.type > NPCID.TheDestroyer) { - bool flag = false; - if (npc.ai[1] <= 0f) - flag = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - flag = true; - - if (flag) + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyer) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) { npc.life = 0; npc.HitEffect(0, 10.0); npc.checkDead(); + npc.active = false; } } - if (npc.type == NPCID.TheDestroyerBody) { // Gain more defense as health lowers with a max of 30, lose defense if probe has been launched