refactor(battle-node): extract JudgeHandler
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,7 @@ public sealed class BattleSession
|
|||||||
[NetworkBattleUri.Retire] = new RetireKillHandler(),
|
[NetworkBattleUri.Retire] = new RetireKillHandler(),
|
||||||
[NetworkBattleUri.Kill] = new RetireKillHandler(),
|
[NetworkBattleUri.Kill] = new RetireKillHandler(),
|
||||||
[NetworkBattleUri.TurnStart] = new TurnStartHandler(),
|
[NetworkBattleUri.TurnStart] = new TurnStartHandler(),
|
||||||
|
[NetworkBattleUri.Judge] = new JudgeHandler(),
|
||||||
};
|
};
|
||||||
|
|
||||||
private FrameDispatchContext BuildContext(IBattleParticipant from, MsgEnvelope env) =>
|
private FrameDispatchContext BuildContext(IBattleParticipant from, MsgEnvelope env) =>
|
||||||
|
|||||||
14
SVSim.BattleNode/Sessions/Dispatch/Handlers/JudgeHandler.cs
Normal file
14
SVSim.BattleNode/Sessions/Dispatch/Handlers/JudgeHandler.cs
Normal 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>();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user