refactor(battlenode): name sender-only vs both-sides handshake checks (§D)
Behavior-preserving; 231 BattleNode tests green. FrameDispatchContext.BothAfterReady() -> BothSidesAfterReady() (7 call sites). The 4 inline `SenderPhase == AfterReady` checks in TurnEndHandler/TurnEndFinalHandler now read a new SenderIsAfterReady property. Both carry cross-referencing docs so the Bot-arm (sender-only) vs PvP-arm (both-sides) distinction is explicit at the type. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,14 +8,14 @@ internal sealed class TurnEndHandler : IFrameHandler
|
||||
public IReadOnlyList<DispatchRoute> Handle(FrameDispatchContext ctx)
|
||||
{
|
||||
// case 4: Bot — Judge to sender only (no real opponent; client flips back to its local AI).
|
||||
if (ctx.Type == BattleType.Bot && ctx.SenderPhase == HandshakePhase.AfterReady)
|
||||
if (ctx.Type == BattleType.Bot && ctx.SenderIsAfterReady)
|
||||
return new[] { new DispatchRoute(ctx.From, BattleFrames.BuildJudgeBroadcast(), Stock.Normal) };
|
||||
|
||||
// case 8: general AfterReady arm — PvP forwards a {turnState} TurnEnd to the opponent
|
||||
// (handover gate). Any non-Pvp non-Bot type that reaches AfterReady consumes the frame.
|
||||
if (ctx.SenderPhase == HandshakePhase.AfterReady)
|
||||
if (ctx.SenderIsAfterReady)
|
||||
{
|
||||
if (ctx.Type == BattleType.Pvp && ctx.BothAfterReady())
|
||||
if (ctx.Type == BattleType.Pvp && ctx.BothSidesAfterReady())
|
||||
{
|
||||
// Opponent sees {turnState}; receiving TurnEnd drives ITS SendJudge (handover gate):
|
||||
// the opponent (the turn taker-over) then sends a Judge, which JudgeHandler reflects
|
||||
|
||||
Reference in New Issue
Block a user