From 2df8a36e430edb6d313bd49de0a7f46eacf8f1f4 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 12 Mar 2023 05:55:26 -0500 Subject: [PATCH] Fixed remaining 200 > Main.maxNPCs issues. --- NPCs/Astral/HiveEnemy.cs | 2 +- NPCs/Astral/Nova.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 1 - NPCs/Crabulon/Crabulon.cs | 2 +- NPCs/DesertScourge/DesertNuisanceHead.cs | 2 +- NPCs/DesertScourge/DesertScourgeHead.cs | 2 +- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 2 +- NPCs/Perforator/PerforatorHeadLarge.cs | 2 +- NPCs/Perforator/PerforatorHeadSmall.cs | 2 +- NPCs/SlimeGod/CrimulanSlimeGod.cs | 2 +- NPCs/SlimeGod/EbonianSlimeGod.cs | 2 +- NPCs/SlimeGod/SplitCrimulanSlimeGod.cs | 2 +- NPCs/SlimeGod/SplitEbonianSlimeGod.cs | 2 +- NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 2 +- Projectiles/Magic/SHPB.cs | 2 +- Projectiles/Melee/AmidiasWhirlpool.cs | 4 ++-- Projectiles/Melee/BalefulHarvesterProjectile.cs | 2 +- Projectiles/Melee/Cyclone.cs | 4 ++-- Projectiles/Melee/DraconicSpark.cs | 2 +- Projectiles/Melee/Galaxia_AriesWrath.cs | 2 +- Projectiles/Melee/GalaxyBlast.cs | 4 ++-- Projectiles/Melee/GalaxyBlastType2.cs | 4 ++-- Projectiles/Melee/GalaxyBlastType3.cs | 4 ++-- Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs | 2 +- Projectiles/Melee/MourningSkull.cs | 2 +- Projectiles/Melee/Tornado.cs | 4 ++-- Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs | 2 +- Projectiles/Ranged/DrataliornusFlame.cs | 2 +- Projectiles/Ranged/Nanomachine.cs | 2 +- Projectiles/Ranged/ThePackMissile.cs | 2 +- Projectiles/Rogue/NanoblackSplit.cs | 2 +- Projectiles/Rogue/NanoblackStealthSplit.cs | 2 +- Projectiles/Rogue/ShatteredSunScorchedBlade.cs | 2 +- Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs | 2 +- Projectiles/Typeless/BlazingSun.cs | 4 ++-- Projectiles/Typeless/CursorProj.cs | 2 +- Projectiles/Typeless/CursorProjSplit.cs | 4 ++-- Projectiles/Typeless/LunicBeam.cs | 4 ++-- 39 files changed, 47 insertions(+), 48 deletions(-) diff --git a/NPCs/Astral/HiveEnemy.cs b/NPCs/Astral/HiveEnemy.cs index 872741746b..dcd115d0d6 100644 --- a/NPCs/Astral/HiveEnemy.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Astral if (NPC.life <= 0) { int type = ModContent.NPCType(); - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].type == type) { diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index c9032e436a..504f8a29b5 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -211,7 +211,7 @@ namespace CalamityMod.NPCs.Astral if (Main.netMode != NetmodeID.MultiplayerClient) { - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].getRect().Intersects(myRect)) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index b430fe4818..6e392ddd35 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5051,7 +5051,6 @@ namespace CalamityMod.NPCs pool.Add(NPCType(), 0.05f); } - int typeToSpawn = pool.Get(); if (typeToSpawn != NPCID.None) { diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 2b79717bf9..a65f745731 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -638,7 +638,7 @@ namespace CalamityMod.NPCs.Crabulon Main.npc[num664].SetDefaults(num663); Main.npc[num664].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f); Main.npc[num664].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f); - if (Main.netMode == NetmodeID.Server && num664 < 200) + if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); } diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 2bb721f085..59eadfcb72 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.DesertScourge } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index e066ddb73a..6a3dbcbdb7 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -383,7 +383,7 @@ namespace CalamityMod.NPCs.DesertScourge } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 9d92b927de..115780c4b6 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if ((double)NPC.position.Y > (double)((Main.maxTilesY - 200) * 16)) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index a7eb47ee07..2b9d869f14 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -291,7 +291,7 @@ namespace CalamityMod.NPCs.Perforator } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index c7be664939..f27818ddef 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -263,7 +263,7 @@ namespace CalamityMod.NPCs.Perforator } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) diff --git a/NPCs/SlimeGod/CrimulanSlimeGod.cs b/NPCs/SlimeGod/CrimulanSlimeGod.cs index 54d885256c..4b66c33787 100644 --- a/NPCs/SlimeGod/CrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/CrimulanSlimeGod.cs @@ -665,7 +665,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) + if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/SlimeGod/EbonianSlimeGod.cs b/NPCs/SlimeGod/EbonianSlimeGod.cs index 21d20ee402..2aab009cde 100644 --- a/NPCs/SlimeGod/EbonianSlimeGod.cs +++ b/NPCs/SlimeGod/EbonianSlimeGod.cs @@ -677,7 +677,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) + if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs index 83689fc3c0..84c5c8cd90 100644 --- a/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs @@ -652,7 +652,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) + if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/SlimeGod/SplitEbonianSlimeGod.cs b/NPCs/SlimeGod/SplitEbonianSlimeGod.cs index 211d765c5a..a60ba8dd54 100644 --- a/NPCs/SlimeGod/SplitEbonianSlimeGod.cs +++ b/NPCs/SlimeGod/SplitEbonianSlimeGod.cs @@ -665,7 +665,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < 200) + if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs index 2ab38d241d..2e1739ccb3 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs @@ -792,7 +792,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.npc[num32].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; Main.npc[num32].ai[0] = -500 * Main.rand.Next(3); Main.npc[num32].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num32 < 200) + if (Main.netMode == NetmodeID.Server && num32 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num32); return false; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 560fd397c6..0abda53eca 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -505,7 +505,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[0] == 0f && projectile.ai[0] < 0f && projectile.owner == Main.myPlayer) { projectile.localAI[0] = 5f; - for (int num1034 = 0; num1034 < 200; num1034++) + for (int num1034 = 0; num1034 < Main.maxNPCs; num1034++) { NPC nPC13 = Main.npc[num1034]; if (nPC13.CanBeChasedBy(this)) diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index f3d3957bae..56a13baad5 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic float num473 = Projectile.Center.Y; float num474 = 250f; bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) { diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index 1cfe4d840f..751c8e5608 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee int num1016 = 0; if (Projectile.ai[1] == 0f) { - for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) + for (int num1017 = 0; num1017 < Main.maxNPCs; num1017 = num3 + 1) { if (Main.npc[num1017].CanBeChasedBy(Projectile, false)) { diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 34edf25cd6..4c529c4be9 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee { float num559 = 1000f; int num3; - for (int num560 = 0; num560 < 200; num560 = num3 + 1) + for (int num560 = 0; num560 < Main.maxNPCs; num560 = num3 + 1) { if (Main.npc[num560].CanBeChasedBy(Projectile, false)) { diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index ec35d680e2..ef2d9c1143 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using System; using Terraria; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee float num472 = Projectile.Center.X; float num473 = Projectile.Center.Y; float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { NPC npc = Main.npc[num475]; if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) diff --git a/Projectiles/Melee/DraconicSpark.cs b/Projectiles/Melee/DraconicSpark.cs index ea2752d0f8..923cf5613f 100644 --- a/Projectiles/Melee/DraconicSpark.cs +++ b/Projectiles/Melee/DraconicSpark.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee float targetY = Projectile.Center.Y; bool foundTarget = false; float maxRange = MaxHomingRange; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { diff --git a/Projectiles/Melee/Galaxia_AriesWrath.cs b/Projectiles/Melee/Galaxia_AriesWrath.cs index b4daec2623..6586b7c222 100644 --- a/Projectiles/Melee/Galaxia_AriesWrath.cs +++ b/Projectiles/Melee/Galaxia_AriesWrath.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee { float longestReach = MaxProjReach; NPC target = null; - for (int i = 0; i < 200; ++i) + for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; if (!excludedTargets.Contains(npc) && npc.CanBeChasedBy() && !npc.friendly && !npc.townNPC) diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index db54591c0e..cc659b4171 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee { int num158 = -1; float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) + for (int num160 = 0; num160 < Main.maxNPCs; num160++) { NPC nPC = Main.npc[num160]; if (nPC.CanBeChasedBy(Projectile, false)) diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index 00caa17924..cc25ee055f 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee { int num158 = -1; float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) + for (int num160 = 0; num160 < Main.maxNPCs; num160++) { NPC nPC = Main.npc[num160]; if (nPC.CanBeChasedBy(Projectile, false)) diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index d6e9fcc05d..0ffd37f85b 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee { int num158 = -1; float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) + for (int num160 = 0; num160 < Main.maxNPCs; num160++) { NPC nPC = Main.npc[num160]; if (nPC.CanBeChasedBy(Projectile, false)) diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index a3ddebe382..697f916a12 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee { float longestReach = MaxTangleReach; NPC target = null; - for (int i = 0; i < 200; ++i) + for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; if (!excludedTargets.Contains(npc) && npc.CanBeChasedBy() && !npc.friendly && !npc.townNPC) diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index a1970de43c..9ce1f9777f 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee { float num559 = 1000f; int num3; - for (int num560 = 0; num560 < 200; num560 = num3 + 1) + for (int num560 = 0; num560 < Main.maxNPCs; num560 = num3 + 1) { if (Main.npc[num560].CanBeChasedBy(Projectile, false)) { diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index 69ae65cac6..2fbadcb638 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee float num472 = Projectile.Center.X; float num473 = Projectile.Center.Y; float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { NPC npc = Main.npc[num475]; if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) diff --git a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs index 9260f702db..69c34d8019 100644 --- a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs +++ b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Melee { float longestReach = MaxTangleReach; NPC target = null; - for (int i = 0; i < 200; ++i) + for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; if (!excludedTargets.Contains(npc) && npc.CanBeChasedBy() && !npc.friendly && !npc.townNPC) diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index 7f3dec6770..e74949abd1 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged int possibleTarget = -1; float closestDistance = 700f; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index f4ce0b7d5e..d7220ebc1f 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged int num143 = 0; if (Projectile.ai[1] == 0f) { - for (int num144 = 0; num144 < 200; num144++) + for (int num144 = 0; num144 < Main.maxNPCs; num144++) { if (Main.npc[num144].CanBeChasedBy(Projectile, false) && (Projectile.ai[1] == 0f || Projectile.ai[1] == (float)(num144 + 1))) { diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 004b5d5831..c0b624d06f 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 targetCenter = Projectile.Center; float minTargetDistance = 2500f; bool homeIn = false; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs index 275292379d..088c073713 100644 --- a/Projectiles/Rogue/NanoblackSplit.cs +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Rogue bool bossFound = false; int target = -1; float minDist = HomingStartRange; - for (int i = 0; i < 200; ++i) + for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; if (!npc.active || npc.type == NPCID.TargetDummy) diff --git a/Projectiles/Rogue/NanoblackStealthSplit.cs b/Projectiles/Rogue/NanoblackStealthSplit.cs index 42e3546f63..d7ecc7a542 100644 --- a/Projectiles/Rogue/NanoblackStealthSplit.cs +++ b/Projectiles/Rogue/NanoblackStealthSplit.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Rogue bool bossFound = false; int target = -1; float minDist = HomingStartRange; - for (int i = 0; i < 200; ++i) + for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; if (!npc.active || npc.type == NPCID.TargetDummy) diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index 519fbfd326..9f18c20e21 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue float num633; Vector2 vector46 = Projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(Projectile, false)) diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 9bb528438c..1853f314cd 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -975,7 +975,7 @@ namespace CalamityMod.Projectiles.Summon if (!flag19) { int num3; - for (int num542 = 0; num542 < 200; num542 = num3 + 1) + for (int num542 = 0; num542 < Main.maxNPCs; num542 = num3 + 1) { if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { diff --git a/Projectiles/Typeless/BlazingSun.cs b/Projectiles/Typeless/BlazingSun.cs index 25882758d5..ea53f89f05 100644 --- a/Projectiles/Typeless/BlazingSun.cs +++ b/Projectiles/Typeless/BlazingSun.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; using System; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless float num472 = Projectile.Center.X; float num473 = Projectile.Center.Y; float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { NPC npc = Main.npc[num475]; if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index 98cbaeefc0..5a7955c091 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Typeless { int num35 = -1; float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) + for (int num37 = 0; num37 < Main.maxNPCs; num37++) { if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) { diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index 6cb13f7ea1..8e19f27cb1 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -1,4 +1,4 @@ -using System; +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Typeless { int num35 = -1; float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) + for (int num37 = 0; num37 < Main.maxNPCs; num37++) { if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) { diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index b2ad9aac45..eb98b5a934 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Typeless { int num35 = -1; float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) + for (int num37 = 0; num37 < Main.maxNPCs; num37++) { if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) {