using SVSim.BattleNode.Protocol; using SVSim.BattleNode.Protocol.Bodies; namespace SVSim.BattleNode.Sessions.Dispatch.Handlers; internal sealed class JudgeHandler : IFrameHandler { public IReadOnlyList Handle(FrameDispatchContext ctx) { // Scripted-bot Judge (test stub): forward verbatim (carries the {spin} shape already). if (ctx.IsScriptedBot(ctx.From)) return new[] { new DispatchRoute(ctx.Other, ctx.Env, false) }; // PvP: active player's Judge{battleCode} -> opponent {spin} (RNG catch-up; spin=0 for the // deterministic-turn slice). Receiving Judge starts the opponent's own turn. if (ctx.Type == BattleType.Pvp && ctx.BothAfterReady()) { var frame = ctx.Env with { Body = new JudgeBody(Spin: 0) }; return new[] { new DispatchRoute(ctx.Other, frame, false) }; } return Array.Empty(); } }