fix(battlenode): emit real spellboost count in played-card knownList
The node hardcoded knownList.spellboost=0 on every played card. Prod sends the true accumulated count, which the client reads straight into the card's cost model; with 0 the opponent computes the card at full price and silently rejects the play in OperateReceiveChecker.IsPlayCard (PP-over -> ConductError -> NullOperationCollection -> no render/echo), desyncing the board. Mine spellboost-count changes from the sender''s orderList alter ops (MineAlterSpellboosts: a/s/h ops), accumulate per-side idx->count in BattleSessionState (RecordSpellboostFrom), and surface the current count on the played card via BuildPlayedCard. Recorded from the authoritative PlayActions only (never the Echo) and folded in AFTER the played card is built, since a card''s cost is fixed as it leaves hand and a play that grants spellboost targets the rest of the hand. Also adds a [sio-in-body] full-body inbound log to RealParticipant to capture both clients'' re-simulated responses for PvP RNG verification. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,49 @@ public class BattleSessionStateTests
|
||||
Assert.That(a, Is.Not.EqualTo(b));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RecordSpellboostFrom_accumulates_add_ops_and_routes_by_isSelf()
|
||||
{
|
||||
var state = new BattleSessionState(masterSeed: 1);
|
||||
var caster = new StubParticipant(7, Ctx(900L));
|
||||
var oppo = new StubParticipant(6, Ctx(901L));
|
||||
|
||||
// Two spell-plays each grant +1 to the caster's hand card idx 3 (the classic spellboost ramp).
|
||||
var grant = new List<object?> { new Dictionary<string, object?>
|
||||
{ ["alter"] = new Dictionary<string, object?>
|
||||
{ ["idx"] = new List<object?> { 3L }, ["isSelf"] = 1L, ["type"] = "add", ["spellboost"] = "a1" } } };
|
||||
state.RecordSpellboostFrom(caster, oppo, grant);
|
||||
state.RecordSpellboostFrom(caster, oppo, grant);
|
||||
|
||||
Assert.That(state.GetSpellboostMap(caster)[3], Is.EqualTo(2), "two +1 grants accumulate");
|
||||
Assert.That(state.GetSpellboostMap(oppo).ContainsKey(3), Is.False, "isSelf:1 routes to the caster only");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Boosted_card_carries_real_spellboost_into_its_knownList()
|
||||
{
|
||||
// End-to-end regression for the 2026-06-05 desync: a spellboosted card whose relayed knownList
|
||||
// shipped spellboost:0 made the opponent compute full cost and silently reject the play. After the
|
||||
// grant is recorded, BuildPlayedCard must emit the accumulated count, not 0.
|
||||
var state = new BattleSessionState(masterSeed: 1);
|
||||
var caster = new StubParticipant(7, Ctx(101311010L, 999L, 998L)); // idx 1..3 deck-seeded
|
||||
|
||||
var grant = new List<object?> { new Dictionary<string, object?>
|
||||
{ ["alter"] = new Dictionary<string, object?>
|
||||
{ ["idx"] = new List<object?> { 3L }, ["isSelf"] = 1L, ["type"] = "add", ["spellboost"] = "a1" } } };
|
||||
state.RecordSpellboostFrom(caster, new StubParticipant(6, Ctx(901L)), grant);
|
||||
|
||||
// idx 3 is now played hand->board; its knownList must reflect the +1.
|
||||
var play = new List<object?> { new Dictionary<string, object?>
|
||||
{ ["move"] = new Dictionary<string, object?>
|
||||
{ ["idx"] = new List<object?> { 3L }, ["isSelf"] = 1L, ["from"] = 10L, ["to"] = 20L } } };
|
||||
var entry = KnownListBuilder.BuildPlayedCard(
|
||||
state.GetOrSeedDeckMap(caster), playIdx: 3, orderList: play, state.GetSpellboostMap(caster));
|
||||
|
||||
Assert.That(entry, Is.Not.Null);
|
||||
Assert.That(entry!.Spellboost, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
private static long[] DistinctDeck() =>
|
||||
Enumerable.Range(1, 30).Select(i => 200_000_000L + i).ToArray();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user