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

@@ -71,7 +71,7 @@ public class ScriptedLifecycleTests
[Test]
public void BuildBattleStart_HasTurnStateZero_AndUsesContextBattleType()
{
var env = ScriptedLifecycle.BuildBattleStart(FixtureCtx(), ScriptedBotCtx(), selfViewerId: 1);
var env = ScriptedLifecycle.BuildBattleStart(FixtureCtx(), ScriptedBotCtx(), selfViewerId: 1, turnState: 0);
var body = (BattleStartBody)env.Body;
Assert.That(body.TurnState, Is.EqualTo(0));
Assert.That(body.BattleType, Is.EqualTo(11));
@@ -87,7 +87,7 @@ public class ScriptedLifecycleTests
BattleType = 42,
};
var env = ScriptedLifecycle.BuildBattleStart(ctx, ScriptedBotCtx(), selfViewerId: 1);
var env = ScriptedLifecycle.BuildBattleStart(ctx, ScriptedBotCtx(), selfViewerId: 1, turnState: 0);
var body = (BattleStartBody)env.Body;
Assert.That(body.SelfInfo.ClassId, Is.EqualTo("7"));