fix(abilities): general intra-action continuation for effect-level pauses
Previously, pausing effects (CloneSpiritAsToken/TargetTile,
ChannelCardFromZone/TargetTile+Choice, StackDeck interactive) only stored
the outer action-sequence continuation. Any effects after the pausing one on
the same target, and any remaining targets in the same action, were silently
dropped on resume. This commit makes pause/resume fully general.
Mechanism:
- New IntraActionStep private class: { TargetRef, EffectsJson }
- BuildIntraActionContinuationJson(currentTarget, ctx) captures:
• remaining effects on the paused target (effects[effectIndex+1..])
• all effects applied to each remaining target (targets[targetIndex+1..])
- ApplyIntraActionContinuation applies those steps at resume time before
the outer continuation actions
- FindTargetByRef / GetTargetRef round-trip any resolved target type
(FieldCard, CardInstance, PlayerState, Coord) through a string ref
AbilityContext gains 5 per-iteration tracking fields set by ExecuteSingleAction:
CurrentEffectIndex, CurrentTargetIndex, CurrentActionTargets,
CurrentActionAllEffects, CurrentActionDuration
ExecuteSingleAction target/effect loops converted from foreach to indexed
for-loops so ctx position fields stay in sync with each ExecuteEffect call.
IntraActionContinuationJson added to PendingTilePick, PendingPlayerPick,
and PendingRevealChoicePick. All three pause-emitting cases (CloneSpiritAsToken,
ChannelCardFromZone x2, StackDeck) populate it. All three resume methods
(ResumeTilePick, ResumePlayerPick, ResumeRevealChoicePick) call
ApplyIntraActionContinuation before executing outer continuation.
ChannelCardFromZone player-pick-to-tile-pick chain now forwards
IntraActionContinuationJson so it survives a double-pause sequence.
The "DESIGN CONSTRAINT: pausing effects must be terminal" comment is removed
as it is no longer true.
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:
@@ -36,6 +36,12 @@ public sealed class PendingPlayerPick
|
||||
|
||||
// ── Continuation ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Serialized IntraActionStep[] — remaining work within the paused action.
|
||||
/// Applied by the resume handler before executing ContinuationActionsJson.
|
||||
/// </summary>
|
||||
public string? IntraActionContinuationJson { get; set; }
|
||||
|
||||
public string ContinuationActionsJson { get; set; } = "[]";
|
||||
public string? RangeJson { get; set; }
|
||||
public string? ForceDurationJson { get; set; }
|
||||
|
||||
@@ -33,6 +33,12 @@ public sealed class PendingRevealChoicePick
|
||||
|
||||
// ── Continuation ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Serialized IntraActionStep[] — remaining work within the paused action.
|
||||
/// Applied by the resume handler before executing ContinuationActionsJson.
|
||||
/// </summary>
|
||||
public string? IntraActionContinuationJson { get; set; }
|
||||
|
||||
public string ContinuationActionsJson { get; set; } = "[]";
|
||||
public string? RangeJson { get; set; }
|
||||
public string? ForceDurationJson { get; set; }
|
||||
|
||||
@@ -47,6 +47,13 @@ public sealed class PendingTilePick
|
||||
|
||||
// ── Continuation ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Serialized IntraActionStep[] — remaining work within the paused action
|
||||
/// (remaining effects on the current target, then all effects on remaining targets).
|
||||
/// Applied by the resume handler before executing ContinuationActionsJson.
|
||||
/// </summary>
|
||||
public string? IntraActionContinuationJson { get; set; }
|
||||
|
||||
public string ContinuationActionsJson { get; set; } = "[]";
|
||||
public string? RangeJson { get; set; }
|
||||
public string? ForceDurationJson { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user