From fbbdc701991e735fdc33272aaa84356f72495c60 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Wed, 16 Apr 2025 19:34:58 -0400 Subject: [PATCH] Moved universal pierce resistance balancing values into BalancingConstants --- Balancing/BalancingConstants.cs | 10 ++++++++++ NPCs/CalamityPierceResistance.cs | 9 ++++----- Projectiles/CalamityGlobalProjectile.cs | 5 ----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index c09f8c513e..7e2d165718 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -242,6 +242,16 @@ internal static readonly float TrueMeleeRipperReductionFactor = 0.5f; // True melee benefits less from rippers to prevent excessive melting. #endregion + #region Pierce Resistance + // Both of the below variables only apply when an NPC has universal pierce resistance enabled via attribute. + // Projectiles may be marked as exempt from this pierce resistance by using an attribute. + + /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. + public const float PierceResistHarshness = 0.12f; + /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. + public const float PierceResistCap = 0.8f; + #endregion + // TODO -- NPC classification is not done consistently with predictable thresholds. // These variables should be used in general to classify "enemies" vs "non-enemies" as well. // See NPCUtils.IsAnEnemy diff --git a/NPCs/CalamityPierceResistance.cs b/NPCs/CalamityPierceResistance.cs index 85df5ab094..c69f0b3ad7 100644 --- a/NPCs/CalamityPierceResistance.cs +++ b/NPCs/CalamityPierceResistance.cs @@ -2,9 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using CalamityMod.Balancing; using CalamityMod.Items.Accessories; -using CalamityMod.NPCs; -using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Projectiles; using CalamityMod.Systems.Collections; using Terraria; @@ -149,9 +148,9 @@ namespace CalamityMod.NPCs if (ThanatosIDList.Includes(npc.type) && npc.GetGlobalNPC().unbreakableDR) return; - float damageReduction = projectile.Calamity().timesPierced * CalamityGlobalProjectile.PierceResistHarshness; - if (damageReduction > CalamityGlobalProjectile.PierceResistCap) - damageReduction = CalamityGlobalProjectile.PierceResistCap; + float damageReduction = projectile.Calamity().timesPierced * BalancingConstants.PierceResistHarshness; + if (damageReduction > BalancingConstants.PierceResistCap) + damageReduction = BalancingConstants.PierceResistCap; modifiers.FinalDamage *= 1f - damageReduction; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 21eba3112d..4d91d08a39 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -74,11 +74,6 @@ namespace CalamityMod.Projectiles /// Constant variable used as a speed cap for boss laser projectiles with 2 extra updates. public const float AcceleratingBossLaserVelocityCap = 8f; - /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. - public const float PierceResistHarshness = 0.12f; - /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. - public const float PierceResistCap = 0.8f; - /// /// Used for executing frame one hacks. Things set during this include: ///
* Reducing projectile damage for Hardmode enemies and in Master Mode.