refactor(battle-node): extract JudgeHandler

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-03 14:30:40 -04:00
parent aacd7b56ad
commit db2f711894
2 changed files with 15 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ public sealed class BattleSession
[NetworkBattleUri.Retire] = new RetireKillHandler(),
[NetworkBattleUri.Kill] = new RetireKillHandler(),
[NetworkBattleUri.TurnStart] = new TurnStartHandler(),
[NetworkBattleUri.Judge] = new JudgeHandler(),
};
private FrameDispatchContext BuildContext(IBattleParticipant from, MsgEnvelope env) =>

View File

@@ -0,0 +1,14 @@
using SVSim.BattleNode.Protocol;
namespace SVSim.BattleNode.Sessions.Dispatch.Handlers;
internal sealed class JudgeHandler : IFrameHandler
{
public IReadOnlyList<DispatchRoute> Handle(FrameDispatchContext ctx)
{
// Only a scripted-bot Judge is forwarded. A real player's Judge has no routing rule (drops).
if (ctx.IsScriptedBot(ctx.From))
return new[] { new DispatchRoute(ctx.Other, ctx.Env, false) };
return Array.Empty<DispatchRoute>();
}
}