Class CounterDamageGameActionSO<TContext>
- Namespace
- ElectricDrill.AstraHealth.GameActions.Actions
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Abstract base game action that reacts to a resolved damage event by inflicting damage in return. Works with any context implementing ElectricDrill.AstraRpgFramework.Contexts.IHasTarget, ElectricDrill.AstraRpgFramework.Contexts.IHasPerformer and IHasAmount: compatible with DamageResolutionContext, EntityDiedContext, and others.
This class implements ElectricDrill.AstraRpgFramework.Contexts.IEffectInstigator so it can be passed as the instigator
of the counter-damage it produces. Listeners can then check
ctx.Instigator == thisActionSO to identify and filter self-triggered cycles.
public abstract class CounterDamageGameActionSO<TContext> : GameAction<TContext>, IExecutable<TContext>, ITaggable, IEffectInstigator where TContext : IHasTarget, IHasPerformer, IHasInstigator, IHasAmount, IReactable
Type Parameters
TContextContext type implementing ElectricDrill.AstraRpgFramework.Contexts.IHasTarget, ElectricDrill.AstraRpgFramework.Contexts.IHasPerformer, ElectricDrill.AstraRpgFramework.Contexts.IHasInstigator and IHasAmount.
- Inheritance
-
objectGameActionBaseGameAction<TContext>CounterDamageGameActionSO<TContext>
- Implements
-
IExecutable<TContext>ITaggableIEffectInstigator
- Derived
- Inherited Members
-
GameAction<TContext>.TagsGameAction<TContext>.DisplayNameGameAction<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
contextTContextThe context object containing information needed for execution.
cancellationTokenCancellationTokenToken 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.