fix(battle-node): expand rank-battle deck by DeckCard.Count

BuildForRankBattleAsync projected deck.Cards.Select(c => c.Card.Id),
discarding Count. DeckCard is count-based (one row per unique card +
a Count), so a 3-copy card shipped to the node as a single in-battle
card -- matched decks showed 1 of each card instead of the real count.

Expand each row by its Count so SelfDeckCardIds carries one entry per
physical card. TwoPick path is unaffected (flat per-pick list).

Add a regression test seeding 3+2+1 copies (failed Expected 6/was 3).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-04 15:09:14 -04:00
parent 7bd2c0f2d7
commit 56652c7034
2 changed files with 33 additions and 1 deletions

View File

@@ -95,7 +95,12 @@ public class MatchContextBuilder : IMatchContextBuilder
var sleeveId = deck.Sleeve.Id != 0
? deck.Sleeve.Id.ToString()
: defaults.SleeveId.ToString();
var deckCardIds = deck.Cards.Select(c => c.Card.Id).ToList();
// DeckCard is count-based (one row per unique card + a Count). The node's deck
// is one entry PER PHYSICAL CARD (idx 1..N), so expand each row by its Count —
// otherwise a 3-copy card ships as a single in-battle card.
var deckCardIds = deck.Cards
.SelectMany(c => Enumerable.Repeat(c.Card.Id, c.Count))
.ToList();
return new MatchContext(
SelfDeckCardIds: deckCardIds,