feat(battlenode): Receive ingests a captured PlayActions headless (Phase 2 N0)

Receive feeds the decoded frame into the mgr's own NetworkBattleReceiver
(isHaveSequence:true, checkBreakData:false — mirroring the engine's
RecoveryDataHandler frame replay), reboxing object?->object for nested data.
No engine gaps surfaced; the only fix was a test-harness one (load all deck ids
in a single HeadlessCardMaster.Load — per-id calls each replace the master).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-06 15:05:36 -04:00
parent eaa7b4d85c
commit 6740313446
2 changed files with 75 additions and 2 deletions

View File

@@ -27,5 +27,26 @@ namespace SVSim.BattleEngine.Tests.SessionEngine
Assert.DoesNotThrow(() => engine.Setup(masterSeed: 12345, seatADeck: deckA, seatBDeck: deckB));
Assert.That(engine.IsReady, Is.True);
}
[Test]
public void Receive_one_playactions_resolves_headless()
{
HeadlessEngineEnv.EnsureInitialized();
var cl1 = CaptureReplay.Load("battle_test_cl1.ndjson");
var deck = CaptureReplay.SelfDeckFrom(cl1);
// Load ALL deck ids in ONE call: HeadlessCardMaster.Load replaces the static CardMaster each
// call, so a per-id loop would leave only the last card resolvable.
HeadlessCardMaster.Load(deck.Select(x => (int)x).Distinct().ToArray());
var engine = new SessionBattleEngine();
engine.Setup(CaptureReplay.SeedFrom(cl1), seatADeck: deck, seatBDeck: deck);
var firstPlay = cl1.First(f => f.Direction == "send" && f.Uri == "PlayActions");
var result = engine.Receive(firstPlay.Env, isPlayerSeat: true);
Assert.That(result.RejectReason, Is.Null, $"ingest threw/rejected: {result.RejectReason}");
Assert.That(result.Accepted, Is.True);
}
}
}