diff --git a/SVSim.BattleNode/Protocol/Bodies/PlayActionsBroadcastBody.cs b/SVSim.BattleNode/Protocol/Bodies/PlayActionsBroadcastBody.cs index fcf477f..c639733 100644 --- a/SVSim.BattleNode/Protocol/Bodies/PlayActionsBroadcastBody.cs +++ b/SVSim.BattleNode/Protocol/Bodies/PlayActionsBroadcastBody.cs @@ -7,13 +7,15 @@ namespace SVSim.BattleNode.Protocol.Bodies; /// the deterministic-turn slice). OppoTargetList is the renamed targetList /// (independent of KnownList — a targeted hand play carries both). KeyAction forwards a /// choice/Discover play's {type,cardId} so the opponent renders the choice-token generation; -/// the pick (selectCard) is stripped for a hidden (open:0) draw-to-hand choice. All three are +/// the pick (selectCard) is stripped for a hidden (open:0) draw-to-hand choice. UList +/// forwards the sender's unapproved-movement list (deck-sourced summons/fetches) verbatim. All are /// omitted when null via the envelope's WhenWritingNull policy (a vanilla play carries none). public sealed record PlayActionsBroadcastBody( [property: JsonPropertyName("playIdx")] int PlayIdx, [property: JsonPropertyName("type")] int Type, [property: JsonPropertyName("knownList")] IReadOnlyList? KnownList, [property: JsonPropertyName("oppoTargetList")] IReadOnlyList? OppoTargetList, + [property: JsonPropertyName("uList")] IReadOnlyList? UList = null, [property: JsonPropertyName("keyAction")] IReadOnlyList? KeyAction = null) : IMsgBody; /// Opponent-facing keyAction entry for a choice/Discover play. type/cardId diff --git a/SVSim.BattleNode/Sessions/Dispatch/Handlers/PlayActionsHandler.cs b/SVSim.BattleNode/Sessions/Dispatch/Handlers/PlayActionsHandler.cs index 92eba7e..346e09c 100644 --- a/SVSim.BattleNode/Sessions/Dispatch/Handlers/PlayActionsHandler.cs +++ b/SVSim.BattleNode/Sessions/Dispatch/Handlers/PlayActionsHandler.cs @@ -42,11 +42,18 @@ internal sealed class PlayActionsHandler : IFrameHandler var played = KnownListBuilder.BuildPlayedCard(deckMap, playIdx, orderList); var oppoTargets = KnownListBuilder.RenameTargets(entries.GetValueOrDefault("targetList")); + // Deck-sourced movements (fetch / search / summon-from-deck) ride the uList — a verbatim, + // separate receive slot the node forwards unchanged (bullet-3 audit F1). The node makes no + // reveal decision; cardId presence is the sender's call. Coexists with the synthesized + // knownList in the same frame (capture line 75). + var uList = KnownListBuilder.RelayUList(entries.GetValueOrDefault("uList")); + var body = new PlayActionsBroadcastBody( PlayIdx: playIdx, Type: type, KnownList: played is null ? null : new[] { played }, OppoTargetList: oppoTargets, + UList: uList, // {type,cardId} forwarded so the opponent renders the choice token; selectCard dropped // when open==0 (hidden draw-to-hand pick). Null for a vanilla play (no keyAction). KeyAction: KnownListBuilder.StripKeyActionForOpponent(keyAction)); diff --git a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs index 3700801..164792e 100644 --- a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs +++ b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs @@ -249,6 +249,58 @@ public class BattleSessionDispatchTests Assert.That(pb.OppoTargetList[0].IsSelf, Is.EqualTo(0)); } + [Test] + public void Pvp_PlayActions_relays_uList_verbatim() + { + // A deck-fetch rides the uList (battle-traffic_tk2_regular.ndjson:75); the node forwards it + // verbatim alongside the synthesized knownList for the played card. + var (s, a, b) = NewPvpSession(); + DriveToAfterReady(s, a); + DriveToAfterReady(s, b); + + var body = MoveOrderList(idx: 3, from: 10, to: 20); + body["playIdx"] = 3L; + body["type"] = 30L; + body["uList"] = new List + { + new Dictionary + { + ["idxList"] = new List { 16L, 22L }, + ["from"] = 0L, ["to"] = 10L, ["isSelf"] = 1L, ["skill"] = "37|36|0", + }, + }; + + var routes = s.ComputeFrames(a, EnvWith(NetworkBattleUri.PlayActions, body)); + Assert.That(routes.Count, Is.EqualTo(1)); + Assert.That(routes[0].Target, Is.SameAs(b)); + var pb = (PlayActionsBroadcastBody)routes[0].Frame.Body; + + Assert.That(pb.KnownList!.Count, Is.EqualTo(1), "played card still synthesized in the same frame"); + Assert.That(pb.UList, Is.Not.Null); + Assert.That(pb.UList!.Count, Is.EqualTo(1)); + Assert.That(pb.UList[0].IdxList, Is.EqualTo(new[] { 16, 22 })); + Assert.That(pb.UList[0].From, Is.EqualTo(0)); + Assert.That(pb.UList[0].To, Is.EqualTo(10)); + Assert.That(pb.UList[0].IsSelf, Is.EqualTo(1)); + Assert.That(pb.UList[0].Skill, Is.EqualTo("37|36|0")); + } + + [Test] + public void Pvp_PlayActions_without_uList_leaves_it_null() + { + var (s, a, b) = NewPvpSession(); + DriveToAfterReady(s, a); + DriveToAfterReady(s, b); + + var body = MoveOrderList(idx: 3, from: 10, to: 20); + body["playIdx"] = 3L; + body["type"] = 30L; + + var routes = s.ComputeFrames(a, EnvWith(NetworkBattleUri.PlayActions, body)); + var pb = (PlayActionsBroadcastBody)routes[0].Frame.Body; + Assert.That(pb.UList, Is.Null); + } + [Test] public void Pvp_PlayActions_ungenerated_token_idx_degrades_to_no_knownList() {