Let Sokko TCG players level up cards for Expeditions with Éclats or duplicates

- Each owned rare or better edition keeps a level and field experience; a level costs Éclats by current power, so every rarity reaches the same cap and a rare pays the longer road.
- A duplicate of the same edition gives a whole level; every claimed expedition grants field experience to the cards it sent.
- A one-way bridge turns stardust into Éclats at an admin-tuned rate.
- The card sheet shows level, power, stats and experience with upgrade buttons; expeditions use the upgraded power.
- Administration › Guilde tunes the cost formula, duplicate levels, field experience and the bridge rate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-15 14:52:44 +01:00
parent 6b7605d04e
commit e0ffccd1c8
22 changed files with 373 additions and 10 deletions

View file

@ -1,10 +1,28 @@
// Rôle : affiche la fiche détaillée d'une carte possédée (grand format, favori, recyclage d'un doublon).
import { Modal } from "../../components/Modal.jsx";
import { recycleDuplicates, setFavorite } from "./cardsApi.js";
import { recycleDuplicates, setFavorite, upgradeCard } from "./cardsApi.js";
import { readCollection } from "./collectionState.js";
import { NebulaCard } from "./NebulaCard.jsx";
import { formatEclats } from "./expeditionFormat.js";
import { formatStardust } from "./stardustFormat.js";
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
// Expéditions : niveau, Puissance, stats et amélioration d'une carte rare ou mieux (Éclats, ou doublon de la même édition).
function CardProgress({ progress, eclats, busy, runMutation }) {
const atCap = progress.nextCost == null;
return <section className="nebula-card-progress" aria-labelledby="nebula-card-progress-title">
<h3 id="nebula-card-progress-title">Expéditions · niveau {progress.level} / {progress.maxLevel}</h3>
<p><strong>Puissance {progress.power}</strong> · {STATS.map(([stat, label]) => `${label} ${progress.stats[stat]}`).join(" · ")}</p>
{!atCap && <div className="nds-progress" data-size="sm" role="progressbar" aria-label="Expérience de terrain" aria-valuemin={0} aria-valuemax={100} aria-valuenow={progress.fieldXp}><span style={{ width: `${progress.fieldXp}%` }} /></div>}
{atCap ? <p className="nebula-form-help">Puissance maximale atteinte.</p> : <div className="nds-toolbar">
<button className="nds-button" data-variant="primary" type="button" disabled={busy || eclats < progress.nextCost} onClick={() => runMutation(() => upgradeCard(progress.editionId, "eclats"))}>Améliorer · {formatEclats(progress.nextCost)} Éclats</button>
{progress.spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => upgradeCard(progress.editionId, "duplicate"))}>Améliorer avec un doublon</button>}
</div>}
{!atCap && <p className="nebula-form-help">Vous avez {formatEclats(eclats)} Éclats. Chaque retour d’expédition donne de l’expérience de terrain ({progress.fieldXp} % du niveau suivant).</p>}
</section>;
}
export function CardDetailModal({ catalog, state, entry, runMutation, busy, onClose, onStartTransfer = null }) {
const owned = readCollection(state).entries.get(entry.edition.id);
const quantity = owned?.quantity || 0;
@ -12,11 +30,13 @@ export function CardDetailModal({ catalog, state, entry, runMutation, busy, onCl
const value = state.shop.stardustValues[entry.edition.rarity] ?? 0;
const favorites = new Set(state.favorites);
const expedition = state.expeditions?.busyEditions?.find((item) => item.editionId === entry.edition.id);
const progress = state.cardProgress?.find((item) => item.editionId === entry.edition.id);
return <Modal dialogClassName="confirm-modal nds-modal nebula-card-detail" labelledBy="nebula-card-detail-title" onRequestClose={onClose}>
<div className="nebula-card-detail-layout"><NebulaCard catalog={catalog} entry={entry} size="lg" />
<div><p className="eyebrow">{catalog.rarities.find((item) => item.id === entry.edition.rarity)?.label}</p><h2 id="nebula-card-detail-title">{entry.card.name}</h2><p>{entry.card.description}</p>
<dl><div><dt>Exemplaires possédés</dt><dd>{quantity}</dd></div><div><dt>Collection</dt><dd>{catalog.collections.find((item) => item.id === entry.card.collectionId)?.name}</dd></div><div><dt>Finitions</dt><dd>{entry.edition.finishIds.map((id) => catalog.finishes.find((item) => item.id === id)?.label).join(" · ")}</dd></div></dl>
{progress && <CardProgress progress={progress} eclats={state.wallet.eclats ?? 0} busy={busy} runMutation={runMutation} />}
<button className="nds-button" data-variant={favorites.has(entry.edition.id) ? "primary" : "secondary"} type="button" disabled={busy} aria-pressed={favorites.has(entry.edition.id)} onClick={() => runMutation(() => setFavorite(entry.edition.id, !favorites.has(entry.edition.id)))}>{favorites.has(entry.edition.id) ? "Retirer des favoris" : "Ajouter aux favoris"}</button>
{spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => recycleDuplicates(entry.edition.id))}>Recycler un doublon (+{formatStardust(value)})</button>}
{spare > 0 && onStartTransfer && <>