feat(battle-node): reveal copy tokens on play via baseIdx resolution

PlayActionsHandler + EchoHandler now call RecordCopyTokensFrom (ordered
after plain/choice mining) to resolve a copy add's baseIdx against the
side's live idx->cardId map and record copyIdx->cardId. A copy played in a
later (or same) frame synthesizes a knownList instead of degrading.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-04 10:11:34 -04:00
parent f9c7e6124b
commit b6edfbcf15
4 changed files with 202 additions and 5 deletions

View File

@@ -6,8 +6,9 @@ namespace SVSim.BattleNode.Sessions.Dispatch.Handlers;
/// node never relays it (bullet-2 audit — relaying would risk an echo->echo storm). It IS mined,
/// though: an Echo's orderList carries the same add-op shape as PlayActions
/// (SendCardDataMaker.MakeEchoData -> MakeCommonSendAndEchoCardData), so it can hold a token's real
/// identity — notably the receiver's own (isSelf:1) view of a cross-side gift. We mine it into the
/// right side's idx->cardId map and still return no routes (mining != relaying).</summary>
/// identity — notably the receiver's own (isSelf:1) view of a cross-side gift. We mine it (concrete
/// tokens and baseIdx copies) into the right side's idx->cardId map and still return no routes
/// (mining != relaying).</summary>
internal sealed class EchoHandler : IFrameHandler
{
public IReadOnlyList<DispatchRoute> Handle(FrameDispatchContext ctx)
@@ -16,6 +17,8 @@ internal sealed class EchoHandler : IFrameHandler
{
var orderList = (ctx.Env.Body as RawBody)?.Entries.GetValueOrDefault("orderList");
ctx.State.RecordTokensFrom(ctx.From, ctx.Other, orderList);
// Copy tokens ride Echo too (same add-op shape); resolve baseIdx against the side's map.
ctx.State.RecordCopyTokensFrom(ctx.From, ctx.Other, orderList);
// No RecordChoicePicksFrom here: choice picks ride keyAction.selectCard on the generating
// SEND, not the receiver's Echo (Echo carries orderList only) — the pick is already
// recorded by PlayActionsHandler. MineChoicePicks(orderList, null) would yield nothing.