Class DamageStep
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Base class for a single step in the damage calculation pipeline. A DamageStep performs a focused transformation on a DamageInfo instance (for example applying defenses, barriers or modifiers).
[Serializable]
public abstract class DamageStep
- Inheritance
-
objectDamageStep
- Derived
Properties
DisplayName
Human-readable name shown in editors and logs for this step. Implementations should return a short descriptive label.
public abstract string DisplayName { get; }
Property Value
- string
Methods
Process(DamageInfo)
Entry point executed by the pipeline runner. This method enforces common preconditions (skipping when already prevented or when the current amount is <= 0), invokes ProcessStep(DamageInfo), records the before/after amounts for tracing and sets the PipelineReducedToZero reason when a step reduces a positive amount to zero or less.
public DamageInfo Process(DamageInfo data)
Parameters
dataDamageInfoThe pipeline state being processed.
Returns
- DamageInfo
The same
datainstance, potentially modified by the step.
ProcessStep(DamageInfo)
Implement this method in derived classes to perform the actual transformation of the pipeline state.
public abstract DamageInfo ProcessStep(DamageInfo data)
Parameters
dataDamageInfoPipeline state to process. Implementations should mutate this instance to reflect changes.
Returns
- DamageInfo
The modified
datainstance.
Remarks
Accessing external services from a step:
Use pre-resolved properties on data for core framework dependencies
(data.TargetStats, data.TargetBarrier, data.PerformerStats).
For services provided by external packages, use
data.Target.TryGetComponent<IYourInterface>(out var svc) — the same pattern
used by ApplyDamageCapStep and ApplyDamageFloorStep.
This keeps DamageInfo lean while allowing full extensibility.