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
-
objectPreDamageContextConfig
Properties
DamageDealer
Which entity role from the incoming context deals the damage.
public ContextDealerRole DamageDealer { get; }
Property Value
DamageTarget
Which entity role from the incoming context receives the damage.
public ContextEntityRole DamageTarget { get; }
Property Value
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
dealerEntityCoreThe entity dealing the damage. May be
nullfor system-initiated damage. Ifnulland ElectricDrill.AstraHealth.Damage.PreDamageContextConfig._amountMode is ScalingFormula, the formula falls back toCalculateValue(target, target)with a warning. Ifnulland ElectricDrill.AstraHealth.Damage.PreDamageContextConfig._useCritStatForMultiplier is true, falls back to the ElectricDrill.AstraRpgFramework.Utils.Percentage multiplier.targetEntityCoreThe entity receiving the damage. Must not be
null.contextDamageAmountlong?The final damage amount from the originating context. Required when ElectricDrill.AstraHealth.Damage.PreDamageContextConfig._amountMode is DamageFromContext; ignored otherwise.
instigatorIEffectInstigatorOptional: 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).
isReactableboolWhether the resulting PreDamageContext is a first-order event that reactive systems (such as counter-damage actions) may respond to. Pass
falsewhen building a secondary effect (e.g. counter-damage, passive damage modifier) to prevent downstream chain reactions. Defaults totrue.
Returns
- PreDamageContext
A fully constructed PreDamageContext, or
nulliftargetisnull.