added an riv drophelper method

This commit is contained in:
termigator1359 committed 2020-05-10 14:16:20 -04:00
1 parent a3c11ac5aa
commit 10ac2cd847
6 files changed
+31 -57

No files matched your search

+1 -7
View File
@@ -675,13 +675,7 @@ namespace CalamityMod.NPCs.Abyss
DropHelper.DropItemCondition(npc, ModContent.ItemType<DeepSeaDumbbell>(), CalamityWorld.downedPolterghast, 3, 1, 1);
if (CalamityWorld.downedPolterghast)
{
float f = Main.rand.NextFloat();
bool replaceWithRare = f <= 0.01f; // 1/100 chance overall of getting The Reaper
if (f <= 0.3333f) // 1/3 chance of getting Valediction OR The Reaper replacing it
{
DropHelper.DropItemCondition(npc, ModContent.ItemType<Valediction>(), !replaceWithRare);
DropHelper.DropItemCondition(npc, ModContent.ItemType<TheReaper>(), replaceWithRare);
}
DropHelper.DropItemRIV(npc, ModContent.ItemType<Valediction>(), ModContent.ItemType<TheReaper>(), 0.3333f, 0.01f);
}
}
+4 -25
View File
@@ -1414,14 +1414,7 @@ namespace CalamityMod.NPCs
break;
case NPCID.GiantTortoise:
float tortoiseDropRate = Main.expertMode ? 0.2f : 0.142857f;
float shellRoll = Main.rand.NextFloat();
bool fabledShell = shellRoll <= 0.005f; // Exact 1/200 chance for rare regardless of difficulty
if (shellRoll < tortoiseDropRate) // 1/7 (1/5 EX) chance of getting Giant Tortoise Shell OR Fabled Tortoise Shell replacing it
{
DropHelper.DropItemCondition(npc, ModContent.ItemType<GiantTortoiseShell>(), !fabledShell);
DropHelper.DropItemCondition(npc, ModContent.ItemType<FabledTortoiseShell>(), fabledShell);
}
DropHelper.DropItemRIV(npc, ModContent.ItemType<GiantTortoiseShell>(), ModContent.ItemType<FabledTortoiseShell>(), Main.expertMode ? 0.2f : 0.142857f, 0.005f);
break;
case NPCID.GiantShelly:
@@ -1477,18 +1470,11 @@ namespace CalamityMod.NPCs
break;
case NPCID.IchorSticker:
float spearDropRate = Main.expertMode ? 0.05f : 0.04f;
float spearRoll = Main.rand.NextFloat();
bool spearOfDestiny = spearRoll <= 0.005f; // Exact 1/200 chance for rare regardless of difficulty
if (spearRoll < spearDropRate) // 1/25 (1/20 EX) chance of getting Ichor Spear OR Spear of Destiny replacing it
{
DropHelper.DropItemCondition(npc, ModContent.ItemType<IchorSpear>(), !spearOfDestiny);
DropHelper.DropItemCondition(npc, ModContent.ItemType<SpearofDestiny>(), spearOfDestiny);
}
DropHelper.DropItemRIV(npc, ModContent.ItemType<IchorSpear>(), ModContent.ItemType<SpearofDestiny>(), Main.expertMode ? 0.05f : 0.04f, 0.005f);
break;
case NPCID.Harpy:
int glazeDropRate = CalamityWorld.defiled ? 20 : Main.expertMode ? 60 : 80;
int glazeDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 60 : 80;
DropHelper.DropItemCondition(npc, ModContent.ItemType<SkyGlaze>(), NPC.downedBoss1, glazeDropRate, 1, 1);
DropHelper.DropItemCondition(npc, ModContent.ItemType<EssenceofCinder>(), Main.hardMode && !npc.SpawnedFromStatue, Main.expertMode ? 2 : 3, 1, 1);
break;
@@ -1536,14 +1522,7 @@ namespace CalamityMod.NPCs
break;
case NPCID.PirateCrossbower:
float crossbowDropRate = Main.expertMode ? 0.05f : 0.04f;
float arbalestRoll = Main.rand.NextFloat();
bool arbalest = arbalestRoll <= 0.005f; // Exact 1/200 chance for rare regardless of difficulty
if (arbalestRoll < crossbowDropRate) // 1/25 (1/20 EX) chance of getting Raider's Glory OR Arbalest replacing it
{
DropHelper.DropItemCondition(npc, ModContent.ItemType<RaidersGlory>(), !arbalest);
DropHelper.DropItemCondition(npc, ModContent.ItemType<Arbalest>(), arbalest);
}
DropHelper.DropItemRIV(npc, ModContent.ItemType<RaidersGlory>(), ModContent.ItemType<Arbalest>(), Main.expertMode ? 0.05f : 0.04f, 0.005f);
break;
case NPCID.GoblinSummoner:
+1 -7
View File
@@ -139,13 +139,7 @@ namespace CalamityMod.NPCs.CeaselessVoid
DropHelper.DropItemChance(npc, ModContent.ItemType<MirrorBlade>(), Main.expertMode ? 3 : 4);
// Equipment
float f = Main.rand.NextFloat();
bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance overall of getting The Evolution
if (f < 0.2f) // 1/5 chance of getting Arcanum of the Void OR The Evolution replacing it
{
DropHelper.DropItemCondition(npc, ModContent.ItemType<ArcanumoftheVoid>(), !replaceWithRare);
DropHelper.DropItemCondition(npc, ModContent.ItemType<TheEvolution>(), replaceWithRare);
}
DropHelper.DropItemRIV(npc, ModContent.ItemType<ArcanumoftheVoid>(), ModContent.ItemType<TheEvolution>(), 0.2f, DropHelper.RareVariantDropRateFloat);
// Vanity
DropHelper.DropItemChance(npc, ModContent.ItemType<CeaselessVoidTrophy>(), 10);
+5 -11
View File
@@ -295,17 +295,11 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void NPCLoot()
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(1, 4));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(1, 4));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(1, 4));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<VictoryShard>(), Main.rand.Next(1, 4));
if (Main.rand.NextBool(4))
{
if (Main.rand.NextBool(25))
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<TheTransformer>());
else
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<AmidiasSpark>());
}
DropHelper.DropItem(npc, ItemID.Coral, 1, 3);
DropHelper.DropItem(npc, ItemID.Starfish, 1, 3);
DropHelper.DropItem(npc, ItemID.Seashell, 1, 3);
DropHelper.DropItem(npc, ModContent.ItemType<VictoryShard>(), 1, 3);
DropHelper.DropItemRIV(npc, ModContent.ItemType<AmidiasSpark>(), ModContent.ItemType<TheTransformer>(), 0.25f, 0.01f);
}
}
}
+1 -7
View File
@@ -769,13 +769,7 @@ namespace CalamityMod.NPCs.Signus
// Weapons
DropHelper.DropItemChance(npc, ModContent.ItemType<CosmicKunai>(), Main.expertMode ? 3 : 4);
float f = Main.rand.NextFloat();
bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance overall of getting Guidelight of Oblivion
if (f <= (Main.expertMode ? 0.3333f : 0.25f)) // 1/3 (1/4 in normal) chance of getting Cosmilamp OR Guidelight of Oblivion replacing it
{
DropHelper.DropItemCondition(npc, ModContent.ItemType<Cosmilamp>(), !replaceWithRare);
DropHelper.DropItemCondition(npc, ModContent.ItemType<LanternoftheSoul>(), replaceWithRare);
}
DropHelper.DropItemRIV(npc, ModContent.ItemType<Cosmilamp>(), ModContent.ItemType<LanternoftheSoul>(), Main.expertMode ? 0.3333f : 0.25f, DropHelper.RareVariantDropRateFloat);
//Equipment
DropHelper.DropItemCondition(npc, ModContent.ItemType<SpectralVeil>(), CalamityWorld.revenge, 4, 1, 1);
+19
View File
@@ -231,6 +231,25 @@ namespace CalamityMod
return dropped;
}
/// <summary>
/// Drops an item that can be replaced by a given RIV
/// </summary>
/// <param name="npc">The NPC which should drop the item(s).</param>
/// <param name="itemID">The ID of the normal item to drop.</param>
/// <param name="rareID">The ID of the RIV to drop.</param>
/// <param name="itemChance">The chance that one of the two will drop. A decimal number <= 1.0.</param>
/// <param name="rareChance">The chance that the RIV will drop. A decimal number <= 1.0.</param>
public static void DropItemRIV(NPC npc, int itemID, int rareID, float itemChance, float rareChance)
{
float f = Main.rand.NextFloat();
bool replaceWithRare = f <= rareChance; // 1/X chance overall of getting RIV
if (f <= itemChance) // 1/X chance of getting original OR the RIV replacing it
{
DropItemCondition(npc, itemID, !replaceWithRare);
DropItemCondition(npc, rareID, replaceWithRare);
}
}
#endregion
#region NPC Item Drops 100% Chance