From 86dc4cf67ef9cf763e6eefaf395821d65cbfa574 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 9 Sep 2022 21:55:33 -0400 Subject: [PATCH] Calamity Relics now only show in the Bestiary in Master/Rev --- NPCs/AcidRain/CragmawMire.cs | 2 +- NPCs/AcidRain/Mauler.cs | 2 +- NPCs/AcidRain/NuclearTerror.cs | 2 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 2 +- NPCs/AstrumAureus/AstrumAureus.cs | 2 +- NPCs/AstrumDeus/AstrumDeusHead.cs | 3 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 2 +- NPCs/Bumblebirb/Bumblefuck.cs | 2 +- NPCs/Calamitas/CalamitasClone.cs | 2 +- NPCs/CeaselessVoid/CeaselessVoid.cs | 2 +- NPCs/Crabulon/Crabulon.cs | 2 +- NPCs/Cryogen/Cryogen.cs | 2 +- NPCs/DesertScourge/DesertScourgeHead.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 2 +- NPCs/ExoMechs/Ares/AresBody.cs | 2 +- NPCs/GreatSandShark/GreatSandShark.cs | 2 +- NPCs/HiveMind/HiveMind.cs | 2 +- NPCs/Leviathan/Leviathan.cs | 2 +- NPCs/OldDuke/OldDuke.cs | 2 +- NPCs/Perforator/PerforatorHive.cs | 2 +- .../PlaguebringerGoliath.cs | 2 +- NPCs/Polterghast/Polterghast.cs | 2 +- .../ProfanedGuardianCommander.cs | 2 +- NPCs/Providence/Providence.cs | 2 +- NPCs/Ravager/RavagerBody.cs | 2 +- NPCs/Signus/Signus.cs | 2 +- NPCs/SlimeGod/SlimeGodCore.cs | 2 +- NPCs/StormWeaver/StormWeaverHead.cs | 2 +- NPCs/SunkenSea/GiantClam.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 2 +- NPCs/Yharon/Yharon.cs | 2 +- Utilities/DropHelper.cs | 32 +++++++++++++++++++ 32 files changed, 63 insertions(+), 32 deletions(-) diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index a2d474c8da..f4c5e4a0ff 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -510,7 +510,7 @@ namespace CalamityMod.NPCs.AcidRain postPolter.AddFail(ModContent.ItemType(), hideLootReport: DownedBossSystem.downedPolterghast); npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 11d7595f23..136b6db703 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -452,7 +452,7 @@ namespace CalamityMod.NPCs.AcidRain npcLoot.Add(ItemID.SharkFin, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index b4184720c8..a7330ec9ef 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -525,7 +525,7 @@ namespace CalamityMod.NPCs.AcidRain npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index c7601fcdcf..8e630cf744 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -248,7 +248,7 @@ namespace CalamityMod.NPCs.AquaticScourge npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore bool firstASKill() => !DownedBossSystem.downedAquaticScourge; diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 6b40c3553e..af7fb9c0aa 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -361,7 +361,7 @@ namespace CalamityMod.NPCs.AstrumAureus npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index cc0551fe4f..aee14ba70c 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -322,8 +322,7 @@ namespace CalamityMod.NPCs.AstrumDeus lastWorm.Add(ModContent.ItemType(), 10); // Relic - bool shouldDropRelic(DropAttemptInfo info) => (CalamityWorld.revenge || Main.masterMode) && !ShouldNotDropThings(info.npc); - npcLoot.AddIf(shouldDropRelic, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf((info) => !ShouldNotDropThings(info.npc), ModContent.ItemType()); // Fragments lastWorm.Add(DropHelper.NormalVsExpertQuantity(ItemID.FragmentSolar, 1, 16, 24, 20, 32)); diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index a6b10f619e..24c5a13125 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 2352eab527..efda3e49c4 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -438,7 +438,7 @@ namespace CalamityMod.NPCs.Bumblebirb npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Calamitas/CalamitasClone.cs b/NPCs/Calamitas/CalamitasClone.cs index d4688458b7..8dc233c6dc 100644 --- a/NPCs/Calamitas/CalamitasClone.cs +++ b/NPCs/Calamitas/CalamitasClone.cs @@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.Calamitas npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitas, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 4688546c3a..eb042832a4 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -225,7 +225,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 7b901219ea..1f9491ffa0 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -835,7 +835,7 @@ namespace CalamityMod.NPCs.Crabulon npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCrabulon, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 78644d1118..c0bfe3f49c 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1184,7 +1184,7 @@ namespace CalamityMod.NPCs.Cryogen npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCryogen, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index fd7539bbd6..7a29cc7adb 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -727,7 +727,7 @@ namespace CalamityMod.NPCs.DesertScourge npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDesertScourge, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 728a91af8e..bbb3621966 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -2399,7 +2399,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Trophy (always directly from boss, never in bag) npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index a6bd5acac4..5222e1a8b5 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1346,7 +1346,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType()), ModContent.ItemType())); // Relic - mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(() => Main.masterMode || CalamityWorld.revenge), ModContent.ItemType())); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf(CanDropLoot, ModContent.ItemType()); // Lore item mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(() => !DownedBossSystem.downedExoMechs, desc: DropHelper.FirstKillText), ModContent.ItemType())); diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 4aceb2b677..6819585f38 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -639,7 +639,7 @@ namespace CalamityMod.NPCs.GreatSandShark npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } public override void OnKill() diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index f691a0de1d..c13bab4306 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1163,7 +1163,7 @@ namespace CalamityMod.NPCs.HiveMind npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedHiveMind, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index eea5e6e7f7..0f3a5dc94c 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -800,7 +800,7 @@ namespace CalamityMod.NPCs.Leviathan } // Relic - npcLoot.AddIf(() => (Main.masterMode || CalamityWorld.revenge) && LastAnLStanding(), ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf((info) => LastAnLStanding(), ModContent.ItemType()); // Lore bool shouldDropLore(DropAttemptInfo info) => !DownedBossSystem.downedLeviathan && LastAnLStanding(); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 283206a050..ce78d06e5b 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -447,7 +447,7 @@ namespace CalamityMod.NPCs.OldDuke npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBoomerDuke, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index d8965002fb..53dae86623 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -541,7 +541,7 @@ namespace CalamityMod.NPCs.Perforator npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPerforator, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 8cf5c053db..5de143f425 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1279,7 +1279,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPlaguebringer, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 03b0aa7036..b27dcfa5fe 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1048,7 +1048,7 @@ namespace CalamityMod.NPCs.Polterghast npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index c8167da97c..15179aafbc 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -512,7 +512,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npcLoot.Add(ModContent.ItemType()); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedGuardians, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index f73a9726b5..5141294361 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1603,7 +1603,7 @@ namespace CalamityMod.NPCs.Providence npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 11d77fa9f1..496bff3615 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -881,7 +881,7 @@ namespace CalamityMod.NPCs.Ravager npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedRavager, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 147f01b668..6deb33bdaf 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -805,7 +805,7 @@ namespace CalamityMod.NPCs.Signus npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 150ea3b5cb..80dc1f897e 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -604,7 +604,7 @@ namespace CalamityMod.NPCs.SlimeGod npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSlimeGod, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 5a0041c949..a5830b9403 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -980,7 +980,7 @@ namespace CalamityMod.NPCs.StormWeaver npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 9850377ac2..d7ff09e973 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -474,7 +474,7 @@ namespace CalamityMod.NPCs.SunkenSea npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 554ae83eb2..916a7f778a 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2599,7 +2599,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSCal, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index ad5116922c..5ae6fb5172 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2841,7 +2841,7 @@ namespace CalamityMod.NPCs.Yharon npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedYharon, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 18ce81a43c..fef4dc5ebf 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -9,6 +9,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent.ItemDropRules; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using Terraria.Utilities; @@ -390,6 +391,24 @@ namespace CalamityMod public string GetConditionDescription() => description; } + internal class LambdaDropRuleCondition3 : IItemDropRuleCondition + { + private readonly Func conditionLambda; + private readonly Func visibleInUI; + private readonly Func description; + + internal LambdaDropRuleCondition3(Func lambda, Func ui, Func desc) + { + conditionLambda = lambda; + visibleInUI = ui; + description = desc; + } + + public bool CanDrop(DropAttemptInfo info) => conditionLambda(info); + public bool CanShowItemDropInUI() => visibleInUI(); + public string GetConditionDescription() => description(); + } + /// /// Creates a new LambdaDropRuleCondition which executes the code of your choosing to decide whether this item drop should occur.
/// This version of "If" does NOT use the DropAttemptInfo struct that is available.
@@ -418,6 +437,11 @@ namespace CalamityMod bool LambdaInfoWrapper(DropAttemptInfo _) => lambda(); return new LambdaDropRuleCondition2(LambdaInfoWrapper, ui, desc); } + public static IItemDropRuleCondition If(Func lambda, Func ui, Func desc) + { + bool LambdaInfoWrapper(DropAttemptInfo _) => lambda(); + return new LambdaDropRuleCondition3(LambdaInfoWrapper, ui, desc); + } /// /// Creates a new LambdaDropRuleCondition which executes the code of your choosing to decide whether this item drop should occur.
@@ -443,6 +467,10 @@ namespace CalamityMod { return new LambdaDropRuleCondition2(lambda, ui, desc); } + public static IItemDropRuleCondition If(Func lambda, Func ui, Func desc) + { + return new LambdaDropRuleCondition3(lambda, ui, desc); + } #endregion #region Drop Rule Conditions @@ -571,6 +599,10 @@ namespace CalamityMod public static IItemDropRuleCondition TrasherText = If((info) => true, true, "Drops if fed to a Trasher"); public static IItemDropRuleCondition RevNoMaster = If((info) => !Main.masterMode && CalamityWorld.revenge, () => !Main.masterMode && CalamityWorld.revenge, "This is a Revengeance Mode drop rate"); + public static IItemDropRuleCondition RevAndMaster = If((info) => Main.masterMode || CalamityWorld.revenge, () => Main.masterMode || CalamityWorld.revenge, () => + { + return Main.masterMode ? Language.GetTextValue("Bestiary_ItemDropConditions.IsMasterMode") : "This is a Revengeance Mode drop rate"; + }); #region Boss Defeat Conditionals public static IItemDropRuleCondition PostKS(bool ui = true) => If(() => NPC.downedSlimeKing, ui, "Drops after defeating King Slime");