ID set stuff, TestingEfficiency crossmod support

This commit is contained in:
Doze-Zoze committed 2026-06-08 21:31:08 -05:00
1 parent 6a66b18023
commit 8f6c729ffc
14 files changed
+472 -141

No files matched your search

+46 -14
View File
@@ -1,7 +1,6 @@
using System;
using CalamityMod.Buffs.Alcohol;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Accessories;
using CalamityMod.Systems.Collections;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
@@ -157,8 +156,8 @@ namespace CalamityMod.DataStructures
public static StatModifier ApplyScalingToStatModifer(StatModifier Modifer, float scaling)
{
StatModifier output = new();
output += (Modifer.Additive-1) * scaling;
output *= 1 + (Modifer.Multiplicative-1) * scaling;
output += (Modifer.Additive - 1) * scaling;
output *= 1 + (Modifer.Multiplicative - 1) * scaling;
output.Base = Modifer.Base * scaling;
output.Flat = Modifer.Flat * scaling;
return output;
@@ -172,9 +171,9 @@ namespace CalamityMod.DataStructures
public static StatModifier ForceModifierPositiveWithScaling(StatModifier Modifer, float scaling)
{
StatModifier output = new();
output += MathHelper.Max((Modifer.Additive - 1) * scaling,0);
output *= MathHelper.Max(1 + (Modifer.Multiplicative - 1) * scaling,1);
output.Base = MathHelper.Max(Modifer.Base * scaling,0);
output += MathHelper.Max((Modifer.Additive - 1) * scaling, 0);
output *= MathHelper.Max(1 + (Modifer.Multiplicative - 1) * scaling, 1);
output.Base = MathHelper.Max(Modifer.Base * scaling, 0);
output.Flat = MathHelper.Max(Modifer.Flat * scaling, 0);
return output;
}
@@ -185,7 +184,7 @@ namespace CalamityMod.DataStructures
/// </summary>
public void DefaultUpdateOnPlayer(Player player, int buffType, ref int buffIndex, ref int damage)
{
}
/// <summary>
@@ -210,13 +209,13 @@ namespace CalamityMod.DataStructures
//Ensure at least 25% effectiveness
if (totalScaling.Multiplicative <= 0.25f)
totalScaling.Multiplicative = 0.25f;
totalScaling.Multiplicative = 0.25f;
if (totalScaling.Additive < 0.25f)
totalScaling.Additive = 0.25f;
totalDPS = totalScaling.ApplyTo(totalDPS);
var totalDPSAdjusted = totalDPS-EnemyVanillaRegenToCancelOut;
npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(totalDPS*MultiplierDamageTickSize,MinimumDamageTickSize), ref npc.lifeRegen, ref damage);
var totalDPSAdjusted = totalDPS - EnemyVanillaRegenToCancelOut;
npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(totalDPS * MultiplierDamageTickSize, MinimumDamageTickSize), ref npc.lifeRegen, ref damage);
}
/// <summary>
/// DoT functionality that takes into account Electric debuff's 4x DPS when moving
@@ -278,7 +277,7 @@ namespace CalamityMod.DataStructures
// If there are no Daybreak impaled spears, Daybroken has 1x potency (it was applied some other way)
int adjustedSpears = Math.Max(1, numImpaledSpears);
int baseDaybreakDoTValue = (int)(npc.Calamity().ActiveHeatDebuffMultiplier.ApplyTo(Daybroken.EnemyLostRegen) + (Daybroken.EnemyLostRegen * (adjustedSpears - 1)));
int totalDPSAdjusted = baseDaybreakDoTValue - Daybroken.EnemyVanillaRegenToCancelOut*numImpaledSpears;
int totalDPSAdjusted = baseDaybreakDoTValue - Daybroken.EnemyVanillaRegenToCancelOut * numImpaledSpears;
if (numImpaledSpears == 0)
{
totalDPSAdjusted -= Daybroken.EnemyVanillaRegenToCancelOut;
@@ -291,10 +290,10 @@ namespace CalamityMod.DataStructures
public static void OiledNPCMethod(NPC npc, int buffType, ref int buffIndex, ref int damage)
{
var cnpc = npc.Calamity();
double totalDPS = ApplyScalingToStatModifer(cnpc.ActiveHeatDebuffMultiplier,Oiled.HeatDebuffScaling).ApplyTo(Oiled.EnemyLostRegen);
double totalDPS = ApplyScalingToStatModifer(cnpc.ActiveHeatDebuffMultiplier, Oiled.HeatDebuffScaling).ApplyTo(Oiled.EnemyLostRegen);
if (totalDPS <= 0)
return;
npc.Calamity().ApplyDPSDebuff((int)(totalDPS), damage+(int)Math.Max(totalDPS * Oiled.MultiplierDamageTickSize, Oiled.MinimumDamageTickSize), ref npc.lifeRegen, ref damage);
npc.Calamity().ApplyDPSDebuff((int)(totalDPS), damage + (int)Math.Max(totalDPS * Oiled.MultiplierDamageTickSize, Oiled.MinimumDamageTickSize), ref npc.lifeRegen, ref damage);
}
/// <summary>
/// Has Dryad's Bane scale with Calamity's town NPC buffs
@@ -419,5 +418,38 @@ namespace CalamityMod.DataStructures
NPCLifeRegenMethod = DryadsBaneNPCMethod
};
#endregion
#region Helpers
public static int GetDebuffRegenValue(NPC npc, int type)
{
var debuffData = CalamityBuffSets.DebuffDataset[type];
if (debuffData == null)
return 0;
var oldRegen = npc.lifeRegen;
var oldCount = npc.lifeRegenCount;
int dmg = 1;
npc.lifeRegenCount = 0;
npc.lifeRegen = 0;
int index = npc.FindBuffIndex(type);
if (debuffData == Oiled)
{
bool hasVanillaOil = npc.onFrostBurn || npc.onFrostBurn2 || npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame;
if (hasVanillaOil)
npc.lifeRegen -= Oiled.EnemyVanillaRegenToCancelOut;
Oiled.NPCLifeRegenMethod(npc, BuffID.Oiled, ref index, ref dmg);
}
debuffData.NPCLifeRegenMethod(npc, type, ref index, ref dmg);
int done = npc.lifeRegen;
npc.lifeRegen = oldRegen;
npc.lifeRegenCount = oldCount;
return done;
}
#endregion
}
}
+9
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.CalPlayer;
using CalamityMod.DataStructures;
using CalamityMod.Events;
using CalamityMod.NPCs;
using CalamityMod.NPCs.TownNPCs;
@@ -2256,6 +2257,14 @@ namespace CalamityMod
return new ArgumentException("ERROR: The first argument to \"AddToBossHPScalingConfig\" must be an int or short ID.");
return AddToHPScaling(npcType6);
}
case "GetDebuffDamage":
{
if (args.Length < 2)
return new ArgumentNullException("ERROR: Must specify an NPC and a buff type int");
if (args[1] is not NPC npc || args[2] is not int type)
return new ArgumentException("ERROR: The first argument to \"GetDebuffDamage\" must be an NPC, and the second must be an int.");
return DebuffData.GetDebuffRegenValue(npc, type);
}
default:
return new ArgumentException("ERROR: Invalid method name.");
}
+311
View File
@@ -0,0 +1,311 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.Items.SummonItems;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.AstrumDeus;
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.ExoMechs.Apollo;
using CalamityMod.NPCs.ExoMechs.Ares;
using CalamityMod.NPCs.ExoMechs.Artemis;
using CalamityMod.NPCs.ExoMechs.Thanatos;
using CalamityMod.NPCs.HiveMind;
using CalamityMod.NPCs.Leviathan;
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.StormWeaver;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.Yharon;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.ModSupport
{
//This uses its own class so the entire class can simply not load when TE is not enabled.
public class TestingEfficiencySupport : ModSystem
{
internal static Mod testingEfficiency = null;
public override bool IsLoadingEnabled(Mod mod)
{
testingEfficiency = null;
return ModLoader.TryGetMod("TestingEfficiency", out testingEfficiency);
}
List<(string name, float tier, Func<bool> getter, Action<bool> setter, Func<Asset<Texture2D>> texture)> BossTogles = new()
{
("Desert Scourge", 1.5f,
() => DownedBossSystem.downedDesertScourge,
x => DownedBossSystem.downedDesertScourge = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<DesertScourgeHead>()]]),
("Crabulon", 2.5f,
() => DownedBossSystem.downedCrabulon,
x => DownedBossSystem.downedCrabulon = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Crabulon>()]]),
("Hive Mind / Perforators", 3.5f,
() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator,
x => DownedBossSystem.downedHiveMind = DownedBossSystem.downedPerforator = x,
() => WorldGen.crimson
? TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<PerforatorHive>()]]
: TextureAssets.NpcHeadBoss[HiveMind.phase2IconIndex]),
("Slime God", 6.5f,
() => DownedBossSystem.downedSlimeGod,
x => DownedBossSystem.downedSlimeGod = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<SlimeGodCore>()]]),
("Cryogen", 8.5f,
() => DownedBossSystem.downedCryogen,
x => DownedBossSystem.downedCryogen = x,
() => TextureAssets.NpcHeadBoss[Cryogen.cryoIconIndex]),
("Aquatic Scourge", 9.25f,
() => DownedBossSystem.downedAquaticScourge,
x => DownedBossSystem.downedAquaticScourge = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AquaticScourgeHead>()]]),
("Brimstone Elemental", 10.25f,
() => DownedBossSystem.downedBrimstoneElemental,
x => DownedBossSystem.downedBrimstoneElemental = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<BrimstoneElemental>()]]),
("Calamitas Clone", 11.5f,
() => DownedBossSystem.downedCalamitasClone,
x => DownedBossSystem.downedCalamitasClone = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CalamitasClone>()]]),
("Leviathan & Anahita", 12.25f,
() => DownedBossSystem.downedLeviathan,
x => DownedBossSystem.downedLeviathan = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Leviathan>()]]),
("Astrum Aureus", 12.5f,
() => DownedBossSystem.downedAstrumAureus,
x => DownedBossSystem.downedAstrumAureus = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AstrumAureus>()]]),
("Plaguebringer Goliath", 14.25f,
() => DownedBossSystem.downedPlaguebringer,
x => DownedBossSystem.downedPlaguebringer = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<PlaguebringerGoliath>()]]),
("Ravager", 15.25f,
() => DownedBossSystem.downedRavager,
x => DownedBossSystem.downedRavager = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<RavagerBody>()]]),
("Astrum Deus", 16.5f,
() => DownedBossSystem.downedAstrumDeus,
x => DownedBossSystem.downedAstrumDeus = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AstrumDeusHead>()]]),
("Dragonfolly", 17.25f,
() => DownedBossSystem.downedDragonfolly,
x => DownedBossSystem.downedDragonfolly = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Dragonfolly>()]]),
("Profaned Guardians", 17.5f,
() => DownedBossSystem.downedGuardians,
x => DownedBossSystem.downedGuardians = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<ProfanedGuardianHealer>()]]),
("Providence", 18f,
() => DownedBossSystem.downedProvidence,
x => DownedBossSystem.downedProvidence = x,
() => TextureAssets.Item[ModContent.ItemType<ProfanedCore>()]),
("Ceaseless Void", 18.25f,
() => DownedBossSystem.downedCeaselessVoid,
x => DownedBossSystem.downedCeaselessVoid = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CeaselessVoid>()]]),
("Storm Weaver", 18.5f,
() => DownedBossSystem.downedStormWeaver,
x => DownedBossSystem.downedStormWeaver = x,
() => TextureAssets.NpcHeadBoss[StormWeaverHead.normalIconIndex]),
("Signus", 18.75f,
() => DownedBossSystem.downedSignus,
x => DownedBossSystem.downedSignus = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Signus>()]]),
("Polterghast", 19f,
() => DownedBossSystem.downedPolterghast,
x => DownedBossSystem.downedPolterghast = x,
() => TextureAssets.NpcHeadBoss[Polterghast.phase1IconIndex]),
("Old Duke", 19.5f,
() => DownedBossSystem.downedBoomerDuke,
x => DownedBossSystem.downedBoomerDuke = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<OldDuke>()]]),
("Devourer of Gods", 20f,
() => DownedBossSystem.downedDoG,
x => DownedBossSystem.downedDoG = x,
() => TextureAssets.NpcHeadBoss[DevourerofGodsHead.phase1IconIndex]),
("Yharon", 21f,
() => DownedBossSystem.downedYharon,
x => DownedBossSystem.downedYharon = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Yharon>()]]),
("Exo Mechs", 22f,
() => DownedBossSystem.downedExoMechs,
x => DownedBossSystem.downedExoMechs = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AresBody>()]]),
("Supreme Calamitas", 23f,
() => DownedBossSystem.downedCalamitas,
x => DownedBossSystem.downedCalamitas = x,
() => TextureAssets.NpcHeadBoss[SupremeCalamitas.hoodedHeadIconIndex]),
("Primordial Wyrm", 23.5f,
() => DownedBossSystem.downedPrimordialWyrm,
x => DownedBossSystem.downedPrimordialWyrm = x,
() => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<PrimordialWyrmHead>()]])
};
public override void PostSetupContent()
{
foreach (var item in BossTogles)
{
testingEfficiency.Call("RegisterBoss", item.name, item.tier, item.getter, item.setter, item.texture);
}
}
}
[ReinitializeDuringResizeArrays]
public class TestingEfficiencyIdSets
{
//These being set by Calamity is important so that boss reworks can update these on Cal's end in development
//Otherwise, reworks to bosses would often require their own build, similar to issues CalTestHelpers had before.
//Because these are ID sets, other mods that may be interested in similar info can also use them regardless of if TE is loaded
internal static int[] NpcToCountAs = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/NpcToCountAs")
.RegisterIntSet(-1,
ModContent.NPCType<DevourerofGodsBody>(), ModContent.NPCType<DevourerofGodsHead>(),
ModContent.NPCType<DevourerofGodsTail>(), ModContent.NPCType<DevourerofGodsHead>(),
ModContent.NPCType<DesertScourgeBody>(), ModContent.NPCType<DesertScourgeHead>(),
ModContent.NPCType<DesertScourgeTail>(), ModContent.NPCType<DesertScourgeHead>(),
ModContent.NPCType<AstrumDeusBody>(), ModContent.NPCType<AstrumDeusHead>(),
ModContent.NPCType<AstrumDeusTail>(), ModContent.NPCType<AstrumDeusHead>(),
ModContent.NPCType<AquaticScourgeBody>(), ModContent.NPCType<AquaticScourgeHead>(),
ModContent.NPCType<AquaticScourgeBodyAlt>(), ModContent.NPCType<AquaticScourgeHead>(),
ModContent.NPCType<AquaticScourgeTail>(), ModContent.NPCType<AquaticScourgeHead>(),
ModContent.NPCType<ThanatosBody1>(), ModContent.NPCType<ThanatosHead>(),
ModContent.NPCType<ThanatosBody2>(), ModContent.NPCType<ThanatosHead>(),
ModContent.NPCType<ThanatosTail>(), ModContent.NPCType<ThanatosHead>() ,
ModContent.NPCType<StormWeaverBody>(), ModContent.NPCType<StormWeaverHead>(),
ModContent.NPCType<StormWeaverTail>(), ModContent.NPCType<StormWeaverHead>(),
ModContent.NPCType<AresGaussNuke>(), ModContent.NPCType<AresBody>() ,
ModContent.NPCType<AresLaserCannon>(), ModContent.NPCType<AresBody>() ,
ModContent.NPCType<AresPlasmaFlamethrower>(), ModContent.NPCType<AresBody>() ,
ModContent.NPCType<AresTeslaCannon>(), ModContent.NPCType<AresBody>() ,
ModContent.NPCType<Apollo>(), ModContent.NPCType<Artemis>() ,
ModContent.NPCType<PerforatorBodyLarge>(), ModContent.NPCType<PerforatorHeadLarge>() ,
ModContent.NPCType<PerforatorBodyMedium>(), ModContent.NPCType<PerforatorHeadMedium>() ,
ModContent.NPCType<PerforatorBodySmall>(), ModContent.NPCType<PerforatorHeadSmall>() ,
ModContent.NPCType<PerforatorTailLarge>(), ModContent.NPCType<PerforatorHeadLarge>() ,
ModContent.NPCType<PerforatorTailMedium>(), ModContent.NPCType<PerforatorHeadMedium>() ,
ModContent.NPCType<PerforatorTailSmall>(), ModContent.NPCType<PerforatorHeadSmall>() ,
ModContent.NPCType<RavagerClawLeft>(), ModContent.NPCType<RavagerBody>(),
ModContent.NPCType<RavagerClawRight>(), ModContent.NPCType<RavagerBody>(),
ModContent.NPCType<RavagerHead>(), ModContent.NPCType<RavagerBody>(),
ModContent.NPCType<RavagerLegLeft>(), ModContent.NPCType<RavagerBody>(),
ModContent.NPCType<RavagerLegRight>(), ModContent.NPCType<RavagerBody>(),
ModContent.NPCType<SplitEbonianPaladin>(), ModContent.NPCType<EbonianPaladin>(),
ModContent.NPCType<SplitCrimulanPaladin>(), ModContent.NPCType<CrimulanPaladin>()
);
public static bool[] ShouldMergeInstances = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/ShouldMergeInstances")
.RegisterBoolSet(
ModContent.NPCType<AstrumDeusHead>(),
ModContent.NPCType<Catastrophe>(),
ModContent.NPCType<Cataclysm>(),
ModContent.NPCType<SoulSeeker>(),
ModContent.NPCType<SupremeCatastrophe>(),
ModContent.NPCType<SoulSeekerSupreme>(),
ModContent.NPCType<SupremeCataclysm>(),
ModContent.NPCType<DarkEnergy>(),
ModContent.NPCType<CryogenShield>(),
ModContent.NPCType<AnahitasIceShield>(),
ModContent.NPCType<PerforatorHeadSmall>(),
ModContent.NPCType<PerforatorHeadMedium>(),
ModContent.NPCType<PerforatorHeadLarge>(),
ModContent.NPCType<PolterPhantom>(),
ModContent.NPCType<RavagerHead2>(),
ModContent.NPCType<SplitCrimulanPaladin>(),
ModContent.NPCType<SplitEbonianPaladin>(),
ModContent.NPCType<ProvSpawnHealer>(),
ModContent.NPCType<ProvSpawnDefense>(),
ModContent.NPCType<ProvSpawnOffense>()
);
public static bool[] ShouldBlacklist = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/ShouldBlacklist")
.RegisterBoolSet(ModContent.NPCType<DevourerofGodsBody>(),
ModContent.NPCType<DevourerofGodsTail>(),
ModContent.NPCType<DesertScourgeBody>(),
ModContent.NPCType<DesertScourgeTail>(),
ModContent.NPCType<AstrumDeusBody>(),
ModContent.NPCType<AstrumDeusTail>(),
ModContent.NPCType<AquaticScourgeBody>(),
ModContent.NPCType<AquaticScourgeBodyAlt>(),
ModContent.NPCType<AquaticScourgeTail>(),
ModContent.NPCType<ThanatosBody1>(),
ModContent.NPCType<ThanatosBody2>(),
ModContent.NPCType<ThanatosTail>(),
ModContent.NPCType<StormWeaverBody>(),
ModContent.NPCType<StormWeaverTail>(),
ModContent.NPCType<AresGaussNuke>(),
ModContent.NPCType<AresLaserCannon>(),
ModContent.NPCType<AresPlasmaFlamethrower>(),
ModContent.NPCType<AresTeslaCannon>(),
ModContent.NPCType<Apollo>(),
ModContent.NPCType<RavagerClawLeft>(),
ModContent.NPCType<RavagerClawRight>(),
ModContent.NPCType<RavagerHead>(),
ModContent.NPCType<RavagerLegLeft>(),
ModContent.NPCType<RavagerLegRight>(),
ModContent.NPCType<PerforatorBodyLarge>(),
ModContent.NPCType<PerforatorBodyMedium>(),
ModContent.NPCType<PerforatorBodySmall>(),
ModContent.NPCType<PerforatorTailLarge>(),
ModContent.NPCType<PerforatorTailMedium>(),
ModContent.NPCType<PerforatorTailMedium>(),
ModContent.NPCType<PerforatorTailSmall>()
);
public static bool[] ShouldTrackAsABoss = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/ShouldTrackAsABoss")
.Description("NPC types that should be whitelisted to count as a boss")
.RegisterBoolSet(
ModContent.NPCType<ProfanedGuardianCommander>(),
ModContent.NPCType<ProfanedGuardianDefender>(),
ModContent.NPCType<ProfanedGuardianHealer>()
);
}
}
+1 -2
View File
@@ -105,8 +105,7 @@ namespace CalamityMod.NPCs.AquaticScourge
NPC.timeLeft *= 20;
NPC.npcSlots = 16f;
NPC.damage = NPC.defDamage;
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
calamityGlobalNPC.KillTime = revKillTime;
calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type];
calamityGlobalNPC.newAI[0] = 1f;
nonHostile = false;
NPC.chaseable = true;
+1 -2
View File
@@ -101,8 +101,7 @@ namespace CalamityMod.NPCs.AquaticScourge
NPC.timeLeft *= 20;
NPC.npcSlots = 16f;
NPC.damage = NPC.defDamage;
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
calamityGlobalNPC.KillTime = revKillTime;
calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type];
calamityGlobalNPC.newAI[0] = 1f;
nonHostile = false;
NPC.chaseable = true;
+1 -2
View File
@@ -146,8 +146,7 @@ namespace CalamityMod.NPCs.AquaticScourge
NPC.timeLeft *= 20;
NPC.npcSlots = 16f;
NPC.damage = NPC.defDamage;
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
calamityGlobalNPC.KillTime = revKillTime;
calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type];s
calamityGlobalNPC.newAI[0] = 1f;
nonHostile = false;
NPC.boss = true;
+1 -2
View File
@@ -100,8 +100,7 @@ namespace CalamityMod.NPCs.AquaticScourge
NPC.timeLeft *= 20;
NPC.npcSlots = 16f;
NPC.damage = NPC.defDamage;
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
calamityGlobalNPC.KillTime = revKillTime;
calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type];
calamityGlobalNPC.newAI[0] = 1f;
nonHostile = false;
NPC.chaseable = true;
+2 -107
View File
@@ -93,9 +93,6 @@ namespace CalamityMod.NPCs
{
#region Variables
/// <summary> Data structure used for storing Calamity's intended boss kill times. </summary>
public static SortedDictionary<int, int> BossKillTimes;
/// <summary> Data structure used for storing the damage reduction values of NPCs. </summary>
public static SortedDictionary<int, float> DRValues { get; set; }
@@ -1055,120 +1052,18 @@ namespace CalamityMod.NPCs
{ NPCID.WallofFlesh, 0.15f },
};
#endregion
// Somehow the SetStatic is called few times before SetStaticDefaults
// So We Initialize the Dictionary first. And Push Data later (At SetStaticDefaults)
BossKillTimes = [];
}
public override void Unload()
{
DRValues?.Clear();
DRValues = null;
BossKillTimes?.Clear();
BossKillTimes = null;
}
#endregion
#region Set Defaults
public override void SetStaticDefaults()
{
#region Add Entries to BossKillTimes
BossKillTimes.AddRange<int, int>(new Dictionary<int, int>(){
//
// VANILLA BOSSES
//
{ NPCID.KingSlime, 5400 }, // 1:30 (90 seconds)
{ NPCID.EyeofCthulhu, 5400 }, // 1:30 (90 seconds)
{ NPCID.EaterofWorldsHead, 7200 }, // 2:00 (120 seconds)
{ NPCID.EaterofWorldsBody, 7200 },
{ NPCID.EaterofWorldsTail, 7200 },
{ NPCID.BrainofCthulhu, 7200 }, // 2:00 (120 seconds, total length of fight including Creepers phase)
{ NPCID.Creeper, 1800 }, // 0:30 (30 seconds, length of Creepers phase)
{ NPCID.Deerclops, 5400 }, // 1:30 (90 seconds)
{ NPCID.QueenBee, 7200 }, // 2:00 (120 seconds)
{ NPCID.SkeletronHead, 7200 }, // 2:00 (120 seconds)
{ NPCID.WallofFlesh, 7200 }, // 2:00 (120 seconds)
{ NPCID.WallofFleshEye, 7200 },
{ NPCID.QueenSlimeBoss, 7200 }, // 2:00 (120 seconds)
{ NPCID.Spazmatism, 10800 }, // 3:00 (180 seconds)
{ NPCID.Retinazer, 10800 },
{ NPCID.TheDestroyer, 10800 }, // 3:00 (180 seconds)
{ NPCID.TheDestroyerBody, 10800 },
{ NPCID.TheDestroyerTail, 10800 },
{ NPCID.SkeletronPrime, 10800 }, // 3:00 (180 seconds)
{ NPCID.Plantera, 10800 }, // 3:00 (180 seconds)
{ NPCID.Golem, 9000 }, // 2:30 (150 seconds)
{ NPCID.GolemHead, 3600 }, // 1:00 (60 seconds)
{ NPCID.DukeFishron, 9000 }, // 2:30 (150 seconds)
{ NPCID.HallowBoss, 10800 }, // 3:00 (180 seconds)
{ NPCID.CultistBoss, 9000 }, // 2:30 (150 seconds)
{ NPCID.MoonLordCore, 14400 }, // 4:00 (240 seconds)
{ NPCID.MoonLordHand, 7200 }, // 2:00 (120 seconds)
{ NPCID.MoonLordHead, 7200 }, // 2:00 (120 seconds)
//
// CALAMITY BOSSES
//
{ NPCType<DesertScourgeHead>(), 5400 }, // 1:30 (90 seconds)
{ NPCType<DesertScourgeBody>(), 5400 },
{ NPCType<DesertScourgeTail>(), 5400 },
{ NPCType<Crabulon.Crabulon>(), 5400 }, // 1:30 (90 seconds)
{ NPCType<HiveMind.HiveMind>(), 7200 }, // 2:00 (120 seconds)
{ NPCType<PerforatorHive>(), 7200 }, // 2:00 (120 seconds)
{ NPCType<SlimeGodCore>(), 9000 }, // 2:30 (150 seconds) -- total length of Slime God fight
{ NPCType<EbonianPaladin>(), 4500 }, // 1:15 (75 seconds)
{ NPCType<CrimulanPaladin>(), 4500 }, // 1:15 (75 seconds)
{ NPCType<SplitEbonianPaladin>(), 4500 }, // 1:15 (75 seconds) -- split slimes should spawn at 1:15 and die at around 2:30
{ NPCType<SplitCrimulanPaladin>(), 4500 }, // 1:15 (75 seconds)
{ NPCType<Cryogen.Cryogen>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<AquaticScourgeHead>(), 9000 }, // 2:30 (150 seconds)
{ NPCType<AquaticScourgeBody>(), 9000 },
{ NPCType<AquaticScourgeBodyAlt>(), 9000 },
{ NPCType<AquaticScourgeTail>(), 9000 },
{ NPCType<BrimstoneElemental.BrimstoneElemental>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<CalamitasClone>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<Anahita>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<Leviathan.Leviathan>(), 10800 },
{ NPCType<AstrumAureus.AstrumAureus>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<AstrumDeusHead>(), 7200 }, // 2:00 (120 seconds) -- first phase is 1:00
{ NPCType<AstrumDeusBody>(), 7200 },
{ NPCType<AstrumDeusTail>(), 7200 },
{ NPCType<PlaguebringerGoliath.PlaguebringerGoliath>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<RavagerBody>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<ProfanedGuardianCommander>(), 7200 }, // 2:00 (120 seconds)
{ NPCType<Dragonfolly>(), 7200 }, // 2:00 (120 seconds)
{ NPCType<Providence.Providence>(), 14400 }, // 4:00 (240 seconds)
{ NPCType<CeaselessVoid.CeaselessVoid>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<DarkEnergy>(), 1200 }, // 0:20 (20 seconds)
{ NPCType<StormWeaverHead>(), 8100 }, // 2:15 (135 seconds)
{ NPCType<StormWeaverBody>(), 8100 },
{ NPCType<StormWeaverTail>(), 8100 },
{ NPCType<Signus.Signus>(), 7200 }, // 2:00 (120 seconds)
{ NPCType<Polterghast.Polterghast>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<OldDuke.OldDuke>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<DevourerofGodsHead>(), 14400 }, // 4:00 (240 seconds)
{ NPCType<DevourerofGodsBody>(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30
{ NPCType<DevourerofGodsTail>(), 14400 },
{ NPCType<Yharon.Yharon>(), 14400 }, // 4:00 (240 seconds)
{ NPCType<Apollo>(), 21600 }, // 6:00 (360 seconds)
{ NPCType<Artemis>(), 21600 },
{ NPCType<AresBody>(), 21600 }, // 6:00 (360 seconds)
{ NPCType<AresGaussNuke>(), 21600 },
{ NPCType<AresLaserCannon>(), 21600 },
{ NPCType<AresPlasmaFlamethrower>(), 21600 },
{ NPCType<AresTeslaCannon>(), 21600 },
{ NPCType<ThanatosHead>(), 21600 }, // 6:00 (360 seconds)
{ NPCType<ThanatosBody1>(), 21600 },
{ NPCType<ThanatosBody2>(), 21600 },
{ NPCType<ThanatosTail>(), 21600 },
{ NPCType<SupremeCalamitas.SupremeCalamitas>(), 18000 }, // 5:00 (300 seconds)
{ NPCType<PrimordialWyrmHead>(), 18000 } // 5:00 (300 seconds)
});
#endregion
// Set Plantera to be able to update oldPos[x]
// This is only used for her Rev+ AI charge attacks
NPCID.Sets.TrailingMode[NPCID.Plantera] = 1;
@@ -1195,8 +1090,8 @@ namespace CalamityMod.NPCs
}
// Aquatic Scourge sets kill time in AI, not here.
if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !CalamityNPCTypeSets.AquaticScourge.Contains(npc.type))
KillTime = revKillTime;
if (!CalamityNPCTypeSets.AquaticScourge.Contains(npc.type))
KillTime = CalamityNPCSets.BossKillTimes[npc.type];
// Fixing more red mistakes
if (npc.type == NPCID.WallofFleshEye)
+1 -2
View File
@@ -20,8 +20,7 @@ namespace CalamityMod.Systems.Collections
[ReinitializeDuringResizeArrays]
public static class CalamityBuffSets
{
private static SetFactory Factory = new SetFactory(BuffLoader.BuffCount, "CalamityMod/BuffID", Search);
private static IdDictionary Search = IdDictionary.Create<BuffID, int>();
private static SetFactory Factory = BuffID.Sets.Factory;
/// <summary>
/// If <see langword="true"/> for a buff type, then that buff will have its duration extended with The Amalgam equipped.<br/>
+1 -2
View File
@@ -24,8 +24,7 @@ namespace CalamityMod.Systems.Collections
[ReinitializeDuringResizeArrays]
public static class CalamityItemSets
{
private static SetFactory Factory = new SetFactory(ItemLoader.ItemCount, "CalamityMod/ItemID", Search);
private static IdDictionary Search = IdDictionary.Create<ItemID, int>();
private static SetFactory Factory = ItemID.Sets.Factory;
/// <summary>
/// If <see langword="true"/> for an item type, prevents an item from removing Calamity's summon damage penalty mechanic despite having tool power.<br/>
+95 -2
View File
@@ -48,8 +48,7 @@ namespace CalamityMod.Systems.Collections
[ReinitializeDuringResizeArrays]
public static class CalamityNPCSets
{
private static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCID", Search);
private static IdDictionary Search = IdDictionary.Create<NPCID, int>();
private static SetFactory Factory = NPCID.Sets.Factory;
/// <summary>
/// If <see langword="true"/> for an NPC type, makes this NPC be susceptible to <see cref="BuffID.Confused"/>.<br/>
@@ -233,6 +232,100 @@ namespace CalamityMod.Systems.Collections
.Description("Prevents Calamity's IsAnEnemy method from considering this NPC an enemy.")
.RegisterBoolSet(NPCID.TargetDummy, NPCType<SuperDummyNPC>());
/// <summary>
/// The intended kill times of Calamity bosses, in frames
/// </summary>
public static int[] BossKillTimes = Factory.CreateNamedSet("BossKillTimes")
.Description("The intended kill times of Calamity bosses, in frames")
.RegisterIntSet(0,
NPCID.KingSlime, 5400, // 1:30 (90 seconds)
NPCID.EyeofCthulhu, 5400, // 1:30 (90 seconds)
NPCID.EaterofWorldsHead, 7200, // 2:00 (120 seconds)
NPCID.EaterofWorldsBody, 7200,
NPCID.EaterofWorldsTail, 7200,
NPCID.BrainofCthulhu, 7200, // 2:00 (120 seconds, total length of fight including Creepers phase)
NPCID.Creeper, 1800, // 0:30 (30 seconds, length of Creepers phase)
NPCID.Deerclops, 5400, // 1:30 (90 seconds)
NPCID.QueenBee, 7200, // 2:00 (120 seconds)
NPCID.SkeletronHead, 7200, // 2:00 (120 seconds)
NPCID.WallofFlesh, 7200, // 2:00 (120 seconds)
NPCID.WallofFleshEye, 7200,
NPCID.QueenSlimeBoss, 7200, // 2:00 (120 seconds)
NPCID.Spazmatism, 10800, // 3:00 (180 seconds)
NPCID.Retinazer, 10800,
NPCID.TheDestroyer, 10800, // 3:00 (180 seconds)
NPCID.TheDestroyerBody, 10800,
NPCID.TheDestroyerTail, 10800,
NPCID.SkeletronPrime, 10800, // 3:00 (180 seconds)
NPCID.Plantera, 10800, // 3:00 (180 seconds)
NPCID.Golem, 9000, // 2:30 (150 seconds)
NPCID.GolemHead, 3600, // 1:00 (60 seconds)
NPCID.DukeFishron, 9000, // 2:30 (150 seconds)
NPCID.HallowBoss, 10800, // 3:00 (180 seconds)
NPCID.CultistBoss, 9000, // 2:30 (150 seconds)
NPCID.MoonLordCore, 14400, // 4:00 (240 seconds)
NPCID.MoonLordHand, 7200, // 2:00 (120 seconds)
NPCID.MoonLordHead, 7200, // 2:00 (120 seconds)
//
// CALAMITY BOSSES
//
NPCType<DesertScourgeHead>(), 5400, // 1:30 (90 seconds)
NPCType<DesertScourgeBody>(), 5400,
NPCType<DesertScourgeTail>(), 5400,
NPCType<Crabulon>(), 5400, // 1:30 (90 seconds)
NPCType<HiveMind>(), 7200, // 2:00 (120 seconds)
NPCType<PerforatorHive>(), 7200, // 2:00 (120 seconds)
NPCType<SlimeGodCore>(), 9000, // 2:30 (150 seconds) -- total length of Slime God fight
NPCType<EbonianPaladin>(), 4500, // 1:15 (75 seconds)
NPCType<CrimulanPaladin>(), 4500, // 1:15 (75 seconds)
NPCType<SplitEbonianPaladin>(), 4500, // 1:15 (75 seconds) -- split slimes should spawn at 1:15 and die at around 2:30
NPCType<SplitCrimulanPaladin>(), 4500, // 1:15 (75 seconds)
NPCType<Cryogen>(), 10800, // 3:00 (180 seconds)
NPCType<AquaticScourgeHead>(), 9000, // 2:30 (150 seconds)
NPCType<AquaticScourgeBody>(), 9000,
NPCType<AquaticScourgeBodyAlt>(), 9000,
NPCType<AquaticScourgeTail>(), 9000,
NPCType<BrimstoneElemental>(), 10800, // 3:00 (180 seconds)
NPCType<CalamitasClone>(), 10800, // 3:00 (180 seconds)
NPCType<Anahita>(), 10800, // 3:00 (180 seconds)
NPCType<Leviathan>(), 10800,
NPCType<AstrumAureus>(), 10800, // 3:00 (180 seconds)
NPCType<AstrumDeusHead>(), 7200, // 2:00 (120 seconds) -- first phase is 1:00
NPCType<AstrumDeusBody>(), 7200,
NPCType<AstrumDeusTail>(), 7200,
NPCType<PlaguebringerGoliath>(), 10800, // 3:00 (180 seconds)
NPCType<RavagerBody>(), 10800, // 3:00 (180 seconds)
NPCType<ProfanedGuardianCommander>(), 7200, // 2:00 (120 seconds)
NPCType<Dragonfolly>(), 7200, // 2:00 (120 seconds)
NPCType<Providence>(), 14400, // 4:00 (240 seconds)
NPCType<CeaselessVoid>(), 10800, // 3:00 (180 seconds)
NPCType<DarkEnergy>(), 1200, // 0:20 (20 seconds)
NPCType<StormWeaverHead>(), 8100, // 2:15 (135 seconds)
NPCType<StormWeaverBody>(), 8100,
NPCType<StormWeaverTail>(), 8100,
NPCType<Signus>(), 7200, // 2:00 (120 seconds)
NPCType<Polterghast>(), 10800, // 3:00 (180 seconds)
NPCType<OldDuke>(), 10800, // 3:00 (180 seconds)
NPCType<DevourerofGodsHead>(), 14400, // 4:00 (240 seconds)
NPCType<DevourerofGodsBody>(), 14400, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30
NPCType<DevourerofGodsTail>(), 14400,
NPCType<Yharon>(), 14400, // 4:00 (240 seconds)
NPCType<Apollo>(), 21600, // 6:00 (360 seconds)
NPCType<Artemis>(), 21600,
NPCType<AresBody>(), 21600, // 6:00 (360 seconds)
NPCType<AresGaussNuke>(), 21600,
NPCType<AresLaserCannon>(), 21600,
NPCType<AresPlasmaFlamethrower>(), 21600,
NPCType<AresTeslaCannon>(), 21600,
NPCType<ThanatosHead>(), 21600, // 6:00 (360 seconds)
NPCType<ThanatosBody1>(), 21600,
NPCType<ThanatosBody2>(), 21600,
NPCType<ThanatosTail>(), 21600,
NPCType<SupremeCalamitas>(), 18000, // 5:00 (300 seconds)
NPCType<PrimordialWyrmHead>(), 18000 // 5:00 (300 seconds)
);
/// <summary>
/// Associates an NPC type with the base value of their max health in Boss Rush.<br/>
/// If an NPC type is not a key in this dictionary, then it will use its standard max health value.
+1 -2
View File
@@ -20,8 +20,7 @@ namespace CalamityMod.Systems.Collections
[ReinitializeDuringResizeArrays]
public static class CalamityNPCTypeSets
{
private static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCType", Search);
private static IdDictionary Search = IdDictionary.Create<NPCID, int>();
private static SetFactory Factory = NPCID.Sets.Factory;
// Used for dropping Ancient Bone Dust, vanilla has a Skeleton NPCID set which has more unwanted enemies in it
public static bool[] Skeleton = Factory.CreateNamedSet("Skeleton")
@@ -14,8 +14,7 @@ namespace CalamityMod.Systems.Collections
[ReinitializeDuringResizeArrays]
public static class CalamityProjectileSets
{
private static SetFactory Factory = new SetFactory(ProjectileLoader.ProjectileCount, "CalamityMod/ProjectileID", Search);
private static IdDictionary Search = IdDictionary.Create<ProjectileID, int>();
private static SetFactory Factory = ProjectileID.Sets.Factory;
/// <summary>
/// If <see langword="true"/> for a projectile type, then that minion will completely ignore Calamity's summon damage penalty mechanic with no exceptions.<br/>
+1 -2
View File
@@ -11,8 +11,7 @@ namespace CalamityMod.Systems.Collections
[ReinitializeDuringResizeArrays]
public static class CalamityTileSets
{
private static SetFactory Factory = new SetFactory(TileLoader.TileCount, "CalamityMod/TileID", Search);
private static IdDictionary Search = IdDictionary.Create<TileID, int>();
private static SetFactory Factory = TileID.Sets.Factory;
/// <summary>
/// Should only contain modded tiles. If <see langword="true"/> for a tile type, then that tile can be replaced by the Abyss during world generation.<br/>