This repository has been archived on 2024-12-27. You can view files and clone it, but cannot push or open issues or pull requests.
continuity/Content/PlanteraOverrides.cs

65 lines
2.4 KiB
C#

using System;
using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.ItemDropRules;
using Continuity.Content.Items;
namespace Continuity.Content
{
public class PlanteraDrops : GlobalNPC
{
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
{
if (npc.type == NPCID.Plantera)
{
LeadingConditionRule notExpertRule = new LeadingConditionRule(new Conditions.NotExpert());
notExpertRule.OnSuccess(ItemDropRule.Common(ModContent.ItemType<PalishadeTissue>(), 1, 10, 35));
npcLoot.Add(notExpertRule);
}
}
}
[JITWhenModsEnabled("CalamityMod")]
public class PlanteraBossBag : GlobalItem
{
public override void ModifyItemLoot(Item item, ItemLoot itemLoot)
{
if (item.type == ItemID.PlanteraBossBag)
{
itemLoot.Add(ItemDropRule.Common(ModContent.ItemType<PalishadeTissue>(), 1, 25, 35));
itemLoot.RemoveWhere(rule => rule is CommonDrop drop
&& drop.itemId == ItemID.TempleKey);
foreach (var rule in itemLoot.Get())
{
itemLoot.RemoveWhere(rule => rule is OneFromRulesRule);
if (ModLoader.HasMod("CalamityMod"))
{
itemLoot.RemoveWhere(rule => rule is CalamityMod.DropHelper.AllOptionsAtOnceWithPityDropRule);
if (ModLoader.TryGetMod("CalamityMod", out Mod calamityMod) && calamityMod.TryFind<ModItem>("BlossomFlux", out ModItem BlossomFlux)) {
itemLoot.RemoveWhere(rule => rule is CommonDrop drop
&& drop.itemId == BlossomFlux.Type);
}
} else {
short[] toRemove = {
ItemID.TheAxe,
ItemID.PygmyStaff,
ItemID.Seedling,
ItemID.ThornHook,
};
foreach (var i in toRemove)
{
itemLoot.RemoveWhere(rule => rule is CommonDropNotScalingWithLuck drop
&& drop.itemId == i);
}
}
}
}
}
}
}