Class HyperbolicDamageMitigationFnSO
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Mitigates damage by X / (X + K), where X is the defensive stat and K the defense
that gives 50% mitigation. The formula of LoL, Dota, WoW and Diablo.
public class HyperbolicDamageMitigationFnSO : DamageMitigationFnSO, ITaggable
- Inheritance
-
objectHyperbolicDamageMitigationFnSO
- Implements
-
ITaggable
- Inherited Members
Remarks
Mitigation has diminishing returns, but every point of X adds the same share of effective
health: effective health = health × (1 + X / K).
K is BaseValue + PerLevel × level: a constant (LoL: 100) or a level-dependent value
(WoW: 400 + 85 × level). Create instances via Assets -> Create -> Astra Health / Dmg Mitigation Functions / Hyperbolic Dmg Mitigation.
Methods
CalculateMitigatedDamage(long, double, RoundingMode)
Reduces damage with Damage × K / (X + K), evaluating K at level 1 because no
entity is known. The gameplay path uses the overload with a ReductionContext.
public override long CalculateMitigatedDamage(long amount, double defensiveStatValue, RoundingMode roundingMode)
Parameters
amountlongdefensiveStatValuedoubleroundingModeRoundingMode
Returns
- long
CalculateMitigatedDamage(long, double, RoundingMode, in ReductionContext)
Reduces damage with Damage × K / (X + K).
public override long CalculateMitigatedDamage(long amount, double defensiveStatValue, RoundingMode roundingMode, in ReductionContext context)
Parameters
amountlongIncoming damage amount.
defensiveStatValuedoubleDefensive stat value
X.roundingModeRoundingModeRounding mode applied to the fractional result.
contextReductionContextLevels used to evaluate
K.
Returns
- long
The reduced damage as a non-negative long.
Remarks
If defensiveStatValue is zero or negative the original damage is returned
(negative defense does not amplify damage, as with the logarithmic function). A K of zero
mitigates all damage. The result is non-negative and rounded with roundingMode.