feat(packs): rewrite PackOpenService against per-pack draw table

Sampler is now driven by PackDrawTable: roll DrawTier per slot by
cumulative slot-rate weights, then pick a card within tier by per-card
weights renormalized within the tier. Rate-less Guaranteed-Leader-Card
rows draw uniform over (pool minus owned), falling back to the full
pool when all are owned. Bonus slot fires once at the end of a 10-pack
open when HasBonusSlot is set.

Slot 8 falls back to the general slot's per-card weights for the rolled
tier when slot-8 has only a rarity-level rate quoted (the common shape
on normal packs).

PackController.Open loads the draw table + viewer owned card ids and
passes them to the sampler; the category-based forced-Legendary slot-8
override is gone. ICardFoilLookup replaces ICardPoolProvider for the
foil-twin heuristic.

Drops the test-fixture pack-draw seed overlay so the production seed
flows through the importer tests; controller tests that fabricate their
own card sets now call factory.SeedPackDrawTableAsync(...) to install a
matching stub draw table.

WeightedPick helper handles the cumulative-band roll for both stages.
Five sampler tests + four WeightedPick tests + five importer/repo
tests; full suite is 653/653 green.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-30 22:26:45 -04:00
parent 0169ec57b4
commit 1c386b5ed0
14 changed files with 445 additions and 374 deletions

View File

@@ -1,7 +0,0 @@
[
{ "pack_id": 10000, "slot": "general", "tier": "bronze", "card_id": 100, "rate_pct": 50.0, "is_leader": false, "is_alt_art": false },
{ "pack_id": 10000, "slot": "general", "tier": "bronze", "card_id": 101, "rate_pct": 26.5, "is_leader": false, "is_alt_art": false },
{ "pack_id": 10000, "slot": "general", "tier": "legendary", "card_id": 200, "rate_pct": 1.5, "is_leader": false, "is_alt_art": false },
{ "pack_id": 98001, "slot": "bonus", "tier": "special", "card_id": 300, "rate_pct": null, "is_leader": true, "is_alt_art": false },
{ "pack_id": 98001, "slot": "bonus", "tier": "special", "card_id": 301, "rate_pct": null, "is_leader": true, "is_alt_art": false }
]

View File

@@ -1,4 +0,0 @@
[
{ "pack_id": 10000, "short_code": "Basic", "animation_rate_pct": 8.0, "has_bonus_slot": false, "special_kind": null },
{ "pack_id": 98001, "short_code": "98ANV", "animation_rate_pct": 8.0, "has_bonus_slot": true, "special_kind": "leader_card" }
]

View File

@@ -1,10 +0,0 @@
[
{ "pack_id": 10000, "slot": "general", "tier": "bronze", "rate_pct": 76.5 },
{ "pack_id": 10000, "slot": "general", "tier": "silver", "rate_pct": 16.0 },
{ "pack_id": 10000, "slot": "general", "tier": "gold", "rate_pct": 6.0 },
{ "pack_id": 10000, "slot": "general", "tier": "legendary", "rate_pct": 1.5 },
{ "pack_id": 10000, "slot": "eighth", "tier": "silver", "rate_pct": 92.5 },
{ "pack_id": 10000, "slot": "eighth", "tier": "gold", "rate_pct": 6.0 },
{ "pack_id": 10000, "slot": "eighth", "tier": "legendary", "rate_pct": 1.5 },
{ "pack_id": 98001, "slot": "bonus", "tier": "special", "rate_pct": 100.0 }
]