Class PercentageDamageMitigationFnSO
- Assembly
- com.electricdrill.astra-health.Runtime.dll
public class PercentageDamageMitigationFnSO : DamageMitigationFnSO, ITaggable
- Inheritance
-
objectPercentageDamageMitigationFnSO
- Implements
-
ITaggable
- Inherited Members
Methods
CalculateMitigatedDamage(long, double, RoundingMode)
Reduces damage by a percentage determined by defensiveStatValue.
Example: defensiveStatValue == 25 -> damage reduced by 25%.
public override long CalculateMitigatedDamage(long amount, double defensiveStatValue, RoundingMode roundingMode)
Parameters
amountlongIncoming damage amount.
defensiveStatValuedoublePercentage (0..100+). Treated as a percent reduction of the incoming damage.
roundingModeRoundingModeRounding mode applied to the final fractional damage value.
Returns
- long
The reduced damage as a non-negative long.
Remarks
The computation is: reducedAmount = amount - amount * defensiveStatValue / 100.0 The result is clamped to a minimum of 0 and rounded to the nearest integer.