feat(ability-prompts): wire all 8 pending pick types end-to-end

Server:
- GameMessages.cs: add push DTOs for CostGroupPick, ActionGroupPick,
  BranchPick, TargetPick, TilePick, PlayerPick, RevealChoicePick
- GameHandlerBase.PushStateToPlayersAsync: push all 8 pending types
  (including existing CostPick which was missing its push) to the
  chooser player after every state update and on reconnect

Client:
- Game.gd: add 8 signals, 8 send functions, 8 push routes matching
  game.ability.{cost,cost_group,action_group,branch,target,tile,player,
  reveal_choice}_pick_request
- game_screen.gd: add handlers for all 8 types:
  - cost_pick: hand-card selection panel with confirm
  - cost_group_pick / action_group_pick: option-button panels
  - branch_pick: same UI as local ChooseOne but sends game.branch_pick
  - target_pick: reuses ABILITY_TARGET mode, flag routes to game.target_pick
  - tile_pick: highlights valid tiles, click sends game.tile_pick
  - player_pick: player-button panel from server-supplied validPlayerIds
  - reveal_choice_pick: click-to-order card list, sends game.reveal_choice_pick

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-21 17:02:12 -04:00
co-authored by Claude Happy
parent 9772679a2f
commit c45db289ad
4 changed files with 782 additions and 0 deletions
+93
View File
@@ -949,3 +949,96 @@ public sealed record GamePlayerPickRequest(
/// <summary>Acknowledged response for a player pick submission.</summary>
public sealed record GamePlayerPickResponse(bool Success);
// ── Ability-pause push DTOs (server → client) ─────────────────────────────────
/// <summary>
/// Pushed to the chooser when a CostGroup with OR/XOR logic requires a choice.
/// The chooser responds with <see cref="GameCostGroupPickRequest"/>.
/// </summary>
public sealed record CostGroupPickRequestPush(
string RequestId,
string SourceInstanceId,
/// <summary>JSON-serialized CostGroup — full group definition for display.</summary>
string CostGroupJson);
/// <summary>
/// Pushed to the chooser when an ActionGroup with OR/XOR logic requires a choice.
/// The chooser responds with <see cref="GameActionGroupPickRequest"/>.
/// </summary>
public sealed record ActionGroupPickRequestPush(
string RequestId,
string SourceInstanceId,
/// <summary>JSON-serialized ActionGroup — full group definition for display.</summary>
string ActionGroupJson);
/// <summary>
/// Pushed to the chooser (Opponent/Ally) when a ChooseOne requires a branch selection.
/// The chooser responds with <see cref="GameBranchPickRequest"/>.
/// </summary>
public sealed record BranchPickRequestPush(
string RequestId,
string SourceInstanceId,
int BranchCount,
/// <summary>JSON-serialized Branch[] for display labels.</summary>
string BranchesJson);
/// <summary>
/// Pushed to the chooser (Opponent/Ally) when a leaf Action needs target picks
/// from the non-activating player.
/// The chooser responds with <see cref="GameTargetPickRequest"/>.
/// </summary>
public sealed record TargetPickRequestPush(
string RequestId,
string SourceInstanceId,
/// <summary>JSON-serialized Action — full selector for client highlight logic.</summary>
string ActionJson,
/// <summary>JSON-serialized AbilityRange? — null when no range constraint.</summary>
string? RangeJson);
/// <summary>
/// Pushed to the chooser when an effect requires a tile selection.
/// The chooser responds with <see cref="GameTilePickRequest"/>.
/// </summary>
public sealed record TilePickRequestPush(
string RequestId,
string SourceInstanceId,
/// <summary>Discriminator for display (e.g. "CloneSpiritAsToken", "RelocateRuin").</summary>
string EffectType,
bool RequireEmpty,
bool RequireOccupied,
string? OccupantOwnership,
/// <summary>Max tile distance from source; 0 = unlimited.</summary>
int MaxRange,
/// <summary>InstanceId of the primary target already resolved (e.g. the Spirit to clone). Empty when N/A.</summary>
string TargetInstanceId);
/// <summary>
/// Pushed to the chooser when an effect requires a player selection.
/// The chooser responds with <see cref="GamePlayerPickRequest"/>.
/// </summary>
public sealed record PlayerPickRequestPush(
string RequestId,
string SourceInstanceId,
/// <summary>Discriminator for display (e.g. "ChannelCardFromZone").</summary>
string EffectType,
/// <summary>"Self" | "Opponent" | "Any" — ownership hint for display.</summary>
string Ownership,
/// <summary>Account IDs of valid player choices.</summary>
IReadOnlyList<string> ValidPlayerIds,
/// <summary>InstanceId of the primary target already resolved. Empty when N/A.</summary>
string TargetInstanceId);
/// <summary>
/// Pushed to the chooser when cards have been revealed and must be ordered
/// (e.g. StackDeckEffect interactive path).
/// The chooser responds with <see cref="GameRevealChoicePickRequest"/>.
/// </summary>
public sealed record RevealChoicePickRequestPush(
string RequestId,
string SourceInstanceId,
string EffectType,
/// <summary>JSON-serialized CardInstance[] — the revealed cards to order.</summary>
string RevealedCardsJson,
/// <summary>How many cards must be included in the ordered response.</summary>
int Count);
@@ -278,6 +278,107 @@ internal abstract class GameHandlerBase
actionJson,
pending.RangeJson)), ct);
}
// Push prompts for all other ability-pause types.
if (state.PendingCostPick is { } cp)
await clientPush.PushAsync(cp.PickerActorId,
ServerMessage.Push("game.ability.cost_pick_request",
new CostPickRequestPush(
cp.RequestId,
cp.SourceInstanceId,
cp.CostType,
cp.Amount,
cp.PickMode,
cp.FiltersJson)), ct);
if (state.PendingCostGroupPick is { } cgp)
{
var chooser = string.IsNullOrEmpty(cgp.ChooserActorId) ? cgp.ActorId : cgp.ChooserActorId;
await clientPush.PushAsync(chooser,
ServerMessage.Push("game.ability.cost_group_pick_request",
new CostGroupPickRequestPush(
cgp.RequestId,
cgp.SourceInstanceId,
cgp.CostGroupJson)), ct);
}
if (state.PendingActionGroupPick is { } agp)
{
var chooser = string.IsNullOrEmpty(agp.ChooserActorId) ? agp.ActorId : agp.ChooserActorId;
await clientPush.PushAsync(chooser,
ServerMessage.Push("game.ability.action_group_pick_request",
new ActionGroupPickRequestPush(
agp.RequestId,
agp.SourceInstanceId,
agp.ActionGroupJson)), ct);
}
if (state.PendingBranchPick is { } bp)
{
var chooser = string.IsNullOrEmpty(bp.ChooserActorId) ? bp.ActorId : bp.ChooserActorId;
await clientPush.PushAsync(chooser,
ServerMessage.Push("game.ability.branch_pick_request",
new BranchPickRequestPush(
bp.RequestId,
bp.SourceInstanceId,
bp.BranchCount,
bp.BranchesJson)), ct);
}
if (state.PendingTargetPick is { } ttp)
{
var chooser = string.IsNullOrEmpty(ttp.ChooserActorId) ? ttp.ActorId : ttp.ChooserActorId;
await clientPush.PushAsync(chooser,
ServerMessage.Push("game.ability.target_pick_request",
new TargetPickRequestPush(
ttp.RequestId,
ttp.SourceInstanceId,
ttp.ActionJson,
ttp.RangeJson)), ct);
}
if (state.PendingTilePick is { } tp)
{
var chooser = string.IsNullOrEmpty(tp.ChooserActorId) ? tp.ActorId : tp.ChooserActorId;
await clientPush.PushAsync(chooser,
ServerMessage.Push("game.ability.tile_pick_request",
new TilePickRequestPush(
tp.RequestId,
tp.SourceInstanceId,
tp.EffectType,
tp.RequireEmpty,
tp.RequireOccupied,
tp.OccupantOwnership,
tp.MaxRange,
tp.TargetInstanceId)), ct);
}
if (state.PendingPlayerPick is { } pp)
{
var chooser = string.IsNullOrEmpty(pp.ChooserActorId) ? pp.ActorId : pp.ChooserActorId;
await clientPush.PushAsync(chooser,
ServerMessage.Push("game.ability.player_pick_request",
new PlayerPickRequestPush(
pp.RequestId,
pp.SourceInstanceId,
pp.EffectType,
pp.Ownership,
pp.ValidPlayerIds,
pp.TargetInstanceId)), ct);
}
if (state.PendingRevealChoicePick is { } rcp)
{
var chooser = string.IsNullOrEmpty(rcp.ChooserActorId) ? rcp.ActorId : rcp.ChooserActorId;
await clientPush.PushAsync(chooser,
ServerMessage.Push("game.ability.reveal_choice_pick_request",
new RevealChoicePickRequestPush(
rcp.RequestId,
rcp.SourceInstanceId,
rcp.EffectType,
rcp.RevealedCardsJson,
rcp.Count)), ct);
}
}
// OP config snapshot — read from RuleSnapshotJson at finalization time.