Table of Contents

Class DamageMitigationFnSO

Namespace
ElectricDrill.AstraHealth.DamageMitigationFunctions
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
object
DamageMitigationFnSO
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

amount long

The original incoming damage amount to be reduced.

defensiveStatValue double

The value of the defensive statistic used to reduce damage (semantics depend on the implementation: absolute value, percentage, etc.).

roundingMode RoundingMode

Rounding 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 roundingMode to 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

amount long

The original incoming damage amount to be reduced.

defensiveStatValue double

The value of the defensive statistic used to reduce damage.

roundingMode RoundingMode

Rounding mode applied to fractional results.

context ReductionContext

The 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.