Choice/Discover-into-hand fanfares add a candidates-only token to hand; the
chosen cardId rides keyAction.selectCard on the generating play, not the
orderList add op. Record idx->chosenCardId at generation (candidate-membership
join) so the later play reveals the real identity via the existing
BuildPlayedCard path; forward {type,cardId} to the opponent and strip
selectCard for hidden (open:0) picks (pass through for open:1, provisional).
- KnownListBuilder.MineChoicePicks + StripKeyActionForOpponent (pure)
- BattleSessionState.RecordChoicePicksFrom (reuses IdxToCardId, no new state)
- PlayActionsBroadcastBody.keyAction + KeyActionEntry/SelectCardEntry
- PlayActionsHandler wires both; EchoHandler unchanged (picks ride the send)
Tests (TDD red->green): 8 KnownListBuilder + 2 dispatch + 2 conformance
(shape-locked to tk2_regular L151 generation / L193 reveal). Full suite 976/0.
Spec: docs/superpowers/specs/2026-06-04-battle-node-choice-token-reveal-design.md
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
50 lines
3.1 KiB
C#
50 lines
3.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace SVSim.BattleNode.Protocol.Bodies;
|
|
|
|
/// <summary>Opponent-facing PlayActions frame the node synthesizes from the active player's
|
|
/// send. <c>KnownList</c> reveals the played card's identity (null = token reveal deferred, see
|
|
/// the deterministic-turn slice). <c>OppoTargetList</c> is the renamed <c>targetList</c>
|
|
/// (independent of KnownList — a targeted hand play carries both). <c>KeyAction</c> forwards a
|
|
/// choice/Discover play's <c>{type,cardId}</c> so the opponent renders the choice-token generation;
|
|
/// the pick (<c>selectCard</c>) is stripped for a hidden (open:0) draw-to-hand choice. All three are
|
|
/// omitted when null via the envelope's WhenWritingNull policy (a vanilla play carries none).</summary>
|
|
public sealed record PlayActionsBroadcastBody(
|
|
[property: JsonPropertyName("playIdx")] int PlayIdx,
|
|
[property: JsonPropertyName("type")] int Type,
|
|
[property: JsonPropertyName("knownList")] IReadOnlyList<KnownCardEntry>? KnownList,
|
|
[property: JsonPropertyName("oppoTargetList")] IReadOnlyList<OppoTargetEntry>? OppoTargetList,
|
|
[property: JsonPropertyName("keyAction")] IReadOnlyList<KeyActionEntry>? KeyAction = null) : IMsgBody;
|
|
|
|
/// <summary>Opponent-facing keyAction entry for a choice/Discover play. <c>type</c>/<c>cardId</c>
|
|
/// (the GENERATING card) pass through so the opponent re-derives the candidate pool from that card's
|
|
/// skill; <c>selectCard</c> is stripped (null) for a hidden (open:0) choice — the pick stays secret
|
|
/// until the chosen card is played — and passed through for a visible (open:1) board choice (§6,
|
|
/// provisional pending live confirmation).</summary>
|
|
public sealed record KeyActionEntry(
|
|
[property: JsonPropertyName("type")] int Type,
|
|
[property: JsonPropertyName("cardId")] long CardId,
|
|
[property: JsonPropertyName("selectCard")] SelectCardEntry? SelectCard);
|
|
|
|
/// <summary>A visible choice's revealed pick: the chosen <c>cardId</c>(s) and the <c>open</c> flag.
|
|
/// Only emitted for the open:1 pass-through case (open:0 strips the whole <c>selectCard</c>).</summary>
|
|
public sealed record SelectCardEntry(
|
|
[property: JsonPropertyName("cardId")] IReadOnlyList<long> CardId,
|
|
[property: JsonPropertyName("open")] int Open);
|
|
|
|
/// <summary>One revealed card in a <c>knownList</c>. Vanilla slice fills cardId from the sender's
|
|
/// deck map and leaves spellboost 0 / attachTarget "" (cost/clan/tribe deferred to the card-master
|
|
/// port — the receiver re-derives them from cardId).</summary>
|
|
public sealed record KnownCardEntry(
|
|
[property: JsonPropertyName("idx")] int Idx,
|
|
[property: JsonPropertyName("cardId")] long CardId,
|
|
[property: JsonPropertyName("to")] int To,
|
|
[property: JsonPropertyName("spellboost")] int Spellboost,
|
|
[property: JsonPropertyName("attachTarget")] string AttachTarget);
|
|
|
|
/// <summary>Renamed <c>targetList</c> entry. <c>isSelf</c> is actor-relative and passes through
|
|
/// verbatim — no perspective flip (bullet-3 audit F2).</summary>
|
|
public sealed record OppoTargetEntry(
|
|
[property: JsonPropertyName("targetIdx")] int TargetIdx,
|
|
[property: JsonPropertyName("isSelf")] int IsSelf);
|