Class LogDamageMitigationFnSO
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Legacy logarithmic mitigation. Kept so existing assets keep working; prefer
HyperbolicDamageMitigationFnSO for new work. For small defense values it behaves like
the hyperbolic function with K = BaseValue / ScaleFactor; at high values it grows far more slowly.
public class LogDamageMitigationFnSO : DamageMitigationFnSO, ITaggable
- Inheritance
-
objectLogDamageMitigationFnSO
- Implements
-
ITaggable
- Inherited Members
Methods
CalculateMitigatedDamage(long, double, RoundingMode)
Reduces damage using a logarithmic formula that produces diminishing returns as the defensive stat increases.
public override long CalculateMitigatedDamage(long amount, double defensiveStatValue, RoundingMode roundingMode)
Parameters
amountlongIncoming damage amount.
defensiveStatValuedoubleDefensive statistic value used to compute the mitigation multiplier.
roundingModeRoundingModeRounding mode applied to the final fractional damage value.
Returns
- long
The reduced damage as a non-negative long.
Remarks
Formula: Reduced Damage = Damage * (BaseValue / (BaseValue + Log(1 + DefensiveStat * ScaleFactor)))
If defensiveStatValue is zero or negative the original damage is returned.
The final result is clamped to be non-negative and rounded to the nearest integer.