fix(battle-node): assign turnState per side instead of hardcoding 0

Both PvP clients received turnState:0 ('both go first'). BuildBattleStart
now takes turnState; the Loaded arm assigns 0 to A, 1 to B — no Type check,
correct in Scripted (real player = A = first) and PvP (first arriver first).

Updated three existing BuildBattleStart callers in the test suite to pass
turnState:0 (the param is now required).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-03 10:47:56 -04:00
parent 84ed07d3af
commit ae11fe0957
5 changed files with 51 additions and 6 deletions

View File

@@ -53,10 +53,10 @@ public static class ScriptedLifecycle
bid: battleId);
public static MsgEnvelope BuildBattleStart(
MatchContext selfCtx, MatchContext oppoCtx, long selfViewerId) =>
MatchContext selfCtx, MatchContext oppoCtx, long selfViewerId, int turnState) =>
EnvelopeForPush(NetworkBattleUri.BattleStart,
new BattleStartBody(
TurnState: 0, // player goes first
TurnState: turnState, // 0 = this side goes first, 1 = second. Caller decides.
BattleType: selfCtx.BattleType,
SelfInfo: new BattleStartSelfInfo(
Rank: ScriptedProfiles.PlayerRank,