From cb3e5e07e2c4ba26235caec51ea2bae21ec18666 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:50:16 +0200 Subject: [PATCH] BossHPScaling. --- CalamityLists.cs | 93 -------------- ModSupport/ModCalls.cs | 5 +- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/BossHPScalingList.cs | 152 +++++++++++++++++++++++ 4 files changed, 156 insertions(+), 96 deletions(-) create mode 100644 Systems/Collections/BossHPScalingList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 7aefb9ee59..69f83451f9 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -50,7 +50,6 @@ using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; @@ -78,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List bossHPScaleList; public static List friendlyBeeList; public static List debuffList; public static List fireDebuffList; @@ -157,93 +155,6 @@ namespace CalamityMod public override void OnModLoad() { - bossHPScaleList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - }; - //Many more are added later with AddRange - friendlyBeeList = new List() { ProjectileID.GiantBee, @@ -1118,7 +1029,6 @@ namespace CalamityMod NPCType(), NPCType() }; - bossHPScaleList.AddRange(PerforatorIDs); DesertScourgeIDs = new List { @@ -1142,7 +1052,6 @@ namespace CalamityMod NPCType(), NPCType() }; - bossHPScaleList.AddRange(SlimeGodIDs); DeathModeSplittingWormIDs = new List { @@ -1208,7 +1117,6 @@ namespace CalamityMod NPCType(), NPCType() }; - bossHPScaleList.AddRange(RavagerIDs); GolemIDs = new List { @@ -1763,7 +1671,6 @@ namespace CalamityMod public override void Unload() { - bossHPScaleList = null; friendlyBeeList = null; debuffList = null; fireDebuffList = null; diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index d154133dee..a7b2391163 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -7,6 +7,7 @@ using CalamityMod.Items; using CalamityMod.NPCs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.UI.DraedonSummoning; @@ -1076,9 +1077,9 @@ namespace CalamityMod //This is to add minions to the hp scaling config public static bool AddToHPScaling(int type) { - if (!CalamityLists.bossHPScaleList.Contains(type)) + if (!BossHPScalingList.List.Contains(type)) { - CalamityLists.bossHPScaleList.Add(type); + BossHPScalingList.List.Add(type); return true; } return false; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bcea7c100a..e0e536f399 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3523,7 +3523,7 @@ namespace CalamityMod.NPCs return; bool countsAsBoss = npc.boss || NPCID.Sets.ShouldBeCountedAsBoss[npc.type]; - bool scalesLikeBoss = countsAsBoss || CalamityLists.bossHPScaleList.Contains(npc.type); + bool scalesLikeBoss = countsAsBoss || BossHPScalingList.List.Contains(npc.type); bool isCalamityNPC = npc.ModNPC != null && npc.ModNPC.Mod == CalamityMod.Instance; // All bosses, NPCs that are supposed to scale like bosses, and Calamity NPCs follow these rules. diff --git a/Systems/Collections/BossHPScalingList.cs b/Systems/Collections/BossHPScalingList.cs new file mode 100644 index 0000000000..cfab279a8a --- /dev/null +++ b/Systems/Collections/BossHPScalingList.cs @@ -0,0 +1,152 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all NPC IDs of bosses or boss minions that have HP scaling. + /// + public sealed class BossHPScalingList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.SkeletronHand, + NPCID.WallofFleshEye, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.PrimeSaw, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + } +}