feat(battle-node): BuildBattleStart consumes MatchContext for player half

ClassId/CharaId/CardMasterName/BattleType flow from ctx. PlayerBattleStart
Profile removed; Rank/BattlePoint remain as standalone consts pending real
per-viewer rank tracker. One test updated, one new test added.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-01 12:49:54 -04:00
parent f589283572
commit b0488e3f2e
5 changed files with 35 additions and 14 deletions

View File

@@ -68,14 +68,33 @@ public class ScriptedLifecycleTests
}
[Test]
public void BuildBattleStart_HasTurnStateZeroAndBattleTypeEleven()
public void BuildBattleStart_HasTurnStateZero_AndUsesContextBattleType()
{
var env = ScriptedLifecycle.BuildBattleStart(playerViewerId: 1);
var env = ScriptedLifecycle.BuildBattleStart(FixtureCtx(), playerViewerId: 1);
var body = (BattleStartBody)env.Body;
Assert.That(body.TurnState, Is.EqualTo(0));
Assert.That(body.BattleType, Is.EqualTo(11));
}
[Test]
public void BuildBattleStart_class_chara_cardMaster_battleType_flow_from_context()
{
var ctx = FixtureCtx() with
{
ClassId = "7", CharaId = "5000123",
CardMasterName = "card_master_test_v2",
BattleType = 42,
};
var env = ScriptedLifecycle.BuildBattleStart(ctx, playerViewerId: 1);
var body = (BattleStartBody)env.Body;
Assert.That(body.SelfInfo.ClassId, Is.EqualTo("7"));
Assert.That(body.SelfInfo.CharaId, Is.EqualTo("5000123"));
Assert.That(body.SelfInfo.CardMasterName, Is.EqualTo("card_master_test_v2"));
Assert.That(body.BattleType, Is.EqualTo(42));
}
[Test]
public void BuildDeal_HasThreeSelfAndThreeOppoEntries()
{

View File

@@ -85,7 +85,7 @@ public class TypedBodyWireShapeTests
[Test]
public void BuildBattleStart_SerializesAllWireKeysAndPreservesBattlePointAsymmetry()
{
var env = ScriptedLifecycle.BuildBattleStart(playerViewerId: 906243102);
var env = ScriptedLifecycle.BuildBattleStart(FixtureCtx(), playerViewerId: 906243102);
var json = MsgEnvelope.ToJson(env);
var node = JsonNode.Parse(json)!.AsObject();