diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 960608abd5..7e0f802838 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -450,40 +450,19 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(30, 41)); + DropHelper.DropItem(npc, ModContent.ItemType(), 30, 40); if (Main.rand.NextBool(10)) { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticHood); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticRobe); + DropHelper.DropItem(npc, ItemID.BlueLunaticHood); + DropHelper.DropItem(npc, ItemID.BlueLunaticRobe); } int chance = CalamityGlobalNPCLoot.halibutCannonBaseDropChance / 100; - if (Main.rand.NextBool(chance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - } - if (CalamityWorld.downedCalamitas) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(6, 9)); - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - } - } - if (NPC.downedPlantBoss) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(8, 13)); - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, chance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 6, 8); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 2, 3); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 8, 12); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 91da677794..99ee5e30c8 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -458,19 +458,14 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(80, 101)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(21, 33)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(50, 109)); - if (CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(15, 28)); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index e0a96bcf86..ad29e0c4a9 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -252,25 +252,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(CalamityGlobalNPCLoot.halibutCannonBaseDropChance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 5)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 2, 4); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 1, 2); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index d96fd87518..712cec5fdb 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -338,29 +338,11 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(CalamityGlobalNPCLoot.halibutCannonBaseDropChance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(6, 9)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - } - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 6, 8); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 2, 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index d3f4bfa4cb..22910df1fa 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -112,17 +112,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(CalamityGlobalNPCLoot.halibutCannonBaseDropChance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 98d947ae52..adcfb99402 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -285,26 +285,11 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(8, 16)); - if (Main.rand.NextBool(CalamityGlobalNPCLoot.halibutCannonBaseDropChance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - } + DropHelper.DropItem(npc, ModContent.ItemType(), 8, 15); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index fa7eeb269c..8cc1326420 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -310,21 +310,9 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(CalamityGlobalNPCLoot.halibutCannonBaseDropChance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(3, 6)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 3, 5); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 1, 2); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 7f8a4759c4..e29963bdc8 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -149,21 +149,9 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(CalamityGlobalNPCLoot.halibutCannonBaseDropChance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - } - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 2, 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index a3afd65f47..9f819e7eb9 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -121,25 +121,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(CalamityGlobalNPCLoot.halibutCannonBaseDropChance) && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedCalamitas) - { - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.25f); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 7411eedc31..b42a0d3920 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -120,18 +120,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 89cc96864f..ca0288334e 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -281,14 +281,8 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index caf087f35e..9b70b290a9 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -166,15 +166,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 3984620567..7a016831c3 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -139,15 +139,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index 918c76f0b6..cb11cdb772 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -165,11 +165,8 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); } } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 0e724cb04e..626ed46787 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -127,11 +127,8 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); } } } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 7e5b6ccbb6..1e36ba89e4 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -201,15 +201,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 2, 1, 2); } } } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index 23fe7877e6..e7c160b5d8 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -139,15 +139,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index ade6f8e031..1e7d63a62a 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -235,15 +235,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 04ab9247a6..b872bba02a 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -280,15 +280,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index e8f6cfc624..d09d79a452 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -132,14 +132,8 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); } } } diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 69e8bc6c7a..3e1006dd62 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -120,18 +120,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - if (Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (CalamityWorld.downedAstrageldon && Main.rand.NextBool(7)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index 660458a01d..9a68f4b1e5 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -98,11 +98,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(5, 10)); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 9); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index c2f850bc6d..1b2a37da19 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -219,11 +219,8 @@ namespace CalamityMod.NPCs.SunkenSea } public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(8, 13)); - if (Main.rand.NextBool(2) && Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 8, 12); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 0.5f); } } } diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index eb1217ba61..3cb89292a7 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -136,10 +136,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - if (CalamityWorld.downedDesertScourge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 4)); - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 1, 1, 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs index c084e3269b..a65b0aee2d 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -272,10 +272,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - if (Main.rand.NextBool(4)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); } public override void HitEffect(int hitDirection, double damage)