Behavior-preserving; 231 BattleNode tests green.
- MinedToken record struct replaces the transpose-prone (int Idx, long CardId,
CardOwner IsSelf) tuple returned by KnownListBuilder.Mine*. Positional deconstruct
keeps the Record*From call sites unchanged.
- enum Stock { Normal, Bypass } replaces the negative `bool noStock` on
IBattleParticipant.PushAsync and DispatchRoute, threaded through both participants,
BattleSession, and all handler construction sites.
- enum KeyActionType mirrors the client's SendKeyActionDataManager.KeyActionType;
the StripKeyActionForOpponent guard compares named values, KeyActionEntry.Type is
the enum (wire-identical via JsonNumberEnumConverter).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
776 B
C#
20 lines
776 B
C#
using SVSim.BattleNode.Protocol;
|
|
|
|
namespace SVSim.BattleNode.Sessions.Dispatch.Handlers;
|
|
|
|
/// <summary>PvP TurnEndActions: the sender's orderList is dropped; the opponent receives an
|
|
/// empty body (it only flips _sendEcho + runs the opponent's end-of-turn triggers via the
|
|
/// opponent's own engine). Bot drop.</summary>
|
|
internal sealed class TurnEndActionsHandler : IFrameHandler
|
|
{
|
|
public IReadOnlyList<DispatchRoute> Handle(FrameDispatchContext ctx)
|
|
{
|
|
if (ctx.Type == BattleType.Pvp && ctx.BothAfterReady())
|
|
{
|
|
var frame = ctx.Env with { Body = new RawBody(new Dictionary<string, object?>()) };
|
|
return new[] { new DispatchRoute(ctx.Other, frame, Stock.Normal) };
|
|
}
|
|
return Array.Empty<DispatchRoute>();
|
|
}
|
|
}
|