Table of Contents

Class DamageResolutionContext

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

The immutable result returned by damage application attempts. Encapsulates whether the damage was applied or prevented, the reasons for prevention, and the concrete damage information that was ultimately applied (if any).

public sealed class DamageResolutionContext : IHasEntity, IHasTarget, IHasPerformer, IHasAmount, IHasInstigator, IReactable
Inheritance
object
DamageResolutionContext
Implements
IHasEntity
IHasTarget
IHasPerformer
IHasInstigator

Properties

Entity

The entity that received damage. Same as Target in this case.

public EntityCore Entity { get; }

Property Value

EntityCore

FinalDamageInfo

The final computed damage information that was applied to the target. This is non-null only when Outcome is Applied. The contained DamageInfo includes applied amount, barrier/health split, termination step type and any additional diagnostics produced by the pipeline.

public DamageInfo FinalDamageInfo { get; }

Property Value

DamageInfo

Instigator

The specific thing that caused this damage — propagated from the originating PreDamageContext. May be null if unspecified.

public IEffectInstigator Instigator { get; }

Property Value

IEffectInstigator

IsReactable

Propagated from IsReactable. When false, reactive systems should not respond to this damage resolution event.

public bool IsReactable { get; }

Property Value

bool

Outcome

The high-level outcome of the attempt: either Applied or Prevented.

public DamageOutcome Outcome { get; }

Property Value

DamageOutcome

Performer

public EntityCore Performer { get; }

Property Value

EntityCore

PreDamageContext

The original PreDamageContext that triggered this resolution. Useful for logging and diagnostic correlation.

public PreDamageContext PreDamageContext { get; }

Property Value

PreDamageContext

Reasons

When Outcome is Prevented, this contains the combined DamagePreventionReason flags explaining why. It will be None when Outcome is Applied.

public DamagePreventionReason Reasons { get; }

Property Value

DamagePreventionReason

Target

public EntityCore Target { get; }

Property Value

EntityCore

TerminationStepType

If the pipeline execution terminated early, this will contain the System.Type of the pipeline termination step that decided to stop processing. May be null when the pipeline completed normally.

public Type TerminationStepType { get; }

Property Value

Type

Methods

Applied(DamageInfo, PreDamageContext)

Create a DamageResolutionContext representing an applied damage attempt. The info parameter contains the concrete damage values applied.

public static DamageResolutionContext Applied(DamageInfo info, PreDamageContext pre)

Parameters

info DamageInfo

Final damage info that was applied.

pre PreDamageContext

Original pre-damage request.

Returns

DamageResolutionContext

A configured DamageResolutionContext with Outcome == Applied.

Prevented(DamagePreventionReason, PreDamageContext, DamageInfo)

Create a DamageResolutionContext representing a prevented damage attempt. reasons should explain why the attempt didn't apply. Optionally the info parameter may contain a partial DamageInfo produced before prevention.

public static DamageResolutionContext Prevented(DamagePreventionReason reasons, PreDamageContext pre, DamageInfo info = null)

Parameters

reasons DamagePreventionReason

Flags explaining the prevention.

pre PreDamageContext

Original pre-damage request.

info DamageInfo

Optional partial damage info produced before prevention.

Returns

DamageResolutionContext

A configured DamageResolutionContext with Outcome == Prevented.