Aura: self-apply Actions + ClearOnLeave / LingerDuration on leave

Previously, Aura abilities only fired OnEnterAuraRange / OnLeaveAuraRange
trigger events — their own Actions were never executed. Auras now directly
apply their Actions to any unit that enters range (using WhileSourceOnBattlefield
by default) and handle departure via three modes:

- Persist (default): effects expire at their configured Duration unchanged
- ClearOnLeave: effects are reverted immediately when the unit leaves range
- LingerDuration: effects switch to the specified duration when leaving range,
  allowing them to outlive the aura's reach (and the source if it leaves)

Server:
- AbilityDefinition: add ClearOnLeave (bool) and LingerDuration (DurationModel?)
- AbilitySystem: add ApplyAuraEffects + HandleAuraLeave helpers;
  refactor FireAuraTransition to take FieldCard + AbilityDefinition and call
  both helpers; update all six call sites in EvaluateAuraTransitions /
  EvaluateAurasOnEnter / EvaluateAurasOnLeave to use the unified path

Admin:
- AbilityBuilder: add AuraClearOnLeave / AuraLingerDurationStr / N draft fields;
  parse + compile round-trip; 3-radio On Leave UI + optional Linger duration select;
  update Aura help row to describe the new behaviour

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-03-24 21:11:56 -04:00
co-authored by Claude Happy
parent afb083093a
commit 9c42e5c1c8
3 changed files with 176 additions and 40 deletions
@@ -33,7 +33,19 @@ public sealed class AbilityDefinition
public int UsesPerTurn { get; set; } = 1;
// ── Aura only ────────────────────────────────────────────────────────────
public AbilityRange? AuraRange { get; set; }
public AbilityRange? AuraRange { get; set; }
/// <summary>
/// When true, effects applied by this aura to a unit are reverted immediately when that
/// unit leaves range. Default false: effects expire at their configured Duration.
/// Ignored when <see cref="LingerDuration"/> is set.
/// </summary>
public bool ClearOnLeave { get; set; }
/// <summary>
/// If set, effects switch to this duration when a unit leaves range instead of
/// being reverted immediately. Takes precedence over <see cref="ClearOnLeave"/>.
/// Null means effects expire at their own configured Duration.
/// </summary>
public DurationModel? LingerDuration { get; set; }
// ── Triggered only ───────────────────────────────────────────────────────
/// <summary>The event that fires this ability. Must be set for Triggered type.</summary>