Two issues caught during v1 smoke at the mulligan / first-turn boundary:
1) BuildSwapResponse ignored the player's idxList and echoed the same
3-card hand back. The client diffs the new self[] against the Deal
to compute "drawn cards" — empty diff against the same hand throws
"Card swap failed: AbandonCards[X]/DrawCards[]". Replace swapped
idxs with fresh deck idxs (initial hand was 1/2/3, deck has 4..30
still available). Same hand must flow into Ready since the client
diffs again there. Move the hand computation into a new helper
ComputeHandAfterSwap and have ComputeResponses thread it through
both BuildSwapResponse and BuildReady.
2) The client doesn't transition to the "Opponent's turn…" display
on its own after sending TurnEnd — it waits for the server to push
an opponent TurnStart (per prod TK2 capture line 14). Without it
the UI just sits on the end-of-turn frame. Add a TurnEnd handler
that pushes a minimal TurnStart{spin} and transitions to a new
OpponentTurn phase, which IS the documented v1 stopping point.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
17 lines
366 B
C#
17 lines
366 B
C#
namespace SVSim.BattleNode.Sessions;
|
|
|
|
/// <summary>
|
|
/// Where we are in the v1 scripted lifecycle. Drives which scripted frames the session pushes
|
|
/// in response to inbound emits.
|
|
/// </summary>
|
|
public enum BattleSessionPhase
|
|
{
|
|
AwaitingInitNetwork,
|
|
AwaitingInitBattle,
|
|
AwaitingLoaded,
|
|
AwaitingSwap,
|
|
AfterReady,
|
|
OpponentTurn,
|
|
Terminal,
|
|
}
|