Table of Contents

Class DamageAmountContext

Namespace
ElectricDrill.AstraHealth.Damage
Assembly
com.electricdrill.astra-health.Runtime.dll

Holds numeric details related to an attempt to apply damage, allowing intermediate values to be recorded for each phase of the calculation pipeline (e.g. reductions, resistances, absorptions).

public class DamageAmountContext
Inheritance
object
DamageAmountContext

Remarks

This class is mutable for Current and keeps a list of DamageAmountContext.StepAmountRecord entries that describe the value before and after each step. It is used to trace how the initial raw value is transformed into the final damage applied.

Constructors

DamageAmountContext(long)

Creates a new instance of DamageAmountContext with the provided initial value.

public DamageAmountContext(long initialAmount)

Parameters

initialAmount long

Raw starting damage value.

Properties

Current

The current damage value during calculation; updated by the various phases. The value is clamped to a minimum of 0. Setting a negative value is a pipeline misconfiguration: a warning is emitted in development builds (UNITY_ASSERTIONS) to aid debugging.

public long Current { get; set; }

Property Value

long

InitialAmount

The raw initial value provided to the damage calculation pipeline.

public long InitialAmount { get; }

Property Value

long

Records

Read-only list of the recorded phase entries in order.

public IReadOnlyList<DamageAmountContext.StepAmountRecord> Records { get; }

Property Value

IReadOnlyList<DamageAmountContext.StepAmountRecord>

Methods

FromRaw(long)

Convenience factory that builds a DamageAmountContext from a raw value; equivalent to using the public constructor.

public static DamageAmountContext FromRaw(long raw)

Parameters

raw long

Raw damage value.

Returns

DamageAmountContext

A new DamageAmountContext initialized to raw.

GetStepAmount(Type)

Retrieves the record associated with a given phase identified by its type.

public DamageAmountContext.StepAmountRecord GetStepAmount(Type stepType)

Parameters

stepType Type

The phase type to look up.

Returns

DamageAmountContext.StepAmountRecord

The corresponding DamageAmountContext.StepAmountRecord or the default if not found.

Remarks

If no matching record exists the default value of DamageAmountContext.StepAmountRecord is returned (with StepType possibly null).