public override void ModifyGlobalLoot(GlobalLoot globalLoot) { if (NPC.downedMoonlord) { globalLoot.Add(ItemDropRule.Common(ModContent.ItemType <Items.LootBag5>(), Amounts.tierFiveChance)); } else if (NPC.downedPlantBoss) { globalLoot.Add(ItemDropRule.Common(ModContent.ItemType <Items.LootBag4>(), Amounts.tierFourChance)); } else if (Main.hardMode) { globalLoot.Add(ItemDropRule.Common(ModContent.ItemType <Items.LootBag3>(), Amounts.tierThreeChance)); } else if (NPC.downedBoss3) { globalLoot.Add(ItemDropRule.Common(ModContent.ItemType <Items.LootBag2>(), Amounts.tierTwoChance)); } else { globalLoot.Add(ItemDropRule.Common(ModContent.ItemType <Items.LootBag1>(), Amounts.tierOneChance)); } }
internal static void GlobalExpertGetsRerolls(GlobalLoot globalLoot, int itemId, int chanceDenominator = 1, int minimumDropped = 1, int maximumDropped = 1, int chanceNumerator = 1, IItemDropRule ruleExpert = null, IItemDropRule ruleNormal = null) { IItemDropRule expertRule = new LeadingConditionRule(new Conditions.IsExpert()); IItemDropRule ruleToAdd = expertRule; if (ruleExpert != null) { ruleToAdd = ruleExpert; //If a rule is specified, use that to add it (Always add the "baseline" rule first) expertRule = ruleToAdd.OnSuccess(expertRule); } expertRule.OnSuccess(new CommonDropWithReroll(itemId, chanceDenominator, minimumDropped, maximumDropped, chanceNumerator)); globalLoot.Add(ruleToAdd); IItemDropRule notExpertRule = new LeadingConditionRule(new Conditions.NotExpert()); ruleToAdd = notExpertRule; if (ruleNormal != null) { ruleToAdd = ruleNormal; notExpertRule = ruleToAdd.OnSuccess(notExpertRule); } notExpertRule.OnSuccess(new CommonDrop(itemId, chanceDenominator, minimumDropped, maximumDropped, chanceNumerator)); globalLoot.Add(ruleToAdd); }
//ModifyGlobalLoot allows you to modify loot that every NPC should be able to drop, preferably with a condition. //Vanilla uses this for the biome keys, souls of night/light, as well as the holiday drops. //Any drop rules in ModifyGlobalLoot should only run once. Everything else should go in ModifyNPCLoot. public override void ModifyGlobalLoot(GlobalLoot globalLoot) { globalLoot.Add(ItemDropRule.ByCondition(new Conditions.IsMasterMode(), ModContent.ItemType <ExampleSoul>(), 5, 1, 1)); //If the world is in master mode, drop ExampleSouls 20% of the time from every npc. //TODO: Make it so it only drops from enemies in ExampleBiome when that gets made. }