Centralized all resists/vulnerabilities into a balancing system

This commit is contained in:
Dominic authored and Cameron Ewell committed 2022-02-21 22:03:16 -05:00
1 parent 6dc2b83151
commit fa680a10fc
9 files changed
+1006 -635

No files matched your search

+379
View File
@@ -0,0 +1,379 @@
using CalamityMod;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.CeaselessVoid;
using CalamityMod.NPCs.Crabulon;
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.OldDuke;
using CalamityMod.NPCs.Perforator;
using CalamityMod.NPCs.Ravager;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Balancing
{
public static class BalancingChangesManager
{
internal static List<IBalancingRule[]> UniversalBalancingChanges = null;
internal static List<NPCBalancingChange> NPCSpecificBalancingChanges = null;
// Balancing changes in this method are sorted based on place in progression, NPC name (from A-Z), and strength of resistance in ascending order, in that level of priority.
// For ease of change, changes that are not exclusive to one specific weapon are not bundled into one line if they share the same resistance factor.
// To give an example of this, Thanatos having a 50% resist to Chicken Cannon and Prismatic Breaker should be two distinct lines with a 0.5x factor instead of hamfisting them all
// into one single resist that may have to be split later.
internal static void Load()
{
// Declare specific filters.
bool DragonRageFilter(Projectile p) =>
p.type == ProjectileType<DragonRageStaff>() || p.type == ProjectileType<DragonRageFireball>() || (p.type == ProjectileType<FuckYou>() && p.melee);
bool MonkStaffT3Filter(Projectile p) =>
p.type == ProjectileID.MonkStaffT3_AltShot || (p.type == ProjectileID.Electrosphere && Main.player[p.owner].ActiveItem().type == ItemID.MonkStaffT3);
bool MushroomSpearFilter(Projectile p) =>
p.type == ProjectileID.Mushroom && Main.player[p.owner].ActiveItem().type == ItemID.MushroomSpear;
UniversalBalancingChanges = new List<IBalancingRule[]>()
{
// Nerf the T3 Monk Staff by 75% due to its strong primary fire buff.
Do(new ProjectileSpecificRequirementBalancingRule(0.25f, MonkStaffT3Filter)),
// Nerf Seedler seeds by 66.6%.
Do(new ProjectileResistBalancingRule(0.333f, ProjectileID.SeedlerNut, ProjectileID.SeedlerThorn)),
// Nerf Cursed Dart flames by 50%.
Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CursedDartFlame)),
// Nerf Mushroom Spear projectiles by 50%.
Do(new ProjectileSpecificRequirementBalancingRule(0.5f, MushroomSpearFilter)),
};
NPCSpecificBalancingChanges = new List<NPCBalancingChange>();
#region Desert Scourge
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DesertScourgeIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
#endregion Desert Scourge
#region Brain of Cthulhu / Creepers
// 50% resist to true melee.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(new TrueMeleeResistBalancingRule(0.5f))));
// 50% resist to Demon Scythes.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe))));
#endregion Brain of Cthulhu / Creepers
#region Eater of Worlds
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
// 50% resist to Demon Scythes.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe))));
// 40% resist to Sky Glaze.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType<StickyFeather>()))));
#endregion Eater of Worlds
#region The Perforators
// 50% resist to true melee
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.PerforatorIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
#endregion The Perforators
#region The Aquatic Scourge
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
// 50% resist to Dormant Brimseekers.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<DormantBrimseekerBab>()))));
#endregion The Aquatic Scourge
#region The Destroyer
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
// 50% resist to Dormant Brimseekers.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<DormantBrimseekerBab>()))));
#endregion The Destroyer
#region Ravager
// 50% resist to true melee.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<RavagerBody>(), new TrueMeleeResistBalancingRule(0.5f)));
#endregion Ravager
#region Duke Fishron
// 35% vulnerability to Resurrection Butterfly.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(1.35f, ProjectileType<SakuraBullet>(), ProjectileType<PurpleButterfly>()))));
#endregion Duke Fishron
#region Cultist
// 25% resist to Resurrection Butterfly.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<SakuraBullet>(), ProjectileType<PurpleButterfly>()))));
#endregion Cultist
#region Astrum Deus
// 75% resist to Plaguenades.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType<PlaguenadeBee>(), ProjectileType<PlaguenadeProj>()))));
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
// 25% resist to Resurrection Butterfly.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<SakuraBullet>(), ProjectileType<PurpleButterfly>()))));
#endregion Astrum Deus
#region Ceaseless Void / Dark Energies
// 50% resist to true melee.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<DarkEnergy>(), new TrueMeleeResistBalancingRule(0.5f)));
#endregion Ceaseless Void / Dark Energies
#region Storm Weaver
// 50% resist to true melee
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
// 50% resist to Dazzling Stabbers.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<DazzlingStabber>()))));
// 50% resist to Elemental Axes.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<ElementalAxeMinion>()))));
// 50% resist to Pristine Fury.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<PristineFire>()))));
// 50% resist to Tactician's Trump Card explosions.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<TacticiansElectricBoom>()))));
// 25% resist to Molten Amputator blobs.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<MoltenBlobThrown>()))));
#endregion Storm Weaver
#region Old Duke
// 60% resist to Last Mourning.
// This will technically catch pumpkins from the Horseman's Blade but that shouldn't really matter.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<OldDuke>(), new ProjectileResistBalancingRule(0.4f, ProjectileType<MourningSkull>(), ProjectileID.FlamingJack)));
// 20% resist to Time Bolt.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<OldDuke>(), new ProjectileResistBalancingRule(0.8f, ProjectileType<TimeBoltKnife>())));
#endregion Old Duke
#region The Devourer of Gods
// 15% vulnerability to Time Bolt stealth strikes.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType<TimeBoltKnife>()))));
#endregion The Devourer of Gods
#region Ares
// 75% resist to Dragon Rage projectiles.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.25f, DragonRageFilter))));
// 60% resist to Murasama.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType<MurasamaSlash>()))));
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new TrueMeleeResistBalancingRule(0.5f))));
// 50% resist to Enforcer projectiles.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<EssenceFlame2>()))));
// 20% resist to Eclipse's Fall stealth strike.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<EclipsesSmol>()))));
#endregion Ares
#region Artemis and Apollo
int[] exoTwins = new int[] { NPCType<Artemis>(), NPCType<Apollo>() };
// 10% resist to Eclipse's Fall stealth strike.
NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType<EclipsesSmol>()))));
#endregion Artemis and Apollo
#region Thanatos
// 75% resist to Celestus.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType<CelestusBoomerang>(), ProjectileType<Celestus2>()))));
// 65% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new TrueMeleeResistBalancingRule(0.35f))));
// 65% resist to Hadopelagic Echo.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType<HadopelagicEchoSoundwave>(), ProjectileType<HadopelagicEcho2>()))));
// 50% resist to Chicken Cannon.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<ChickenExplosion>()))));
// 50% resist to Prismatic Breaker. (why is this more than BOTH Rancor and Yharim's Crystal?)
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<PrismaticBeam>()))));
// 50% resist to Vehemence skulls.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<VehemenceSkull>(), ProjectileType<PrismaticBeam>()))));
// 40% resist to Rancor.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType<RancorLaserbeam>()))));
// 40% resist to Wrathwing stealth strike.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType<WrathwingCinder>()))));
// 40% resist to Yharim's Crystal.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType<YharimsCrystalBeam>()))));
// 35% resist to Seraphim lasers.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType<SeraphimBeamLarge>()))));
// 30% resist to Sirius.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<SiriusExplosion>()))));
// 25% resist to Godslayer Slugs.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<GodSlayerSlugProj>()))));
// 25% resist to Luminite Bullets.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.MoonlordBullet))));
// 20% resist to Eradicator beams.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<NebulaShot>()))));
// 20% resist to Voltaic Climax / Void Vortex hitscan beams.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<ClimaxBeam>()))));
// 20% resist to Blood Boiler fire.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<BloodBoilerFire>()))));
// 15% resist to Gruesome Eminence.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<SpiritCongregation>()))));
#endregion Thanatos
#region Supreme Calamitas / Brimstone Heart
// 30% resist to Surge Driver's alt click comets.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<BrimstoneHeart>(), new ProjectileResistBalancingRule(0.7f, ProjectileType<PrismComet>())));
// 20% resist to Executioner's Blade stealth strikes.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<BrimstoneHeart>(), new ProjectileResistBalancingRule(0.8f, ProjectileType<ExecutionersBladeStealthProj>())));
// 15% resist to Seraphim lasers.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<BrimstoneHeart>(), new ProjectileResistBalancingRule(0.85f, ProjectileType<SeraphimBeamLarge>())));
#endregion
#region Supreme Calamitas / Soul Seekers
// 85% resist to Chicken Cannon.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.15f, ProjectileType<ChickenExplosion>())));
// 30% resist to Murasama.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.7f, ProjectileType<MurasamaSlash>())));
// 25% resist to Yharim's Crystal.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.75f, ProjectileType<YharimsCrystalBeam>())));
// 10% resist to Surge Driver's alt click comets.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<PrismComet>())));
// 10% resist to Executioner's Blade stealth strikes.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<ExecutionersBladeStealthProj>())));
// 10% resist to Celestus.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<CelestusBoomerang>(), ProjectileType<Celestus2>())));
// 15% vulnerability to The Atom Splitter (Yes, this is kinda weird, but it's what Piky asked for).
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(1.15f, ProjectileType<TheAtomSplitterProjectile>(), ProjectileType<TheAtomSplitterDuplicate>())));
#endregion Supreme Calamitas / Soul Seekers
}
internal static void Unload()
{
UniversalBalancingChanges = null;
NPCSpecificBalancingChanges = null;
}
public static void ApplyFromProjectile(NPC npc, ref int damage, Projectile proj)
{
NPCHitContext hitContext = NPCHitContext.ConstructFromProjectile(proj);
// Apply universal balancing rules.
foreach (IBalancingRule[] balancingRules in UniversalBalancingChanges)
{
foreach (IBalancingRule balancingRule in balancingRules)
{
if (balancingRule.AppliesTo(npc, hitContext))
balancingRule.ApplyBalancingChange(npc, ref damage);
}
}
// As well as rules specific to NPCs.
foreach (NPCBalancingChange balanceChange in NPCSpecificBalancingChanges)
{
if (npc.type != balanceChange.NPCType)
continue;
foreach (IBalancingRule balancingRule in balanceChange.BalancingRules)
{
if (balancingRule.AppliesTo(npc, hitContext))
balancingRule.ApplyBalancingChange(npc, ref damage);
}
}
}
// This function simply concatenates a bunch of balancing rules into an array.
// It looks a lot nicer than constantly typing "new IBalancingRule[]".
internal static IBalancingRule[] Do(params IBalancingRule[] rules) => rules;
// Shorthand for bundling balancing balancing rules in such a way that it applies to multiple NPCs at once.
// This is useful for preventing having to copy-paste/store the rules and apply it to each NPC individually.
internal static NPCBalancingChange[] Bundle(IEnumerable<int> npcIDs, params IBalancingRule[] rules)
{
NPCBalancingChange[] changes = new NPCBalancingChange[npcIDs.Count()];
for (int i = 0; i < changes.Length; i++)
changes[i] = new NPCBalancingChange(npcIDs.ElementAt(i), rules);
return changes;
}
}
}
+136
View File
@@ -0,0 +1,136 @@
using System.Linq;
using Terraria;
namespace CalamityMod.Balancing
{
public class ClassResistBalancingRule : IBalancingRule
{
public float DamageMultiplier;
public ClassType ApplicableClass;
public ClassResistBalancingRule(float damageMultiplier, ClassType classType)
{
DamageMultiplier = damageMultiplier;
ApplicableClass = classType;
}
public bool AppliesTo(NPC npc, NPCHitContext hitContext)
{
return hitContext.Class == ApplicableClass;
}
public void ApplyBalancingChange(NPC npc, ref int damage) => damage = (int)(damage * DamageMultiplier);
}
public class NPCSpecificRequirementBalancingRule : IBalancingRule
{
public NPCApplicationRequirement Requirement;
public delegate bool NPCApplicationRequirement(NPC npc);
public NPCSpecificRequirementBalancingRule(NPCApplicationRequirement npcApplicationRequirement)
{
Requirement = npcApplicationRequirement;
}
public bool AppliesTo(NPC npc, NPCHitContext hitContext) => Requirement(npc);
// This "balancing" rule doesn't actually perform any changes. It simply serves as a means of enforcing NPC-specific requirements, and should be used only as a filter.
// As such, this method is empty.
public void ApplyBalancingChange(NPC npc, ref int damage) { }
}
public class PierceResistBalancingRule : IBalancingRule
{
public float DamageMultiplier;
public PierceResistBalancingRule(float damageMultiplier) => DamageMultiplier = damageMultiplier;
public bool AppliesTo(NPC npc, NPCHitContext hitContext) => hitContext.Pierce > 1 || hitContext.Pierce == -1;
public void ApplyBalancingChange(NPC npc, ref int damage) => damage = (int)(damage * DamageMultiplier);
}
public class ProjectileResistBalancingRule : IBalancingRule
{
public float DamageMultiplier;
public int[] ApplicableProjectileTypes;
public ProjectileResistBalancingRule(float damageMultiplier, params int[] projTypes)
{
DamageMultiplier = damageMultiplier;
ApplicableProjectileTypes = projTypes;
}
public bool AppliesTo(NPC npc, NPCHitContext hitContext)
{
if (hitContext.DamageSource != DamageSourceType.FriendlyProjectile)
return false;
if (!ApplicableProjectileTypes.Contains(hitContext.ProjectileType ?? -1))
return false;
return true;
}
public void ApplyBalancingChange(NPC npc, ref int damage) => damage = (int)(damage * DamageMultiplier);
}
public class ProjectileSpecificRequirementBalancingRule : IBalancingRule
{
public float DamageMultiplier;
public ProjectileApplicationRequirement Requirement;
public delegate bool ProjectileApplicationRequirement(Projectile proj);
public ProjectileSpecificRequirementBalancingRule(float damageMultiplier, ProjectileApplicationRequirement projApplicationRequirement)
{
DamageMultiplier = damageMultiplier;
Requirement = projApplicationRequirement;
}
public bool AppliesTo(NPC npc, NPCHitContext hitContext)
{
if (hitContext.DamageSource != DamageSourceType.FriendlyProjectile)
return false;
return Requirement(Main.projectile[hitContext.ProjectileIndex.Value]);
}
public void ApplyBalancingChange(NPC npc, ref int damage) => damage = (int)(damage * DamageMultiplier);
}
public class StealthStrikeBalancingRule : IBalancingRule
{
public float DamageMultiplier;
public int[] ApplicableProjectileTypes;
public StealthStrikeBalancingRule(float damageMultiplier, params int[] projTypes)
{
DamageMultiplier = damageMultiplier;
ApplicableProjectileTypes = projTypes;
}
public bool AppliesTo(NPC npc, NPCHitContext hitContext)
{
if (hitContext.DamageSource != DamageSourceType.FriendlyProjectile)
return false;
if (!ApplicableProjectileTypes.Contains(hitContext.ProjectileType ?? -1))
return false;
return hitContext.IsStealthStrike;
}
public void ApplyBalancingChange(NPC npc, ref int damage) => damage = (int)(damage * DamageMultiplier);
}
public class TrueMeleeResistBalancingRule : IBalancingRule
{
public float DamageMultiplier;
public TrueMeleeResistBalancingRule(float damageMultiplier)
{
DamageMultiplier = damageMultiplier;
}
public bool AppliesTo(NPC npc, NPCHitContext hitContext)
{
if (hitContext.DamageSource == DamageSourceType.FriendlyProjectile)
return Main.projectile[hitContext.ProjectileIndex.Value].Calamity().trueMelee;
return hitContext.DamageSource == DamageSourceType.TrueMeleeSwing;
}
public void ApplyBalancingChange(NPC npc, ref int damage) => damage = (int)(damage * DamageMultiplier);
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace CalamityMod.Balancing
{
public enum DamageSourceType
{
FriendlyProjectile,
TrueMeleeSwing,
}
}
+11
View File
@@ -0,0 +1,11 @@
using Terraria;
namespace CalamityMod.Balancing
{
public interface IBalancingRule
{
bool AppliesTo(NPC npc, NPCHitContext hitContext);
void ApplyBalancingChange(NPC npc, ref int damage);
}
}
+13
View File
@@ -0,0 +1,13 @@
namespace CalamityMod.Balancing
{
public struct NPCBalancingChange
{
public int NPCType;
public IBalancingRule[] BalancingRules;
public NPCBalancingChange(int npcType, params IBalancingRule[] balancingRules)
{
NPCType = npcType;
BalancingRules = balancingRules;
}
}
}
+43
View File
@@ -0,0 +1,43 @@
using Terraria;
namespace CalamityMod.Balancing
{
public struct NPCHitContext
{
public int Pierce;
public int Damage;
public int? ProjectileIndex;
public int? ProjectileType => ProjectileIndex.HasValue ? Main.projectile[ProjectileIndex.Value].type : (int?)null;
public bool IsStealthStrike;
public ClassType? Class;
public DamageSourceType DamageSource;
public static NPCHitContext ConstructFromProjectile(Projectile proj)
{
ClassType? classType = null;
if (proj.active)
{
if (proj.melee)
classType = ClassType.Melee;
if (proj.ranged)
classType = ClassType.Ranged;
if (proj.magic)
classType = ClassType.Magic;
if (proj.minion)
classType = ClassType.Summon;
if (proj.Calamity().rogue)
classType = ClassType.Rogue;
}
return new NPCHitContext()
{
Pierce = proj.penetrate,
Damage = proj.damage,
ProjectileIndex = proj.whoAmI,
Class = classType,
IsStealthStrike = proj.active && proj.Calamity().stealthStrike,
DamageSource = DamageSourceType.FriendlyProjectile
};
}
}
}
+409 -409
View File
@@ -1754,7 +1754,7 @@ namespace CalamityMod
ItemType<KnowledgeOldDuke>(),
ItemType<VictoryShard>(),
ItemType<AeroStone>(),
ItemType<TheCommunity>(),
ItemType<TheCommunity>(),
ItemType<DukesDecapitator>(),
ItemType<SulphurousSand>(),
ItemType<MagnumRounds>(),
@@ -2071,443 +2071,443 @@ namespace CalamityMod
ProjectileType<ViolenceThrownProjectile>(),
};
// Lists of enemies that resist piercing to some extent (mostly worms).
// Could prove useful for other things as well.
// Lists of enemies that resist piercing to some extent (mostly worms).
// Could prove useful for other things as well.
AstrumDeusIDs = new List<int>
{
NPCType<AstrumDeusHeadSpectral>(),
NPCType<AstrumDeusBodySpectral>(),
NPCType<AstrumDeusTailSpectral>()
};
AstrumDeusIDs = new List<int>
{
NPCType<AstrumDeusHeadSpectral>(),
NPCType<AstrumDeusBodySpectral>(),
NPCType<AstrumDeusTailSpectral>()
};
DevourerOfGodsIDs = new List<int>
{
NPCType<DevourerofGodsHead>(),
NPCType<DevourerofGodsBody>(),
NPCType<DevourerofGodsTail>()
};
DevourerOfGodsIDs = new List<int>
{
NPCType<DevourerofGodsHead>(),
NPCType<DevourerofGodsBody>(),
NPCType<DevourerofGodsTail>()
};
CosmicGuardianIDs = new List<int>
{
NPCType<DevourerofGodsHead2>(),
NPCType<DevourerofGodsBody2>(),
NPCType<DevourerofGodsTail2>()
};
CosmicGuardianIDs = new List<int>
{
NPCType<DevourerofGodsHead2>(),
NPCType<DevourerofGodsBody2>(),
NPCType<DevourerofGodsTail2>()
};
AquaticScourgeIDs = new List<int>
{
NPCType<AquaticScourgeHead>(),
NPCType<AquaticScourgeBody>(),
NPCType<AquaticScourgeBodyAlt>(),
NPCType<AquaticScourgeTail>()
};
AquaticScourgeIDs = new List<int>
{
NPCType<AquaticScourgeHead>(),
NPCType<AquaticScourgeBody>(),
NPCType<AquaticScourgeBodyAlt>(),
NPCType<AquaticScourgeTail>()
};
PerforatorIDs = new List<int>
{
NPCType<PerforatorHeadLarge>(),
NPCType<PerforatorBodyLarge>(),
NPCType<PerforatorTailLarge>(),
NPCType<PerforatorHeadMedium>(),
NPCType<PerforatorBodyMedium>(),
NPCType<PerforatorTailMedium>(),
NPCType<PerforatorHeadSmall>(),
NPCType<PerforatorBodySmall>(),
NPCType<PerforatorTailSmall>()
};
PerforatorIDs = new List<int>
{
NPCType<PerforatorHeadLarge>(),
NPCType<PerforatorBodyLarge>(),
NPCType<PerforatorTailLarge>(),
NPCType<PerforatorHeadMedium>(),
NPCType<PerforatorBodyMedium>(),
NPCType<PerforatorTailMedium>(),
NPCType<PerforatorHeadSmall>(),
NPCType<PerforatorBodySmall>(),
NPCType<PerforatorTailSmall>()
};
DesertScourgeIDs = new List<int>
{
NPCType<DesertScourgeHead>(),
NPCType<DesertScourgeBody>(),
NPCType<DesertScourgeTail>()
};
DesertScourgeIDs = new List<int>
{
NPCType<DesertScourgeHead>(),
NPCType<DesertScourgeBody>(),
NPCType<DesertScourgeTail>()
};
EaterofWorldsIDs = new List<int>
{
NPCID.EaterofWorldsHead,
NPCID.EaterofWorldsBody,
NPCID.EaterofWorldsTail
};
EaterofWorldsIDs = new List<int>
{
NPCID.EaterofWorldsHead,
NPCID.EaterofWorldsBody,
NPCID.EaterofWorldsTail
};
DeathModeSplittingWormIDs = new List<int>
{
NPCID.DuneSplicerHead,
NPCID.DuneSplicerBody,
NPCID.DuneSplicerTail,
NPCID.DiggerHead,
NPCID.DiggerBody,
NPCID.DiggerTail,
NPCID.SeekerHead,
NPCID.SeekerBody,
NPCID.SeekerTail
};
DeathModeSplittingWormIDs = new List<int>
{
NPCID.DuneSplicerHead,
NPCID.DuneSplicerBody,
NPCID.DuneSplicerTail,
NPCID.DiggerHead,
NPCID.DiggerBody,
NPCID.DiggerTail,
NPCID.SeekerHead,
NPCID.SeekerBody,
NPCID.SeekerTail
};
DestroyerIDs = new List<int>
{
NPCID.TheDestroyer,
NPCID.TheDestroyerBody,
NPCID.TheDestroyerTail
};
DestroyerIDs = new List<int>
{
NPCID.TheDestroyer,
NPCID.TheDestroyerBody,
NPCID.TheDestroyerTail
};
ThanatosIDs = new List<int>
{
NPCType<ThanatosHead>(),
NPCType<ThanatosBody1>(),
NPCType<ThanatosBody2>(),
NPCType<ThanatosTail>()
};
ThanatosIDs = new List<int>
{
NPCType<ThanatosHead>(),
NPCType<ThanatosBody1>(),
NPCType<ThanatosBody2>(),
NPCType<ThanatosTail>()
};
AresIDs = new List<int>
{
NPCType<AresBody>(),
NPCType<AresGaussNuke>(),
NPCType<AresLaserCannon>(),
NPCType<AresPlasmaFlamethrower>(),
NPCType<AresTeslaCannon>()
};
AresIDs = new List<int>
{
NPCType<AresBody>(),
NPCType<AresGaussNuke>(),
NPCType<AresLaserCannon>(),
NPCType<AresPlasmaFlamethrower>(),
NPCType<AresTeslaCannon>()
};
SkeletronPrimeIDs = new List<int>
{
NPCID.SkeletronPrime,
NPCID.PrimeCannon,
NPCID.PrimeLaser,
NPCID.PrimeSaw,
NPCID.PrimeVice
};
SkeletronPrimeIDs = new List<int>
{
NPCID.SkeletronPrime,
NPCID.PrimeCannon,
NPCID.PrimeLaser,
NPCID.PrimeSaw,
NPCID.PrimeVice
};
StormWeaverIDs = new List<int>
{
NPCType<StormWeaverHead>(),
NPCType<StormWeaverBody>(),
NPCType<StormWeaverTail>()
};
StormWeaverIDs = new List<int>
{
NPCType<StormWeaverHead>(),
NPCType<StormWeaverBody>(),
NPCType<StormWeaverTail>()
};
GrenadeResistIDs = new List<int>
{
ProjectileID.Grenade,
ProjectileID.StickyGrenade,
ProjectileID.BouncyGrenade,
ProjectileID.Bomb,
ProjectileID.StickyBomb,
ProjectileID.BouncyBomb,
ProjectileID.Dynamite,
ProjectileID.StickyDynamite,
ProjectileID.BouncyDynamite,
ProjectileID.Explosives,
ProjectileID.ExplosiveBunny,
ProjectileID.PartyGirlGrenade,
ProjectileID.BombFish,
ProjectileID.Beenade,
ProjectileID.Bee,
ProjectileID.GiantBee,
ProjectileType<AeroExplosive>()
//ProjectileID.ScarabBomb
};
GrenadeResistIDs = new List<int>
{
ProjectileID.Grenade,
ProjectileID.StickyGrenade,
ProjectileID.BouncyGrenade,
ProjectileID.Bomb,
ProjectileID.StickyBomb,
ProjectileID.BouncyBomb,
ProjectileID.Dynamite,
ProjectileID.StickyDynamite,
ProjectileID.BouncyDynamite,
ProjectileID.Explosives,
ProjectileID.ExplosiveBunny,
ProjectileID.PartyGirlGrenade,
ProjectileID.BombFish,
ProjectileID.Beenade,
ProjectileID.Bee,
ProjectileID.GiantBee,
ProjectileType<AeroExplosive>()
//ProjectileID.ScarabBomb
};
ZeroContactDamageNPCList = new List<int>
{
NPCID.DarkCaster,
NPCID.FireImp,
NPCID.Tim,
NPCID.CultistArcherBlue,
NPCID.DesertDjinn,
NPCID.DiabolistRed,
NPCID.DiabolistWhite,
NPCID.Gastropod,
NPCID.IceElemental,
NPCID.IchorSticker,
NPCID.Necromancer,
NPCID.NecromancerArmored,
NPCID.RaggedCaster,
NPCID.RaggedCasterOpenCoat,
NPCID.RuneWizard,
NPCID.SkeletonArcher,
NPCID.SkeletonCommando,
NPCID.SkeletonSniper,
NPCID.TacticalSkeleton,
NPCID.Clown,
NPCID.GoblinArcher,
NPCID.GoblinSorcerer,
NPCID.GoblinSummoner,
NPCID.PirateCrossbower,
NPCID.PirateDeadeye,
NPCID.PirateCaptain,
NPCID.SnowmanGangsta,
NPCID.SnowBalla,
NPCID.DrManFly,
NPCID.Eyezor,
NPCID.Nailhead,
NPCID.MartianWalker,
NPCID.MartianTurret,
NPCID.ElfCopter,
NPCID.ElfArcher,
NPCID.NebulaBrain,
NPCID.StardustJellyfishBig,
NPCID.PirateShipCannon,
NPCID.MartianSaucer,
NPCID.MartianSaucerCannon,
NPCID.MartianSaucerCore,
NPCID.MartianSaucerTurret,
NPCID.Probe,
NPCID.CultistBoss,
NPCID.GolemHeadFree,
NPCID.MoonLordFreeEye,
//NPCID.BloodSquid,
NPCID.PlanterasHook
};
ZeroContactDamageNPCList = new List<int>
{
NPCID.DarkCaster,
NPCID.FireImp,
NPCID.Tim,
NPCID.CultistArcherBlue,
NPCID.DesertDjinn,
NPCID.DiabolistRed,
NPCID.DiabolistWhite,
NPCID.Gastropod,
NPCID.IceElemental,
NPCID.IchorSticker,
NPCID.Necromancer,
NPCID.NecromancerArmored,
NPCID.RaggedCaster,
NPCID.RaggedCasterOpenCoat,
NPCID.RuneWizard,
NPCID.SkeletonArcher,
NPCID.SkeletonCommando,
NPCID.SkeletonSniper,
NPCID.TacticalSkeleton,
NPCID.Clown,
NPCID.GoblinArcher,
NPCID.GoblinSorcerer,
NPCID.GoblinSummoner,
NPCID.PirateCrossbower,
NPCID.PirateDeadeye,
NPCID.PirateCaptain,
NPCID.SnowmanGangsta,
NPCID.SnowBalla,
NPCID.DrManFly,
NPCID.Eyezor,
NPCID.Nailhead,
NPCID.MartianWalker,
NPCID.MartianTurret,
NPCID.ElfCopter,
NPCID.ElfArcher,
NPCID.NebulaBrain,
NPCID.StardustJellyfishBig,
NPCID.PirateShipCannon,
NPCID.MartianSaucer,
NPCID.MartianSaucerCannon,
NPCID.MartianSaucerCore,
NPCID.MartianSaucerTurret,
NPCID.Probe,
NPCID.CultistBoss,
NPCID.GolemHeadFree,
NPCID.MoonLordFreeEye,
//NPCID.BloodSquid,
NPCID.PlanterasHook
};
// Reduce contact damage by 25%
HardmodeNPCNerfList = new List<int>
{
NPCID.AnglerFish,
NPCID.AngryTrapper,
NPCID.Arapaima,
NPCID.BlackRecluse,
NPCID.BlackRecluseWall,
NPCID.BloodJelly,
NPCID.FungoFish,
NPCID.GreenJellyfish,
NPCID.Clinger,
NPCID.ArmoredSkeleton,
NPCID.ArmoredViking,
NPCID.Mummy,
NPCID.DarkMummy,
NPCID.LightMummy,
NPCID.BloodFeeder,
NPCID.DesertBeast,
NPCID.ChaosElemental,
//NPCID.BloodMummy,
NPCID.CorruptSlime,
NPCID.Slimeling,
NPCID.Corruptor,
NPCID.Crimslime,
NPCID.BigCrimslime,
NPCID.LittleCrimslime,
NPCID.CrimsonAxe,
NPCID.CursedHammer,
NPCID.Derpling,
NPCID.Herpling,
NPCID.DiggerHead,
NPCID.DiggerBody,
NPCID.DiggerTail,
NPCID.DesertGhoul,
NPCID.DesertGhoulCorruption,
NPCID.DesertGhoulCrimson,
NPCID.DesertGhoulHallow,
NPCID.DuneSplicerHead,
NPCID.DuneSplicerBody,
NPCID.DuneSplicerTail,
NPCID.EnchantedSword,
NPCID.FloatyGross,
NPCID.GiantBat,
NPCID.GiantFlyingFox,
NPCID.GiantFungiBulb,
NPCID.FungiSpore,
NPCID.GiantTortoise,
NPCID.IceTortoise,
NPCID.HoppinJack,
NPCID.Mimic,
NPCID.IchorSticker,
NPCID.IcyMerman,
NPCID.IlluminantBat,
NPCID.IlluminantSlime,
NPCID.JungleCreeper,
NPCID.JungleCreeperWall,
NPCID.DesertLamiaDark,
NPCID.DesertLamiaLight,
NPCID.BigMossHornet,
NPCID.GiantMossHornet,
NPCID.LittleMossHornet,
NPCID.MossHornet,
NPCID.TinyMossHornet,
NPCID.Moth,
NPCID.PigronCorruption,
NPCID.PigronCrimson,
NPCID.PigronHallow,
NPCID.Pixie,
NPCID.PossessedArmor,
//NPCID.RockGolem,
NPCID.DesertScorpionWalk,
NPCID.DesertScorpionWall,
NPCID.Slimer,
NPCID.Slimer2,
NPCID.ToxicSludge,
NPCID.Unicorn,
NPCID.WanderingEye,
NPCID.Werewolf,
NPCID.Wolf,
NPCID.SeekerHead,
NPCID.SeekerBody,
NPCID.SeekerTail,
NPCID.Wraith,
NPCID.ChatteringTeethBomb,
NPCID.Clown,
NPCID.AngryNimbus,
NPCID.IceGolem,
NPCID.RainbowSlime,
NPCID.SandShark,
NPCID.SandsharkCorrupt,
NPCID.SandsharkCrimson,
NPCID.SandsharkHallow,
NPCID.ShadowFlameApparition,
NPCID.Parrot,
NPCID.PirateCorsair,
NPCID.PirateDeckhand,
//NPCID.PiratesCurse,
NPCID.BlueArmoredBonesMace,
NPCID.BlueArmoredBonesSword,
NPCID.BoneLee,
NPCID.DungeonSpirit,
NPCID.FlyingSnake,
NPCID.HellArmoredBones,
NPCID.HellArmoredBonesSpikeShield,
NPCID.HellArmoredBonesSword,
NPCID.MisterStabby,
NPCID.SnowBalla,
NPCID.SnowmanGangsta,
NPCID.Butcher,
NPCID.CreatureFromTheDeep,
NPCID.DeadlySphere,
NPCID.Frankenstein,
NPCID.Fritz,
NPCID.Psycho,
NPCID.Reaper,
NPCID.SwampThing,
NPCID.ThePossessed,
NPCID.Vampire,
NPCID.VampireBat,
NPCID.HeadlessHorseman,
NPCID.Hellhound,
NPCID.Poltergeist,
NPCID.Scarecrow1,
NPCID.Scarecrow2,
NPCID.Scarecrow3,
NPCID.Scarecrow4,
NPCID.Scarecrow5,
NPCID.Scarecrow6,
NPCID.Scarecrow7,
NPCID.Scarecrow8,
NPCID.Scarecrow9,
NPCID.Scarecrow10,
NPCID.Splinterling,
NPCID.Flocko,
NPCID.GingerbreadMan,
NPCID.Krampus,
NPCID.Nutcracker,
NPCID.NutcrackerSpinning,
NPCID.PresentMimic,
NPCID.Yeti,
NPCID.ZombieElf,
NPCID.ZombieElfBeard,
NPCID.ZombieElfGirl
//NPCID.BloodEelHead,
//NPCID.BloodEelBody,
//NPCID.BloodEelTail,
//NPCID.HemogoblinShark,
//NPCID.WanderingEyeFish,
//NPCID.ZombieMerman,
};
// Reduce contact damage by 25%
HardmodeNPCNerfList = new List<int>
{
NPCID.AnglerFish,
NPCID.AngryTrapper,
NPCID.Arapaima,
NPCID.BlackRecluse,
NPCID.BlackRecluseWall,
NPCID.BloodJelly,
NPCID.FungoFish,
NPCID.GreenJellyfish,
NPCID.Clinger,
NPCID.ArmoredSkeleton,
NPCID.ArmoredViking,
NPCID.Mummy,
NPCID.DarkMummy,
NPCID.LightMummy,
NPCID.BloodFeeder,
NPCID.DesertBeast,
NPCID.ChaosElemental,
//NPCID.BloodMummy,
NPCID.CorruptSlime,
NPCID.Slimeling,
NPCID.Corruptor,
NPCID.Crimslime,
NPCID.BigCrimslime,
NPCID.LittleCrimslime,
NPCID.CrimsonAxe,
NPCID.CursedHammer,
NPCID.Derpling,
NPCID.Herpling,
NPCID.DiggerHead,
NPCID.DiggerBody,
NPCID.DiggerTail,
NPCID.DesertGhoul,
NPCID.DesertGhoulCorruption,
NPCID.DesertGhoulCrimson,
NPCID.DesertGhoulHallow,
NPCID.DuneSplicerHead,
NPCID.DuneSplicerBody,
NPCID.DuneSplicerTail,
NPCID.EnchantedSword,
NPCID.FloatyGross,
NPCID.GiantBat,
NPCID.GiantFlyingFox,
NPCID.GiantFungiBulb,
NPCID.FungiSpore,
NPCID.GiantTortoise,
NPCID.IceTortoise,
NPCID.HoppinJack,
NPCID.Mimic,
NPCID.IchorSticker,
NPCID.IcyMerman,
NPCID.IlluminantBat,
NPCID.IlluminantSlime,
NPCID.JungleCreeper,
NPCID.JungleCreeperWall,
NPCID.DesertLamiaDark,
NPCID.DesertLamiaLight,
NPCID.BigMossHornet,
NPCID.GiantMossHornet,
NPCID.LittleMossHornet,
NPCID.MossHornet,
NPCID.TinyMossHornet,
NPCID.Moth,
NPCID.PigronCorruption,
NPCID.PigronCrimson,
NPCID.PigronHallow,
NPCID.Pixie,
NPCID.PossessedArmor,
//NPCID.RockGolem,
NPCID.DesertScorpionWalk,
NPCID.DesertScorpionWall,
NPCID.Slimer,
NPCID.Slimer2,
NPCID.ToxicSludge,
NPCID.Unicorn,
NPCID.WanderingEye,
NPCID.Werewolf,
NPCID.Wolf,
NPCID.SeekerHead,
NPCID.SeekerBody,
NPCID.SeekerTail,
NPCID.Wraith,
NPCID.ChatteringTeethBomb,
NPCID.Clown,
NPCID.AngryNimbus,
NPCID.IceGolem,
NPCID.RainbowSlime,
NPCID.SandShark,
NPCID.SandsharkCorrupt,
NPCID.SandsharkCrimson,
NPCID.SandsharkHallow,
NPCID.ShadowFlameApparition,
NPCID.Parrot,
NPCID.PirateCorsair,
NPCID.PirateDeckhand,
//NPCID.PiratesCurse,
NPCID.BlueArmoredBonesMace,
NPCID.BlueArmoredBonesSword,
NPCID.BoneLee,
NPCID.DungeonSpirit,
NPCID.FlyingSnake,
NPCID.HellArmoredBones,
NPCID.HellArmoredBonesSpikeShield,
NPCID.HellArmoredBonesSword,
NPCID.MisterStabby,
NPCID.SnowBalla,
NPCID.SnowmanGangsta,
NPCID.Butcher,
NPCID.CreatureFromTheDeep,
NPCID.DeadlySphere,
NPCID.Frankenstein,
NPCID.Fritz,
NPCID.Psycho,
NPCID.Reaper,
NPCID.SwampThing,
NPCID.ThePossessed,
NPCID.Vampire,
NPCID.VampireBat,
NPCID.HeadlessHorseman,
NPCID.Hellhound,
NPCID.Poltergeist,
NPCID.Scarecrow1,
NPCID.Scarecrow2,
NPCID.Scarecrow3,
NPCID.Scarecrow4,
NPCID.Scarecrow5,
NPCID.Scarecrow6,
NPCID.Scarecrow7,
NPCID.Scarecrow8,
NPCID.Scarecrow9,
NPCID.Scarecrow10,
NPCID.Splinterling,
NPCID.Flocko,
NPCID.GingerbreadMan,
NPCID.Krampus,
NPCID.Nutcracker,
NPCID.NutcrackerSpinning,
NPCID.PresentMimic,
NPCID.Yeti,
NPCID.ZombieElf,
NPCID.ZombieElfBeard,
NPCID.ZombieElfGirl
//NPCID.BloodEelHead,
//NPCID.BloodEelBody,
//NPCID.BloodEelTail,
//NPCID.HemogoblinShark,
//NPCID.WanderingEyeFish,
//NPCID.ZombieMerman,
};
BoundNPCIDs = new List<int>
{
NPCID.BoundGoblin,
NPCID.BoundWizard,
NPCID.BoundMechanic,
NPCID.SleepingAngler,
NPCID.BartenderUnconscious,
NPCID.WebbedStylist,
//NPCID.GolferRescue
};
BoundNPCIDs = new List<int>
{
NPCID.BoundGoblin,
NPCID.BoundWizard,
NPCID.BoundMechanic,
NPCID.SleepingAngler,
NPCID.BartenderUnconscious,
NPCID.WebbedStylist,
//NPCID.GolferRescue
};
// Collections
// NOTE - Be sure to reference the NeedsFourLifeBytes list in the IL Editing code if changes are made here.
BossRushHPChanges = new SortedDictionary<int, int>
{
// Tier 1
{ NPCID.QueenBee, 315000 }, // 30 seconds
// Collections
// NOTE - Be sure to reference the NeedsFourLifeBytes list in the IL Editing code if changes are made here.
BossRushHPChanges = new SortedDictionary<int, int>
{
// Tier 1
{ NPCID.QueenBee, 315000 }, // 30 seconds
{ NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers
{ NPCID.Creeper, 10000 },
{ NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers
{ NPCID.Creeper, 10000 },
{ NPCID.KingSlime, 300000 }, // 30 seconds
{ NPCID.BlueSlime, 3600 },
{ NPCID.SlimeSpiked, 7200 },
{ NPCID.GreenSlime, 2700 },
{ NPCID.RedSlime, 5400 },
{ NPCID.PurpleSlime, 7200 },
{ NPCID.YellowSlime, 6300 },
{ NPCID.IceSlime, 4500 },
{ NPCID.UmbrellaSlime, 5400 },
{ NPCID.RainbowSlime, 30000 },
{ NPCID.Pinky, 15000 },
{ NPCID.KingSlime, 300000 }, // 30 seconds
{ NPCID.BlueSlime, 3600 },
{ NPCID.SlimeSpiked, 7200 },
{ NPCID.GreenSlime, 2700 },
{ NPCID.RedSlime, 5400 },
{ NPCID.PurpleSlime, 7200 },
{ NPCID.YellowSlime, 6300 },
{ NPCID.IceSlime, 4500 },
{ NPCID.UmbrellaSlime, 5400 },
{ NPCID.RainbowSlime, 30000 },
{ NPCID.Pinky, 15000 },
{ NPCID.EyeofCthulhu, 450000 }, // 30 seconds
{ NPCID.ServantofCthulhu, 6000 },
{ NPCID.EyeofCthulhu, 450000 }, // 30 seconds
{ NPCID.ServantofCthulhu, 6000 },
{ NPCID.SkeletronPrime, 110000 }, // 30 seconds
{ NPCID.PrimeVice, 54000 },
{ NPCID.PrimeCannon, 45000 },
{ NPCID.PrimeSaw, 45000 },
{ NPCID.PrimeLaser, 38000 },
{ NPCID.SkeletronPrime, 110000 }, // 30 seconds
{ NPCID.PrimeVice, 54000 },
{ NPCID.PrimeCannon, 45000 },
{ NPCID.PrimeSaw, 45000 },
{ NPCID.PrimeLaser, 38000 },
{ NPCID.Golem, 50000 }, // 30 seconds
{ NPCID.GolemHead, 30000 },
{ NPCID.GolemHeadFree, 30000 },
{ NPCID.GolemFistLeft, 25000 },
{ NPCID.GolemFistRight, 25000 },
{ NPCID.Golem, 50000 }, // 30 seconds
{ NPCID.GolemHead, 30000 },
{ NPCID.GolemHeadFree, 30000 },
{ NPCID.GolemFistLeft, 25000 },
{ NPCID.GolemFistRight, 25000 },
{ NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start
{ NPCID.EaterofWorldsBody, 10000 },
{ NPCID.EaterofWorldsTail, 10000 },
{ NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start
{ NPCID.EaterofWorldsBody, 10000 },
{ NPCID.EaterofWorldsTail, 10000 },
// Tier 2
{ NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start
{ NPCID.TheDestroyerBody, 250000 },
{ NPCID.TheDestroyerTail, 250000 },
{ NPCID.Probe, 10000 },
// Tier 2
{ NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start
{ NPCID.TheDestroyerBody, 250000 },
{ NPCID.TheDestroyerTail, 250000 },
{ NPCID.Probe, 10000 },
{ NPCID.Spazmatism, 150000 }, // 30 seconds
{ NPCID.Retinazer, 125000 },
{ NPCID.Spazmatism, 150000 }, // 30 seconds
{ NPCID.Retinazer, 125000 },
{ NPCID.WallofFlesh, 450000 }, // 30 seconds
{ NPCID.WallofFleshEye, 450000 },
{ NPCID.WallofFlesh, 450000 }, // 30 seconds
{ NPCID.WallofFleshEye, 450000 },
{ NPCID.SkeletronHead, 160000 }, // 30 seconds
{ NPCID.SkeletronHand, 60000 },
{ NPCID.SkeletronHead, 160000 }, // 30 seconds
{ NPCID.SkeletronHand, 60000 },
// Tier 3
{ NPCID.CultistBoss, 220000 }, // 30 seconds
{ NPCID.CultistDragonHead, 60000 },
{ NPCID.CultistDragonBody1, 60000 },
{ NPCID.CultistDragonBody2, 60000 },
{ NPCID.CultistDragonBody3, 60000 },
{ NPCID.CultistDragonBody4, 60000 },
{ NPCID.CultistDragonTail, 60000 },
{ NPCID.AncientCultistSquidhead, 50000 },
// Tier 3
{ NPCID.CultistBoss, 220000 }, // 30 seconds
{ NPCID.CultistDragonHead, 60000 },
{ NPCID.CultistDragonBody1, 60000 },
{ NPCID.CultistDragonBody2, 60000 },
{ NPCID.CultistDragonBody3, 60000 },
{ NPCID.CultistDragonBody4, 60000 },
{ NPCID.CultistDragonTail, 60000 },
{ NPCID.AncientCultistSquidhead, 50000 },
{ NPCID.Plantera, 160000 }, // 30 seconds
{ NPCID.PlanterasTentacle, 40000 },
{ NPCID.Plantera, 160000 }, // 30 seconds
{ NPCID.PlanterasTentacle, 40000 },
// Tier 4
{ NPCID.DukeFishron, 290000 }, // 30 seconds
// Tier 4
{ NPCID.DukeFishron, 290000 }, // 30 seconds
{ NPCID.MoonLordCore, 160000 }, // 1 minute
{ NPCID.MoonLordHand, 45000 },
{ NPCID.MoonLordHead, 60000 },
{ NPCID.MoonLordLeechBlob, 800 }
{ NPCID.MoonLordCore, 160000 }, // 1 minute
{ NPCID.MoonLordHand, 45000 },
{ NPCID.MoonLordHead, 60000 },
{ NPCID.MoonLordLeechBlob, 800 }
// 8 minutes in total for vanilla Boss Rush bosses
};
// 8 minutes in total for vanilla Boss Rush bosses
};
BossValues = new SortedDictionary<int, int>
{
{ NPCID.QueenBee, Item.buyPrice(0, 5)},
{ NPCID.SkeletronHead, Item.buyPrice(0, 7) },
{ NPCID.DukeFishron, Item.buyPrice(0, 25) },
{ NPCID.CultistBoss, Item.buyPrice(0, 25) },
{ NPCID.MoonLordCore, Item.buyPrice(0, 30) }
};
BossValues = new SortedDictionary<int, int>
{
{ NPCID.QueenBee, Item.buyPrice(0, 5)},
{ NPCID.SkeletronHead, Item.buyPrice(0, 7) },
{ NPCID.DukeFishron, Item.buyPrice(0, 25) },
{ NPCID.CultistBoss, Item.buyPrice(0, 25) },
{ NPCID.MoonLordCore, Item.buyPrice(0, 30) }
};
bossTypes = new SortedDictionary<int, int>()
{
@@ -2566,7 +2566,7 @@ namespace CalamityMod
bossMinionList = new List<int>()
{
NPCType<DesertNuisanceHead>(),
NPCType<DesertNuisanceHead>(),
NPCType<DesertNuisanceBody>(),
NPCType<DesertNuisanceTail>(),
NPCID.SlimeSpiked,
@@ -2768,7 +2768,7 @@ namespace CalamityMod
mossHornetList = null;
bossMinionList = null;
minibossList = null;
heartDropBlockList = null;
heartDropBlockList = null;
pierceResistList = null;
pierceResistExceptionList = null;
@@ -2780,13 +2780,13 @@ namespace CalamityMod
DesertScourgeIDs = null;
EaterofWorldsIDs = null;
DeathModeSplittingWormIDs = null;
DestroyerIDs = null;
DestroyerIDs = null;
ThanatosIDs = null;
AresIDs = null;
SkeletronPrimeIDs = null;
SkeletronPrimeIDs = null;
StormWeaverIDs = null;
BoundNPCIDs = null;
GrenadeResistIDs = null;
GrenadeResistIDs = null;
ZeroContactDamageNPCList = null;
HardmodeNPCNerfList = null;
+3
View File
@@ -1,3 +1,4 @@
using CalamityMod.Balancing;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
@@ -228,6 +229,7 @@ namespace CalamityMod
SchematicManager.Load();
CustomLavaManagement.Load();
Attunement.Load();
BalancingChangesManager.Load();
}
private void LoadClient()
@@ -378,6 +380,7 @@ namespace CalamityMod
bossVelocityDamageScaleValues?.Clear();
bossVelocityDamageScaleValues = null;
BalancingChangesManager.Unload();
Attunement.Unload();
EnchantmentManager.UnloadAllEnchantments();
VanillaArmorChangeManager.Unload();
+4 -226
View File
@@ -72,6 +72,7 @@ using Terraria.Utilities;
using static Terraria.ModLoader.ModContent;
using CalamityMod.NPCs.ExoMechs;
using CalamityMod.NPCs.VanillaNPCOverrides.Bosses;
using CalamityMod.Balancing;
namespace CalamityMod.NPCs
{
@@ -4017,235 +4018,12 @@ namespace CalamityMod.NPCs
}
}
// Nerfed because the primary fire was buffed a lot.
if (projectile.type == ProjectileID.MonkStaffT3_AltShot || (projectile.type == ProjectileID.Electrosphere && Main.player[projectile.owner].ActiveItem().type == ItemID.MonkStaffT3))
damage /= 4;
// Nerfed because these are really overpowered.
if (projectile.type == ProjectileID.CursedDartFlame)
damage /= 2;
// Nerf Mushroom Spear mushrooms.
if (projectile.type == ProjectileID.Mushroom && Main.player[projectile.owner].ActiveItem().type == ItemID.MushroomSpear)
damage /= 2;
if (projectile.type == ProjectileID.SeedlerNut || projectile.type == ProjectileID.SeedlerThorn)
damage /= 3;
// Apply balancing resists/vulnerabilities.
BalancingChangesManager.ApplyFromProjectile(npc, ref damage, projectile);
if (CalamityLists.pierceResistList.Contains(npc.type))
PierceResistGlobal(projectile, npc, ref damage);
if (CalamityLists.AresIDs.Contains(npc.type))
{
// 75% resist to Dragon Rage projectiles.
if (projectile.type == ProjectileType<DragonRageStaff>() || projectile.type == ProjectileType<DragonRageFireball>() || (projectile.type == ProjectileType<FuckYou>() && projectile.melee))
damage = (int)(damage * 0.25);
// 60% resist to Murasama.
else if (projectile.type == ProjectileType<MurasamaSlash>())
damage = (int)(damage * 0.4);
// 50% resist to true melee and Enforcer projectiles.
else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType<EssenceFlame2>())
damage = (int)(damage * 0.5);
// 20% resist to Eclipse's Fall stealth strike.
else if (projectile.type == ProjectileType<EclipsesSmol>())
damage = (int)(damage * 0.8);
}
else if (npc.type == NPCType<Artemis>() || npc.type == NPCType<Apollo>())
{
// 10% resist to Eclipse's Fall stealth strike.
if (projectile.type == ProjectileType<EclipsesSmol>())
damage = (int)(damage * 0.9);
}
else if (CalamityLists.ThanatosIDs.Contains(npc.type))
{
// 75% resist to Celestus and Chicken Cannon.
if (projectile.type == ProjectileType<CelestusBoomerang>() || projectile.type == ProjectileType<Celestus2>())
damage = (int)(damage * 0.25);
// 65% resist to true melee and Hadopelagic Echo.
else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType<HadopelagicEchoSoundwave>() || projectile.type == ProjectileType<HadopelagicEcho2>())
damage = (int)(damage * 0.35);
// 50% resist to Chicken Cannon, Vehemence skulls and Prismatic Breaker. (why is this more than BOTH Rancor and Yharim's Crystal?)
else if (projectile.type == ProjectileType<ChickenExplosion>() || projectile.type == ProjectileType<VehemenceSkull>() || projectile.type == ProjectileType<PrismaticBeam>())
damage = (int)(damage * 0.5);
// 40% resist to Wrathwing stealth strike, Rancor, and Yharim's Crystal.
else if (projectile.type == ProjectileType<WrathwingCinder>() || projectile.type == ProjectileType<RancorLaserbeam>() || projectile.type == ProjectileType<YharimsCrystalBeam>())
damage = (int)(damage * 0.6);
// 35% resist to Seraphim lasers.
else if (projectile.type == ProjectileType<SeraphimBeamLarge>())
damage = (int)(damage * 0.65);
// 30% resist to Sirius.
else if (projectile.type == ProjectileType<SiriusExplosion>())
damage = (int)(damage * 0.7);
// 25% resist to God Slayer Slugs and Luminite Bullets.
else if (projectile.type == ProjectileID.MoonlordBullet || projectile.type == ProjectileType<GodSlayerSlugProj>())
damage = (int)(damage * 0.75);
// 20% resist to Eradicator beams, Voltaic Climax / Void Vortex hitscan and Blood Boiler fire.
else if (projectile.type == ProjectileType<NebulaShot>() || projectile.type == ProjectileType<ClimaxBeam>() || projectile.type == ProjectileType<BloodBoilerFire>())
damage = (int)(damage * 0.8);
// 15% resist to Gruesome Eminence.
else if (projectile.type == ProjectileType<SpiritCongregation>())
damage = (int)(damage * 0.85);
}
else if (npc.type == NPCType<RavagerBody>())
{
// 50% resist to true melee.
if (projectile.Calamity().trueMelee)
damage = (int)(damage * 0.5);
}
else if (CalamityLists.AstrumDeusIDs.Contains(npc.type))
{
// 75% resist to Plaguenades.
if (projectile.type == ProjectileType<PlaguenadeBee>() || projectile.type == ProjectileType<PlaguenadeProj>())
damage = (int)(damage * 0.25);
// 50% resist to true melee.
else if (projectile.Calamity().trueMelee)
damage = (int)(damage * 0.5);
// 25% resist to Resurrection Butterfly.
else if (projectile.type == ProjectileType<SakuraBullet>() || projectile.type == ProjectileType<PurpleButterfly>())
damage = (int)(damage * 0.75);
}
else if (npc.type == NPCType<BrimstoneHeart>())
{
// 30% resist to Surge Driver's alt click comets.
if (projectile.type == ProjectileType<PrismComet>())
damage = (int)(damage * 0.7);
// 20% resist to Executioner's Blade stealth strikes.
else if (projectile.type == ProjectileType<ExecutionersBladeStealthProj>())
damage = (int)(damage * 0.8);
// 15% resist to Seraphim lasers.
else if (projectile.type == ProjectileType<SeraphimBeamLarge>())
damage = (int)(damage * 0.85);
}
else if (CalamityLists.DevourerOfGodsIDs.Contains(npc.type))
{
// 15% increased damage from Time Bolt stealth strikes.
if (projectile.type == ProjectileType<TimeBoltKnife>())
{
if (projectile.Calamity().stealthStrike)
damage = (int)(damage * 1.15);
}
}
else if (npc.type == NPCType<DarkEnergy>())
{
// 50% resist to true melee.
if (projectile.Calamity().trueMelee)
damage = (int)(damage * 0.5);
}
else if (CalamityLists.StormWeaverIDs.Contains(npc.type))
{
// 25% resist to Molten Amputator blobs.
if (projectile.type == ProjectileType<MoltenBlobThrown>())
damage = (int)(damage * 0.75);
// 50% resist to true melee, Elemental Axe, Dazzling Stabber Staff, Pristine Fury, and Tactician's Trump Card explosion.
else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType<ElementalAxeMinion>() || projectile.type == ProjectileType<DazzlingStabber>() || projectile.type == ProjectileType<PristineFire>() || projectile.type == ProjectileType<TacticiansElectricBoom>())
damage = (int)(damage * 0.5);
}
else if (CalamityLists.DestroyerIDs.Contains(npc.type))
{
// 50% resist to true melee and Dormant Brimseekers.
if (projectile.Calamity().trueMelee || projectile.type == ProjectileType<DormantBrimseekerBab>())
damage = (int)(damage * 0.5);
}
else if (CalamityLists.AquaticScourgeIDs.Contains(npc.type))
{
// 50% resist to true melee and Dormant Brimseekers.
if (projectile.Calamity().trueMelee || projectile.type == ProjectileType<DormantBrimseekerBab>())
damage = (int)(damage * 0.5);
}
else if (CalamityLists.PerforatorIDs.Contains(npc.type))
{
// 50% resist to true melee.
if (projectile.Calamity().trueMelee)
damage = (int)(damage * 0.5);
}
else if (npc.type == NPCID.Creeper)
{
// 50% resist to true melee and Demon Scythe.
if (projectile.Calamity().trueMelee || projectile.type == ProjectileID.DemonScythe)
damage = (int)(damage * 0.5);
}
else if (CalamityLists.EaterofWorldsIDs.Contains(npc.type))
{
// 50% resist to true melee and Demon Scythe.
if (projectile.Calamity().trueMelee || projectile.type == ProjectileID.DemonScythe)
damage = (int)(damage * 0.5);
// 40% resist to Sky Glaze.
else if (projectile.type == ProjectileType<StickyFeather>())
damage = (int)(damage * 0.6);
}
else if (CalamityLists.DesertScourgeIDs.Contains(npc.type))
{
// 50% resist to true melee.
if (projectile.Calamity().trueMelee)
damage = (int)(damage * 0.5);
}
else if (npc.type == NPCType<OldDuke.OldDuke>())
{
// 20% resist to Time Bolt.
if (projectile.type == ProjectileType<TimeBoltKnife>())
damage = (int)(damage * 0.8);
// 60% resist to Last Mourning.
else if (projectile.type == ProjectileType<MourningSkull>() || projectile.type == ProjectileID.FlamingJack)
damage = (int)(damage * 0.4);
}
else if (npc.type == NPCType<SoulSeekerSupreme>())
{
// 85% resist to Chicken Cannon.
if (projectile.type == ProjectileType<ChickenExplosion>())
damage = (int)(damage * 0.15);
// 30% resist to Murasama.
else if (projectile.type == ProjectileType<MurasamaSlash>())
damage = (int)(damage * 0.7);
// 25% resist to Yharim's Crystal.
else if (projectile.type == ProjectileType<YharimsCrystalBeam>())
damage = (int)(damage * 0.75);
// 10% resist to Surge Driver's alt click comets and Executioner's Blade stealth strikes.
else if (projectile.type == ProjectileType<ExecutionersBladeStealthProj>() || projectile.type == ProjectileType<PrismComet>())
damage = (int)(damage * 0.9);
// 10% resist to Celestus.
else if (projectile.type == ProjectileType<CelestusBoomerang>() || projectile.type == ProjectileType<Celestus2>())
damage = (int)(damage * 0.9);
// 15% vulnerability to the Atom Splitter (Yes, this is kinda weird, but it's what Piky asked for).
else if (projectile.type == ProjectileType<TheAtomSplitterProjectile>() || projectile.type == ProjectileType<TheAtomSplitterDuplicate>())
damage = (int)(damage * 1.15);
}
else if (npc.type == NPCID.CultistBoss)
{
// 25% resist to Resurrection Butterfly.
if (projectile.type == ProjectileType<PurpleButterfly>() || projectile.type == ProjectileType<SakuraBullet>())
damage = (int)(damage * 0.75);
}
else if (npc.type == NPCID.DukeFishron)
{
// 35% increased damage from Resurrection Butterfly.
if (projectile.type == ProjectileType<PurpleButterfly>() || projectile.type == ProjectileType<SakuraBullet>())
damage = (int)(damage * 1.35);
}
if (modPlayer.camper && !player.StandingStill())
damage = (int)(damage * 0.1);
}