fix(ability-prompts): fix 3 client wiring gaps

1. JSON case normalization
   Parse CostGroupJson, ActionGroupJson, BranchesJson, RevealedCardsJson
   through _normalize_keys in game_screen.gd — server serialises these
   inner payloads with _jsonOpts (no naming policy = PascalCase), but the
   client was reading lowercase keys, producing empty option lists.

2. Cost pick candidate list
   - Add CandidatesJson to PendingCostPick; populated in AbilitySystem.PayCosts
     with the actor's eligible cards (hand for DiscardFromHand, field spirits
     for SendSpiritFromBattlefieldToDiscard / DealDamageToOwnSpirit).
   - Thread CandidatesJson through CostPickRequestPush → GameHandlerBase push.
   - Client _on_cost_pick_request now uses candidatesJson from the push instead
     of Game.get_my_player().hand, fixing opponent-pick and battlefield-cost UIs.

3. Reconnect recovery via game.get_state
   - Extract all pending-prompt pushes into static PushPendingPromptsAsync in
     GameHandlerBase (called from PushStateToPlayersAsync as before).
   - Inject IClientPush into GameGetStateHandler; call PushPendingPromptsAsync
     after building the reply so any active pause prompt is re-sent to the
     chooser on manual state sync / reconnect.

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:13:04 -04:00
co-authored by Claude Happy
parent c45db289ad
commit 7a917cf93b
6 changed files with 76 additions and 29 deletions
+7 -1
View File
@@ -846,7 +846,13 @@ public sealed record CostPickRequestPush(
/// <summary>Who is picking: "SelfPick", "EnemySeePick", "EnemyRandomPick", "EnemyPick".</summary>
string PickMode,
/// <summary>JSON-serialized Filter[]? constraining valid selections. Null = no constraint.</summary>
string? FiltersJson);
string? FiltersJson,
/// <summary>
/// JSON-serialized array of { instanceId, name, cardType } — pre-computed eligible
/// cards/units from the actor's zone. Included so the opponent client can display
/// choices even when the zone is normally hidden in GameStateDto.
/// </summary>
string CandidatesJson = "[]");
/// <summary>
/// Sent by the picker to submit their card/unit selections for a pending cost.