Table of Contents

Class PreDamageContext

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

Mutable pre-damage context raised via the pre-damage game event before the damage pipeline runs. Listeners may mutate Amount, Type, IsCritical, CriticalMultiplier and Ignore to transform the incoming damage — e.g. convert magical damage above a threshold into physical, apply a flat reduction, or negate it entirely by setting Ignore. The pipeline reads these fields after the event is dispatched. Use Builder to construct instances via the fluent step builder.

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

Properties

Amount

The raw damage amount (before modifiers). Listeners may mutate this to transform the incoming damage.

public long Amount { get; set; }

Property Value

long

Builder

Entry point for the fluent builder. Example:

var pre = PreDamageContext.Builder
    .WithAmount(10)
    .WithType(DamageType.Physical)
    .WithSource(DamageSource.Weapon)
    .WithTarget(targetEntity)
    .WithPerformer(dealerEntity)   // optional
    .WithIsCritical(false)
    .Build();
public static PreDamageContext.DamageInfoAmount Builder { get; }

Property Value

PreDamageContext.DamageInfoAmount

CriticalMultiplier

Multiplier applied when this is critical damage. A value of 1.0 means no change. Values <= 0 are normalized to 1.0 by the constructor. Listeners may mutate this.

public double CriticalMultiplier { get; set; }

Property Value

double

DamageSource

The source or reason for the damage (for example an ability or environmental effect).

public DamageSourceSO DamageSource { get; }

Property Value

DamageSourceSO

Entity

The entity that will receive the damage. Same as Target in this case.

public EntityCore Entity { get; }

Property Value

EntityCore

Ignore

If true, the damage will be ignored and not applied to the target. Use this in cases where the damage should be negated (e.g., passive abilities). Listeners may mutate this.

public bool Ignore { get; set; }

Property Value

bool

Instigator

The specific thing that caused this damage — for example an ability definition, a modifier instance, or a passive. Use pattern matching to identify the concrete type. May be null if no specific instigator is relevant beyond Performer and DamageSource.

public IEffectInstigator Instigator { get; }

Property Value

IEffectInstigator

IsCritical

Whether this damage instance was flagged as a critical hit. Listeners may mutate this.

public bool IsCritical { get; set; }

Property Value

bool

IsReactable

When true, reactive systems (such as counter-damage actions) may respond to this event. When false, reactive systems should skip execution to prevent chain reactions. Defaults to true. Set to false when building contexts for secondary effects such as counter-damage or passive damage modifiers that react to other damage events.

public bool IsReactable { get; }

Property Value

bool

Performer

The entity that deals the damage (may be null for environmental or system-initiated damage).

public EntityCore Performer { get; }

Property Value

EntityCore

Target

The entity that will receive the damage.

public EntityCore Target { get; }

Property Value

EntityCore

Type

The type/category of the damage (e.g. physical, magical). Listeners may mutate this to convert the damage into a different type before the pipeline runs.

public DamageTypeSO Type { get; set; }

Property Value

DamageTypeSO