Hide unrevealed Cards pulls and show the odds players really get

Keep a pending opening's cards out of the home highlight and collection until
they are revealed, and refuse transfers meanwhile. Odds now ignore rarities a
pack cannot give. Stable files gain an ETag so card images revalidate instead
of downloading again, and logging out clears the local collection copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-05 18:00:32 +01:00
parent b2e46b1d2a
commit 155187d01f
11 changed files with 167 additions and 26 deletions

View file

@ -6,9 +6,11 @@ export function recommendedWeights(rarities) {
}
// Pourcentage de chaque rareté pour une carte tirée, dans l'ordre des raretés du catalogue.
export function rarityPercentages(rarities, weights = {}) {
const total = rarities.reduce((sum, rarity) => sum + (Number(weights[rarity.id]) || 0), 0);
return rarities.map((rarity) => ({ rarity, weight: Number(weights[rarity.id]) || 0, percent: total ? (Number(weights[rarity.id]) || 0) / total * 100 : 0 }));
// `drawable` : raretés que le paquet peut réellement donner, les autres ne comptent pas dans le tirage. Sans cette liste, les poids sont pris tels quels.
export function rarityPercentages(rarities, weights = {}, drawable = null) {
const weightOf = (rarity) => (!drawable || drawable.includes(rarity.id) ? Number(weights[rarity.id]) || 0 : 0);
const total = rarities.reduce((sum, rarity) => sum + weightOf(rarity), 0);
return rarities.map((rarity) => ({ rarity, weight: weightOf(rarity), percent: total ? weightOf(rarity) / total * 100 : 0 }));
}
export function formatPercent(value, maximumFractionDigits = 2) {