refactor(battle-node): rename ScriptedLifecycle->ServerBattleFrames, ScriptedProfiles->BattleFrameDefaults
Pure rename. These hold the shared server-authored frame builders used by every battle mode's handshake/mulligan dispatch — the 'Scripted' name was a historical accident that hid the PvP/Bot crossover. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ internal static class BattleFrames
|
||||
{
|
||||
internal static MsgEnvelope BuildAck(NetworkBattleUri uri) => new(
|
||||
uri,
|
||||
ViewerId: ScriptedLifecycle.FakeOpponentViewerId,
|
||||
ViewerId: ServerBattleFrames.FakeOpponentViewerId,
|
||||
Uuid: WireConstants.ServerUuid,
|
||||
Bid: null,
|
||||
Try: 0,
|
||||
@@ -21,7 +21,7 @@ internal static class BattleFrames
|
||||
|
||||
internal static MsgEnvelope BuildTurnEndBroadcast() => new(
|
||||
NetworkBattleUri.TurnEnd,
|
||||
ViewerId: ScriptedLifecycle.FakeOpponentViewerId,
|
||||
ViewerId: ServerBattleFrames.FakeOpponentViewerId,
|
||||
Uuid: WireConstants.ServerUuid,
|
||||
Bid: null,
|
||||
Try: 0,
|
||||
@@ -32,18 +32,18 @@ internal static class BattleFrames
|
||||
|
||||
internal static MsgEnvelope BuildJudgeBroadcast() => new(
|
||||
NetworkBattleUri.Judge,
|
||||
ViewerId: ScriptedLifecycle.FakeOpponentViewerId,
|
||||
ViewerId: ServerBattleFrames.FakeOpponentViewerId,
|
||||
Uuid: WireConstants.ServerUuid,
|
||||
Bid: null,
|
||||
Try: 0,
|
||||
Cat: EmitCategory.Battle,
|
||||
PubSeq: null,
|
||||
PlaySeq: null,
|
||||
Body: new JudgeBody(Spin: ScriptedProfiles.OpponentJudgeSpin));
|
||||
Body: new JudgeBody(Spin: BattleFrameDefaults.OpponentJudgeSpin));
|
||||
|
||||
internal static MsgEnvelope BuildBattleFinish(BattleResult result) => new(
|
||||
NetworkBattleUri.BattleFinish,
|
||||
ViewerId: ScriptedLifecycle.FakeOpponentViewerId,
|
||||
ViewerId: ServerBattleFrames.FakeOpponentViewerId,
|
||||
Uuid: WireConstants.ServerUuid,
|
||||
Bid: null,
|
||||
Try: 0,
|
||||
|
||||
@@ -23,9 +23,9 @@ internal sealed class InitBattleHandler : IFrameHandler
|
||||
{
|
||||
var r = new List<DispatchRoute>
|
||||
{
|
||||
new(ctx.From, ScriptedLifecycle.BuildMatched(
|
||||
new(ctx.From, ServerBattleFrames.BuildMatched(
|
||||
ctx.From.Context, ctx.Other.Context, ctx.From.ViewerId, ctx.Other.ViewerId,
|
||||
ctx.BattleId, ScriptedProfiles.BattleSeed), false),
|
||||
ctx.BattleId, BattleFrameDefaults.BattleSeed), false),
|
||||
};
|
||||
ctx.SenderPhase = BattleSessionPhase.AwaitingLoaded;
|
||||
return r;
|
||||
|
||||
@@ -21,9 +21,9 @@ internal sealed class LoadedHandler : IFrameHandler
|
||||
var turnState = ReferenceEquals(ctx.From, ctx.A) ? 0 : 1;
|
||||
var r = new List<DispatchRoute>
|
||||
{
|
||||
new(ctx.From, ScriptedLifecycle.BuildBattleStart(
|
||||
new(ctx.From, ServerBattleFrames.BuildBattleStart(
|
||||
ctx.From.Context, ctx.Other.Context, ctx.From.ViewerId, turnState), false),
|
||||
new(ctx.From, ScriptedLifecycle.BuildDeal(), false),
|
||||
new(ctx.From, ServerBattleFrames.BuildDeal(), false),
|
||||
};
|
||||
ctx.SenderPhase = BattleSessionPhase.AwaitingSwap;
|
||||
return r;
|
||||
|
||||
@@ -12,10 +12,10 @@ internal sealed class SwapHandler : IFrameHandler
|
||||
return Array.Empty<DispatchRoute>();
|
||||
|
||||
var routes = new List<DispatchRoute>();
|
||||
var hand = ScriptedLifecycle.ComputeHandAfterSwap(BattleFrames.ExtractIdxList(ctx.Env));
|
||||
var hand = ServerBattleFrames.ComputeHandAfterSwap(BattleFrames.ExtractIdxList(ctx.Env));
|
||||
|
||||
// SwapResponse is always immediate — completes the sender's own mulligan UI.
|
||||
routes.Add(new DispatchRoute(ctx.From, ScriptedLifecycle.BuildSwapResponse(hand), false));
|
||||
routes.Add(new DispatchRoute(ctx.From, ServerBattleFrames.BuildSwapResponse(hand), false));
|
||||
ctx.State.PostSwapHands[ctx.From] = hand;
|
||||
ctx.SenderPhase = BattleSessionPhase.AfterReady;
|
||||
|
||||
@@ -29,8 +29,8 @@ internal sealed class SwapHandler : IFrameHandler
|
||||
var opponent = ReferenceEquals(p, ctx.A) ? ctx.B : ctx.A;
|
||||
var ready = opponent is IHasHandshakePhase
|
||||
&& ctx.State.PostSwapHands.TryGetValue(opponent, out var oppoHand)
|
||||
? ScriptedLifecycle.BuildReady(ctx.State.PostSwapHands[p], oppoHand)
|
||||
: ScriptedLifecycle.BuildReady(ctx.State.PostSwapHands[p]);
|
||||
? ServerBattleFrames.BuildReady(ctx.State.PostSwapHands[p], oppoHand)
|
||||
: ServerBattleFrames.BuildReady(ctx.State.PostSwapHands[p]);
|
||||
routes.Add(new DispatchRoute(p, ready, false));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user