Table of Contents

Class DealDamageGameActionSO<TContext>

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

Abstract base game action that inflicts configured damage on the entity carried by the incoming context. Works with any context implementing ElectricDrill.AstraRpgFramework.Contexts.IHasEntity: the context entity is the damage target by default, while the dealer is resolved from the embedded PreDamageContextConfig (None → system damage, any context role → self-inflicted damage from that same entity).

Unlike CounterDamageGameActionSO<TContext> — which reacts to a resolved damage event — this action is meant to be a deliberate, first-order damage application (e.g. a periodic tick, an on-death explosion, an ability payload). By default the produced PreDamageContext is reactable so downstream reactive systems can respond to it; disable ElectricDrill.AstraHealth.GameActions.Actions.DealDamageGameActionSO<TContext>._isReactable when the damage is itself a secondary effect that should not spawn further reactions.

This class implements ElectricDrill.AstraRpgFramework.Contexts.IEffectInstigator so it can be passed as the instigator of the damage it produces. Listeners can then check ctx.Instigator == thisActionSO to identify and filter self-triggered cycles.

When TContext also implements IHasAmount, the carried amount is forwarded to the config so DamageFromContext keeps working; otherwise that mode falls back to 0 with a warning.

public abstract class DealDamageGameActionSO<TContext> : GameAction<TContext>, IExecutable<TContext>, ITaggable, IEffectInstigator where TContext : IHasEntity

Type Parameters

TContext

Context type implementing ElectricDrill.AstraRpgFramework.Contexts.IHasEntity.

Inheritance
object
GameActionBase
GameAction<TContext>
DealDamageGameActionSO<TContext>
Implements
IExecutable<TContext>
ITaggable
IEffectInstigator
Derived
Inherited Members
GameAction<TContext>.Tags
GameAction<TContext>.DisplayName
GameAction<TContext>.ExecuteAsyncForUnityEvent(TContext)
GameAction<TContext>.OnOperationCanceled()

Methods

ExecuteAsync(TContext, CancellationToken)

Executes the action asynchronously with the provided context. Override this method to implement your action logic.

public override Awaitable ExecuteAsync(TContext context, CancellationToken cancellationToken = default)

Parameters

context TContext

The context object containing information needed for execution.

cancellationToken CancellationToken

Token to cancel the operation. MonoBehaviour owners can use their "destroyCancellationToken" to automatically cancel when destroyed.

Returns

Awaitable

An Awaitable that completes when the action finishes.

ResolveDealer(TContext)

Resolves the entity attributed as the damage dealer. Returns null (system damage) when the config selects None; otherwise returns the context entity itself (self-inflicted damage).

protected virtual EntityCore ResolveDealer(TContext context)

Parameters

context TContext

Returns

EntityCore

ResolveTarget(TContext)

Resolves the entity that will receive the damage. Defaults to the context entity.

protected virtual EntityCore ResolveTarget(TContext context)

Parameters

context TContext

Returns

EntityCore