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

@@ -0,0 +1,37 @@
using Wizard;
using Wizard.BattleMgr;
namespace SVSim.BattleEngine.Rng
{
// The headless authoritative NETWORK battle mgr — the emitting twin of HeadlessBattleMgr. Emission
// lives on NetworkBattleManagerBase (NetworkBattleSender's ctor demands one), so the M13 emit read
// needs this subclass; HeadlessBattleMgr : SingleBattleMgr cannot reach the sender. RNG overrides are
// identical to HeadlessBattleMgr (the same BattleManagerBase virtuals + RandomSourceBridge), so the
// M14 rand-list emit reuses this mgr unchanged. M13's deterministic card never exercises a roll.
public sealed class HeadlessNetworkBattleMgr : NetworkBattleManagerBase
{
private readonly IRandomSource _rng;
public HeadlessNetworkBattleMgr(IBattleMgrContentsCreator contentsCreator, IRandomSource rng = null)
: base(contentsCreator)
{
_rng = rng ?? new SeededRandomSource(contentsCreator.RandomSeed);
}
public override int StableRandom(int val)
{
double unit = _rng.NextUnit();
randomResult = unit;
return RandomSourceBridge.Range(val, unit);
}
public override double StableRandomDouble()
{
double unit = _rng.NextUnit();
randomResult = unit;
return unit;
}
public override int StableRandomOnlySelf(int val) => _rng.NextSelf(val);
}
}