feat(battlenode): emit engine-resolved clan/tribe on knownList entries (M-HC-4e)

Prod always emits clan (int ClanType) + tribe (comma-joined int TribeType
string, "0" for none) on every knownList entry (battle-traffic_tk2_regular
.ndjson). Source both off the resolved engine (SessionBattleEngine.PlayedCardClan/
PlayedCardTribe -> BattleCardBase.Clan/Tribe), so skill-applied clan/tribe
changes ride the wire rather than the static card-master value. Thread through
KnownListBuilder.BuildPlayedCard + PlayActionsHandler; add clan/tribe to the
KnownCardEntry DTO (always present, non-null). Node-side only; no engine edits,
drift clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-07 00:11:28 -04:00
parent daaec20afb
commit 693fba5003
7 changed files with 228 additions and 21 deletions

View File

@@ -56,8 +56,16 @@ internal sealed class PlayActionsHandler : IFrameHandler
// to stay prod-faithful (prod sends the real count). Same senderSeat mapping as the cost read.
int playedSpellboost = ctx.Engine.PlayedCardSpellboost(senderSeat, playIdx, fallback: 0);
// clan/tribe are ALSO engine-sourced (M-HC-4e) — read off the resolved card's Clan/Tribe getters, so
// any skill-applied clan/tribe change (e.g. change_affiliation) rides the wire (the static card-master
// value would miss it). Prod always emits both on every knownList entry: clan as the int ClanType
// ordinal, tribe as the comma-joined int TribeType string ("0" for none). Same senderSeat mapping.
int playedClan = ctx.Engine.PlayedCardClan(senderSeat, playIdx, fallback: 0);
string playedTribe = ctx.Engine.PlayedCardTribe(senderSeat, playIdx);
var played = KnownListBuilder.BuildPlayedCard(
deckMap, playIdx, orderList, cost: playedCost, spellboost: playedSpellboost);
deckMap, playIdx, orderList, cost: playedCost, spellboost: playedSpellboost,
clan: playedClan, tribe: playedTribe);
var oppoTargets = KnownListBuilder.RenameTargets(entries.GetValueOrDefault(WireKeys.TargetList));
// Deck-sourced movements (fetch / search / summon-from-deck) ride the uList — a verbatim,

View File

@@ -10,25 +10,28 @@ namespace SVSim.BattleNode.Sessions.Dispatch;
internal static class KnownListBuilder
{
/// <summary>The played card's knownList entry, or null when its identity can't be synthesized
/// (token idx not in the deck map, or no matching move op). <paramref name="cost"/> and
/// <paramref name="spellboost"/> are both ENGINE-SOURCED (M-HC-3a/3b) — the handler reads the played
/// card's resolved play-time cost (<c>SessionBattleEngine.PlayedCardCost</c>) and accumulated
/// spell-charge count (<c>SessionBattleEngine.PlayedCardSpellboost</c>) off the shadow engine and passes
/// them in; both land on the entry verbatim. The wire-derived spellboost bookkeeping is retired —
/// the engine owns both cost and count by construction (cost folds the spellboost discount in already;
/// the count rides the entry only to stay prod-faithful, prod sends the real count here). Prod's client
/// reads cost straight into the card's cost model (<c>NetworkBattleReceiver</c>), so a vanilla play
/// resolves to its base cost and count 0. attachTarget stays ""; clan/tribe remain deferred (receiver
/// re-derives from cardId).</summary>
/// (token idx not in the deck map, or no matching move op). <paramref name="cost"/>,
/// <paramref name="spellboost"/>, <paramref name="clan"/> and <paramref name="tribe"/> are ALL
/// ENGINE-SOURCED (M-HC-3a/3b/4e) — the handler reads them off the shadow engine
/// (<c>SessionBattleEngine.PlayedCardCost</c>/<c>PlayedCardSpellboost</c>/<c>PlayedCardClan</c>/
/// <c>PlayedCardTribe</c>) and passes them in; all land on the entry verbatim. The wire-derived
/// spellboost bookkeeping is retired — the engine owns cost and count by construction (cost folds the
/// spellboost discount in already; the count rides the entry only to stay prod-faithful, prod sends the
/// real count here). <paramref name="clan"/>/<paramref name="tribe"/> are the LIVE (skill-applied)
/// values the engine resolved — prod always sends both on every knownList entry (clan int, tribe the
/// comma-joined int string, "0" for none). Prod's client reads cost straight into the card's cost model
/// (<c>NetworkBattleReceiver</c>), so a vanilla play resolves to its base cost and count 0. attachTarget
/// stays "".</summary>
public static KnownCardEntry? BuildPlayedCard(
IReadOnlyDictionary<int, long> deckMap, int playIdx, object? orderList,
int cost = 0, int spellboost = 0)
int cost = 0, int spellboost = 0, int clan = 0, string tribe = "0")
{
if (!deckMap.TryGetValue(playIdx, out var cardId)) return null;
var to = ExtractMoveTo(orderList, playIdx);
if (to is null) return null;
return new KnownCardEntry(
Idx: playIdx, CardId: cardId, To: to.Value, Spellboost: spellboost, AttachTarget: "", Cost: cost);
Idx: playIdx, CardId: cardId, To: to.Value, Spellboost: spellboost, AttachTarget: "", Cost: cost,
Clan: clan, Tribe: tribe);
}
/// <summary>The <c>to</c> place-state of the FIRST <c>move</c> op whose <c>idx</c> list contains