Table of Contents

Class PreDamageContextConfig

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

Serializable configuration that fully describes a damage application and can build a PreDamageContext at runtime. Designed to be embedded in ScriptableObjects or MonoBehaviours.

[Serializable]
public class PreDamageContextConfig
Inheritance
object
PreDamageContextConfig

Properties

DamageDealer

Which entity role from the incoming context deals the damage.

public ContextDealerRole DamageDealer { get; }

Property Value

ContextDealerRole

DamageTarget

Which entity role from the incoming context receives the damage.

public ContextEntityRole DamageTarget { get; }

Property Value

ContextEntityRole

Methods

Build(EntityCore, EntityCore, long?, IEffectInstigator, bool)

Builds a PreDamageContext from pre-resolved dealer and target entities. The caller is responsible for resolving the correct ElectricDrill.AstraRpgFramework.EntityCore instances from the originating event context before invoking this method.

public PreDamageContext Build(EntityCore dealer, EntityCore target, long? contextDamageAmount = null, IEffectInstigator instigator = null, bool isReactable = true)

Parameters

dealer EntityCore

The entity dealing the damage. May be null for system-initiated damage. If null and ElectricDrill.AstraHealth.Damage.PreDamageContextConfig._amountMode is ScalingFormula, the formula falls back to CalculateValue(target, target) with a warning. If null and ElectricDrill.AstraHealth.Damage.PreDamageContextConfig._useCritStatForMultiplier is true, falls back to the ElectricDrill.AstraRpgFramework.Utils.Percentage multiplier.

target EntityCore

The entity receiving the damage. Must not be null.

contextDamageAmount long?

The final damage amount from the originating context. Required when ElectricDrill.AstraHealth.Damage.PreDamageContextConfig._amountMode is DamageFromContext; ignored otherwise.

instigator IEffectInstigator

Optional: the specific cause of this damage. Pass the originating modifier, ability, or game action so downstream listeners can identify and filter it (e.g., to prevent infinite counter-damage loops).

isReactable bool

Whether the resulting PreDamageContext is a first-order event that reactive systems (such as counter-damage actions) may respond to. Pass false when building a secondary effect (e.g. counter-damage, passive damage modifier) to prevent downstream chain reactions. Defaults to true.

Returns

PreDamageContext

A fully constructed PreDamageContext, or null if target is null.