From 48eee51b79fbbfcf5f79fbb3846c8b63d9c8f08d Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 4 Jun 2022 01:44:51 -0500 Subject: [PATCH] Fixed Deus loot duplication --- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 4c5f0cd135..572959a63f 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -86,8 +86,8 @@ namespace CalamityMod.NPCs.AstrumDeus //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.AstralSurface, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("The fragments of the star god’s corpse still hold some of their former power, and even after succumbing to a dark infection, then being torn apart by an upstart worm, they willfully seek to return to the stars.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("The fragments of the star god’s corpse still hold some of their former power, and even after succumbing to a dark infection, then being torn apart by an upstart worm, they willfully seek to return to the stars.") }); } @@ -228,11 +228,11 @@ namespace CalamityMod.NPCs.AstrumDeus public override void BossLoot(ref string name, ref int potionType) => potionType = ModContent.ItemType(); - public bool ShouldNotDropThings() => NPC.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && NPC.Calamity().newAI[0] != 3f); + public static bool ShouldNotDropThings(NPC npc) => npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f); public override bool SpecialOnKill() { - if (ShouldNotDropThings()) + if (ShouldNotDropThings(NPC)) return false; int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, @@ -246,7 +246,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void OnKill() { - if (ShouldNotDropThings()) + if (ShouldNotDropThings(NPC)) return; // Killing ANY split Deus makes all other Deus heads die immediately. @@ -280,10 +280,12 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + var lastWorm = npcLoot.DefineConditionalDropSet(info => !ShouldNotDropThings(info.npc)); + lastWorm.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Normal drops: Everything that would otherwise be in the bag - var normalOnly = npcLoot.DefineNormalOnlyDropSet(); + var normalOnly = new LeadingConditionRule(new Conditions.NotExpert()); + lastWorm.Add(normalOnly); { // Weapons int[] weapons = new int[] @@ -316,7 +318,7 @@ namespace CalamityMod.NPCs.AstrumDeus npcLoot.Add(DropHelper.NormalVsExpertQuantity(ItemID.FragmentStardust, 1, 16, 24, 20, 32)); // Lore - bool firstDeusKill() => !DownedBossSystem.downedAstrumDeus; + bool firstDeusKill(DropAttemptInfo info) => !DownedBossSystem.downedAstrumDeus && !ShouldNotDropThings(info.npc); npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType()); npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType()); }