Add duration tracking — TrackEffect, TrackTick, ExpireActiveEffects, TickActiveEffects

- ExecuteEffect now builds and stores reversal effects in GameState.ActiveEffects
  for all non-Instant durations (stat deltas, flag toggles, genus, affinity)
- DOT/HOT effects register tick entries instead of reversals
- TrackedDuration wrapper records owner + IsTick flag alongside DurationModel
- ExpireActiveEffects handles UntilEndOfTurn, UntilStartOfOwnerTurn, ForNTurns,
  WhileCondition; applies reversal on expiry for non-tick entries
- TickActiveEffects fires DOT/HOT damage/healing each turn end
- GameEngine.EndTurn: tick → expire(end) after TurnEnd trigger;
  expire(start) after player switch, before TurnStart trigger

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-02-26 16:35:37 -05:00
co-authored by Claude Happy
parent be8c0844c6
commit 39b80ccbdd
2 changed files with 369 additions and 19 deletions
+7
View File
@@ -689,6 +689,10 @@ public static class GameEngine
ActorId = actorId,
});
// Tick DOT/HOT effects, then expire UntilEndOfTurn and ForNTurns effects.
AbilitySystem.TickActiveEffects(state, actorId);
AbilitySystem.ExpireActiveEffects(state, actorId, isEndOfTurn: true);
// Switch active player.
state.ActivePlayerAccountId = GetOpponentId(state, actorId);
state.TurnNumber++;
@@ -714,6 +718,9 @@ public static class GameEngine
state.Phase = GamePhase.Draw;
// Expire UntilStartOfOwnerTurn effects now that the new active player is set.
AbilitySystem.ExpireActiveEffects(state, state.ActivePlayerAccountId, isEndOfTurn: false);
AbilitySystem.FireTrigger(state, new TriggerOccurrence
{
Kind = TriggerEventKind.TurnStart,