test(battle-engine M13): HeadlessNetworkBattleMgr constructs headless (construction probe)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-06 11:48:52 -04:00
parent 0fe45517da
commit 2f6bc5b6c0
3 changed files with 75 additions and 0 deletions

View File

@@ -202,6 +202,19 @@ namespace SVSim.BattleEngine.Tests
var dm = GameMgr.GetIns().GetDataMgr();
SetField(dm, "_playerCharaId", HeadlessMasterData.PlayerCharaId);
SetField(dm, "_enemyCharaId", HeadlessMasterData.EnemyCharaId);
// NetworkBattleManagerBase.CreateBackgroundId() (M13) reads
// GameMgr.GetIns().GetNetworkUserInfoData().GetFieldId() when the RecoveryManager yields no
// bg id (NullRecoveryManager.BackGroundId == -1). In production RealTimeNetworkAgent seeds
// this NetworkUserInfoData at match start; the bare construction path leaves GameMgr's
// _netUser null (no lazy init, unlike the other GodObject getters). Seed a no-op instance
// whose _selfInfo carries just "fieldId" (GetFieldId reads _selfInfo["fieldId"]); field id 1
// == ForestField, a valid background. Nothing here drives game state — it only satisfies the
// network mgr's background lookup so a single-battle-only SingleBattleMgr never needs.
var netUser = new NetworkUserInfoData();
netUser.SetSelfInfo(
new System.Collections.Generic.Dictionary<string, object> { ["fieldId"] = 1 },
isWatchReplayRecovery: false);
GameMgr.GetIns().SetNetworkUserInfoData(netUser);
_done = true;
}