From 6665cd5465aba8b554e8024d3f211ab20a68bf7a Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 23:03:07 +0900 Subject: [PATCH] NeedsDebuffIconDisplayList. --- CalamityLists.cs | 9 ------ NPCs/CalamityGlobalNPC.cs | 2 +- .../Collections/NeedsDebuffIconDisplayList.cs | 29 +++++++++++++++++++ 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 Systems/Collections/NeedsDebuffIconDisplayList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 14646da047..d599816cf4 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List needsDebuffIconDisplayList; public static List scopedWeaponList; public static List highTestFishList; public static List forceItemList; @@ -144,13 +143,6 @@ namespace CalamityMod public override void OnModLoad() { - needsDebuffIconDisplayList = new List() - { - NPCID.TargetDummy, - NPCID.WallofFleshEye, - NPCType() - }; - // TODO -- override HoldItem => Player.accFishingLine = true; on these items, just like the scope fix... highTestFishList = new List() { @@ -1397,7 +1389,6 @@ namespace CalamityMod public override void Unload() { - needsDebuffIconDisplayList = null; scopedWeaponList = null; highTestFishList = null; forceItemList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 79b76a20c8..aac0c4938f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -7277,7 +7277,7 @@ namespace CalamityMod.NPCs } if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { - if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type))) + if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || NeedsDebuffIconDisplayList.IsNPCNeedDebuffIconDisplay(npc))) { List currentDebuffs = new List() { }; diff --git a/Systems/Collections/NeedsDebuffIconDisplayList.cs b/Systems/Collections/NeedsDebuffIconDisplayList.cs new file mode 100644 index 0000000000..fe1c0f9e75 --- /dev/null +++ b/Systems/Collections/NeedsDebuffIconDisplayList.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class NeedsDebuffIconDisplayList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.TargetDummy, + NPCID.WallofFleshEye, + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool IsNPCNeedDebuffIconDisplay(NPC npc) => List.Contains(npc.type); + } +}