feat(phase8): complete remaining 3 gaps -- pending types, StackDeck interactive, canvas builder

Pending interaction coverage:
- Add PendingTilePick model (tile-select pause for effects like CloneSpiritAsToken TargetTile)
- Add PendingPlayerPick model (player-select pause for ChannelCardFromZone UnderControlOf: Choice)
- Add PendingRevealChoicePick model (reveal-and-order pause for StackDeck interactive path)
- Add all three as nullable properties on GameState

StackDeckEffect interactive flow:
- Replace random-shuffle fallback with chooser-aware branching
- Self/Opponent chooser: remove top N from deck, emit PendingRevealChoicePick pause
- Random/empty chooser: random shuffle fallback (unchanged)
- Add ResumeRevealChoicePick(): restore deck in chooser's ordered indices; unspecified
  cards placed beneath chosen cards preserving relative order

Canvas AbilityBuilder (Phase 4 spec):
- Add @inject IJSRuntime + @implements IAsyncDisposable to AbilityBuilder.razor
- Add sorAdmin.abilityBuilder JS shim in admin.js: non-passive wheel listener (zoom),
  pinch-to-zoom via touch distance delta, cleanup on dispose
- Canvas mode toggle button in form toolbar ("Visual Canvas")
- Full canvas layout: left panel (ability list + node palette), main canvas, right inspector
- Dark canvas background (#111827), CSS transform pan+zoom (translate then scale)
- SVG bezier edge overlay connecting node flow (Meta→Range/Trigger→Cost→Cond→ActionGroup
  →Actions→Effects, ActionGroup→SubGroups→their Actions→their Effects)
- Node types: Meta (blue), Range (teal), Trigger (purple), Cost (amber), Conditions (yellow),
  ActionGroup (dark green), Action (green), Effect (red), SubGroup (dark green), SubGroupAction,
  SubGroupEffect -- each draggable, click-to-select
- Inspector panel: inline editing for all node types (type/name/desc, range fields, trigger
  event, group logic op, action target selector, effect type picker)
- AutoLayoutAbility() positions nodes on first focus; SetPos() preserves drag positions
- Zoom/pan: toolbar +/- buttons + scroll wheel (via JS) + middle-mouse drag
- OnCanvasWheel [JSInvokable] + DisposeAsync cleanup
- Form view toggle restores full form; JSON preview always visible

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-04-20 20:27:20 -04:00
co-authored by Claude Happy
parent 1d5ae4aa20
commit 80b92b17b9
7 changed files with 1099 additions and 16 deletions
@@ -0,0 +1,30 @@
namespace SOR.Game.Abilities.Models;
/// <summary>
/// Pauses execution when an effect needs a human to select a player
/// (e.g. ChannelCardFromZoneEffect with UnderControlOf: Choice).
/// Resumed by <c>game.player_pick</c> message.
/// </summary>
public sealed class PendingPlayerPick
{
public string RequestId { get; set; } = Guid.NewGuid().ToString("N");
public string ActorId { get; set; } = string.Empty;
public string ChooserActorId { get; set; } = string.Empty;
public string SourceInstanceId { get; set; } = string.Empty;
/// <summary>Discriminator used by ResumeXxx to know what to do with the picked player.</summary>
public string EffectType { get; set; } = string.Empty;
// ── Candidate pool (sent to client for display) ───────────────────────────
/// <summary>"Self" | "Opponent" | "Any" — ownership filter on valid player choices.</summary>
public string Ownership { get; set; } = "Any";
/// <summary>Account IDs of the valid choices (populated by engine at pause time).</summary>
public List<string> ValidPlayerIds { get; set; } = new();
// ── Continuation ─────────────────────────────────────────────────────────
public string ContinuationActionsJson { get; set; } = "[]";
public string? RangeJson { get; set; }
public string? ForceDurationJson { get; set; }
}
@@ -0,0 +1,39 @@
namespace SOR.Game.Abilities.Models;
/// <summary>
/// Pauses execution when cards are revealed face-up and a player must choose
/// an ordering or selection from them (e.g. StackDeckEffect chooser).
/// Resumed by <c>game.reveal_choice_pick</c> message carrying an ordered array of indices.
/// </summary>
public sealed class PendingRevealChoicePick
{
public string RequestId { get; set; } = Guid.NewGuid().ToString("N");
public string ActorId { get; set; } = string.Empty;
public string ChooserActorId { get; set; } = string.Empty;
public string SourceInstanceId { get; set; } = string.Empty;
/// <summary>Discriminator: "StackDeck" | future uses.</summary>
public string EffectType { get; set; } = string.Empty;
// ── Revealed card set ─────────────────────────────────────────────────────
/// <summary>
/// Serialized CardInstance[] — the revealed cards the chooser sees and orders.
/// Temporarily removed from the deck while this state is pending.
/// </summary>
public string RevealedCardsJson { get; set; } = "[]";
/// <summary>How many cards the chooser must include in their response ordering.</summary>
public int Count { get; set; } = 1;
// ── Context ───────────────────────────────────────────────────────────────
/// <summary>AccountId of the player whose deck receives the ordered cards.</summary>
public string TargetPlayerAccountId { get; set; } = string.Empty;
// ── Continuation ─────────────────────────────────────────────────────────
public string ContinuationActionsJson { get; set; } = "[]";
public string? RangeJson { get; set; }
public string? ForceDurationJson { get; set; }
}
@@ -0,0 +1,34 @@
namespace SOR.Game.Abilities.Models;
/// <summary>
/// Pauses execution when an effect needs a human to select a specific tile
/// (e.g. CloneSpiritAsToken with TargetTile destination, RelocateRuin).
/// Resumed by <c>game.tile_pick</c> message.
/// </summary>
public sealed class PendingTilePick
{
public string RequestId { get; set; } = Guid.NewGuid().ToString("N");
public string ActorId { get; set; } = string.Empty;
public string ChooserActorId { get; set; } = string.Empty;
public string SourceInstanceId { get; set; } = string.Empty;
/// <summary>Discriminator used by ResumeXxx to know what to do with the picked tile.</summary>
public string EffectType { get; set; } = string.Empty;
// ── Tile constraints (sent to client for validation) ─────────────────────
/// <summary>Tile must be empty (no occupant).</summary>
public bool RequireEmpty { get; set; }
/// <summary>Tile must have an occupant.</summary>
public bool RequireOccupied { get; set; }
/// <summary>"Owner" | "Ally" | "Enemy" | "Any" — ownership of occupant when RequireOccupied.</summary>
public string? OccupantOwnership { get; set; }
/// <summary>Max tiles from source; 0 = unlimited.</summary>
public int MaxRange { get; set; }
// ── Continuation ─────────────────────────────────────────────────────────
public string ContinuationActionsJson { get; set; } = "[]";
public string? RangeJson { get; set; }
public string? ForceDurationJson { get; set; }
}