Class StatusEffectSystem
- Namespace
- AshesOfVelsingrad.Systems
- Assembly
- Ashes of Velsingrad.dll
Manages the lifecycle and application of StatusEffect<TTarget>s for all tracked targets in the game, including units and map cells.
public sealed class StatusEffectSystem
- Inheritance
-
StatusEffectSystem
- Inherited Members
Remarks
This system keeps track of every target that has active status effects, applies new effects, handles stacking, and processes end-of-turn updates. Targets must implement IEffectTarget<TTarget> and be either a UnitSystem or a MapSystem.
Methods
ApplyEffect<TTarget>(IEffectTarget<TTarget>, StatusEffect<TTarget>)
Applies a new status effect to the given target, or stacks it if already present.
public void ApplyEffect<TTarget>(IEffectTarget<TTarget> target, StatusEffect<TTarget> newEffect)
Parameters
targetIEffectTarget<TTarget>The target on which to apply the status effect.
newEffectStatusEffect<TTarget>The StatusEffect<TTarget> to apply.
Type Parameters
TTargetThe type of the target, must be either UnitSystem or MapSystem.
Remarks
If the target already has an effect of the same type and it is stackable, the effect will be stacked instead of being applied again.
ProcessTurnEnd()
Processes end-of-turn updates for all tracked targets.
public void ProcessTurnEnd()
Remarks
Iterates over all tracked targets in AshesOfVelsingrad.Systems.StatusEffectSystem._allTargets and updates their status effects. Expired effects are removed, and targets with no remaining effects are removed from the tracking list. Only targets of type CellInformation are processed by this method.
ProcessUnitStatusEffects(IEffectTarget<UnitSystem>?)
Processes status effect updates for a single target.
public void ProcessUnitStatusEffects(IEffectTarget<UnitSystem>? target)
Parameters
targetIEffectTarget<UnitSystem>The target whose status effects should be updated.
Remarks
Each status effect has its OnTurnPassed(IEffectTarget<TTarget>) method called, and expired effects are removed automatically. If a target has no more active effects, it is removed from the tracking list.