Class DamageMitigationFnSO
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Base type for damage mitigation functions. Implementations compute how an incoming damage amount is reduced using a defensive statistic value.
public abstract class DamageMitigationFnSO : ReductionFnSO, ITaggable
- Inheritance
-
objectDamageMitigationFnSO
- Implements
-
ITaggable
- Derived
- Inherited Members
Methods
CalculateMitigatedDamage(long, double, RoundingMode)
Reduces the specified amount of damage using the provided defensive
statistic value and returns the resulting damage amount rounded with roundingMode.
public abstract long CalculateMitigatedDamage(long amount, double defensiveStatValue, RoundingMode roundingMode)
Parameters
amountlongThe original incoming damage amount to be reduced.
defensiveStatValuedoubleThe value of the defensive statistic used to reduce damage (semantics depend on the implementation: absolute value, percentage, etc.).
roundingModeRoundingModeRounding mode applied to fractional results.
Returns
- long
The reduced damage amount as a non-negative long. Implementations should ensure the returned value is >= 0 and apply
roundingModeto fractional results.
CalculateMitigatedDamage(long, double, RoundingMode, in ReductionContext)
Same as CalculateMitigatedDamage(long, double, RoundingMode), for functions that also depend on the entities involved (a constant that grows with the attacker's level, another stat of the target). The damage pipeline always calls this overload.
public virtual long CalculateMitigatedDamage(long amount, double defensiveStatValue, RoundingMode roundingMode, in ReductionContext context)
Parameters
amountlongThe original incoming damage amount to be reduced.
defensiveStatValuedoubleThe value of the defensive statistic used to reduce damage.
roundingModeRoundingModeRounding mode applied to fractional results.
contextReductionContextThe entities involved in the hit: their levels and stats. Valid only during the call.
Returns
- long
The reduced damage amount as a non-negative long.
Remarks
The default implementation ignores context and forwards to the abstract overload,
so existing implementations keep working unchanged. Override it to use the context.