Add a loot legend, a foldable Watcher's bag and a mythic halo, and move card sheet and power texts to site.json
- The destinations step opens with a legend of the four loots and what the green and red arrows mean. - The Watcher's bag folds into a strip of item art and counts; the choice is kept by the browser. - Mythic cards wear a slowly turning prismatic ring across the expedition screens; it is visual only. - The card sheet and the stats distribution read their texts from cards.cardSheet, and power descriptions and their figures from cards.expeditions.powerText and powerDetails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
84b0d69b1f
commit
98ffe6562c
20 changed files with 361 additions and 129 deletions
|
|
@ -11,60 +11,62 @@ import { recycleDuplicates, setFavorite, upgradeCard } from "./cardsApi.js";
|
|||
import { CardPlan } from "./CardPlan.jsx";
|
||||
import { CurrencyAmount } from "./Currency.jsx";
|
||||
import { readCollection } from "./collectionState.js";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
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"]];
|
||||
const STAT_IDS = ["bravoure", "endurance", "fortune", "orientation"];
|
||||
const FOCUS_SELECTORS = { plan: ".nebula-card-plan" };
|
||||
const TABS = [{ id: "card", label: "La carte" }, { id: "improve", label: "Amélioration" }];
|
||||
const TAB_IDS = ["card", "improve"];
|
||||
|
||||
// Récapitulatif d'une carte des Expéditions : Puissance, niveau et expérience, puis ses quatre stats (équipement compris ; la part
|
||||
// de l'équipement en petit dessous). `preview` : stats sans équipement de la répartition en cours de choix, montrées « 15 → 18 ».
|
||||
function CardSummary({ progress, preview }) {
|
||||
function CardSummary({ progress, preview, content }) {
|
||||
const atCap = progress.nextCost == null;
|
||||
return <section className="nebula-card-summary" aria-label="Récapitulatif pour les Expéditions">
|
||||
return <section className="nebula-card-summary" aria-label={content.summaryLabel}>
|
||||
<div className="nebula-card-summary-head">
|
||||
<div className="nebula-card-summary-power"><span>Puissance</span><strong>{progress.power}</strong></div>
|
||||
<div className="nebula-card-summary-power"><span>{content.power}</span><strong>{progress.power}</strong></div>
|
||||
<div className="nebula-card-summary-level">
|
||||
<span>Niveau <strong>{progress.level}</strong> / {progress.maxLevel}</span>
|
||||
{atCap ? <small>Puissance maximale atteinte</small> : <>
|
||||
<div className="nds-progress" data-size="sm" role="progressbar" aria-label="Expérience" aria-valuemin={0} aria-valuemax={100} aria-valuenow={progress.fieldXp}><span style={{ width: `${progress.fieldXp}%` }} /></div>
|
||||
<small>Expérience : {progress.fieldXp} / 100</small>
|
||||
<span>{content.level} <strong>{progress.level}</strong> / {progress.maxLevel}</span>
|
||||
{atCap ? <small>{content.atCap}</small> : <>
|
||||
<div className="nds-progress" data-size="sm" role="progressbar" aria-label={content.experience} aria-valuemin={0} aria-valuemax={100} aria-valuenow={progress.fieldXp}><span style={{ width: `${progress.fieldXp}%` }} /></div>
|
||||
<small>{fillTemplate(content.experienceValue, { value: progress.fieldXp })}</small>
|
||||
</>}
|
||||
</div>
|
||||
</div>
|
||||
<ul className="nebula-card-summary-stats" aria-label="Stats">{STATS.map(([stat, label]) => {
|
||||
<ul className="nebula-card-summary-stats" aria-label={content.statsLabel}>{STAT_IDS.map((stat) => {
|
||||
const base = progress.baseStats?.[stat] ?? progress.stats[stat];
|
||||
const gear = progress.stats[stat] - base;
|
||||
const next = preview ? progress.stats[stat] + preview[stat] - base : progress.stats[stat];
|
||||
return <li key={stat} data-trend={next > progress.stats[stat] ? "up" : next < progress.stats[stat] ? "down" : undefined}>
|
||||
<span><MaskIcon name={stat} />{label}</span>
|
||||
<strong>{next !== progress.stats[stat] ? <>{progress.stats[stat]} <span aria-hidden="true">→</span><span className="sr-only"> deviendrait </span>{next}</> : progress.stats[stat]}</strong>
|
||||
{gear !== 0 && <small data-sign={gear > 0 ? "up" : "down"}>{gear > 0 ? "+" : "−"}{Math.abs(gear)} équipement</small>}
|
||||
<span><MaskIcon name={stat} />{content.stats[stat]}</span>
|
||||
<strong>{next !== progress.stats[stat] ? <>{progress.stats[stat]} <span aria-hidden="true">→</span><span className="sr-only">{content.becomes}</span>{next}</> : progress.stats[stat]}</strong>
|
||||
{gear !== 0 && <small data-sign={gear > 0 ? "up" : "down"}>{fillTemplate(content.gear, { value: `${gear > 0 ? "+" : "−"}${Math.abs(gear)}` })}</small>}
|
||||
</li>;
|
||||
})}</ul>
|
||||
</section>;
|
||||
}
|
||||
|
||||
// Amélioration d'une carte rare ou mieux : Éclats, ou doublon de la même édition ; puis la répartition de ses statistiques.
|
||||
function CardProgress({ state, progress, eclats, locked, busy, runMutation, onPreview }) {
|
||||
function CardProgress({ state, progress, eclats, locked, busy, runMutation, onPreview, content }) {
|
||||
const atCap = progress.nextCost == null;
|
||||
return <>
|
||||
{!atCap && <section className="nebula-card-upgrade" aria-labelledby="nebula-card-upgrade-title">
|
||||
<h3 id="nebula-card-upgrade-title">Améliorer</h3>
|
||||
<h3 id="nebula-card-upgrade-title">{content.upgradeTitle}</h3>
|
||||
<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 · <CurrencyAmount kind="eclats">{formatEclats(progress.nextCost)} Éclats</CurrencyAmount></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>}
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || eclats < progress.nextCost} onClick={() => runMutation(() => upgradeCard(progress.editionId, "eclats"))}>{content.upgradeEclats}<CurrencyAmount kind="eclats">{fillTemplate(content.eclatsAmount, { value: formatEclats(progress.nextCost) })}</CurrencyAmount></button>
|
||||
{progress.spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => upgradeCard(progress.editionId, "duplicate"))}>{content.upgradeDuplicate}</button>}
|
||||
</div>
|
||||
<p className="nebula-form-help">Vous avez {formatEclats(eclats)} Éclats. Chaque retour d’expédition donne aussi de l’expérience.</p>
|
||||
<p className="nebula-form-help">{fillTemplate(content.upgradeHelp, { eclats: formatEclats(eclats) })}</p>
|
||||
</section>}
|
||||
<CardPlan key={`${progress.plan.id}-${progress.plan.points}-${JSON.stringify(progress.plan.allocation)}`} progress={progress} oblivions={state.items?.oblivion ?? 0} locked={locked} busy={busy} runMutation={runMutation} onPreview={onPreview} />
|
||||
<CardPlan key={`${progress.plan.id}-${progress.plan.points}-${JSON.stringify(progress.plan.allocation)}`} progress={progress} oblivions={state.items?.oblivion ?? 0} locked={locked} busy={busy} runMutation={runMutation} onPreview={onPreview} content={content.plan} statNames={content.stats} />
|
||||
</>;
|
||||
}
|
||||
|
||||
export function CardDetailModal({ catalog, state, entry, runMutation, busy, onClose, onStartTransfer = null, focus = null, initialTab = "card" }) {
|
||||
// `content` : textes cards.cardSheet.
|
||||
export function CardDetailModal({ catalog, state, entry, content, runMutation, busy, onClose, onStartTransfer = null, focus = null, initialTab = "card" }) {
|
||||
const dialogRef = useRef(null);
|
||||
useEffect(() => {
|
||||
if (!focus) return undefined;
|
||||
|
|
@ -85,24 +87,25 @@ export function CardDetailModal({ catalog, state, entry, runMutation, busy, onCl
|
|||
const [tab, setTab] = useState(focus ? "improve" : initialTab);
|
||||
// Sans progression (commune, destination), seulement la carte.
|
||||
const activeTab = progress ? tab : "card";
|
||||
const tabs = TAB_IDS.map((id) => ({ id, label: content.tabs[id] }));
|
||||
|
||||
const info = <>
|
||||
{entry.card.description && <p className="nebula-card-detail-lore">{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>
|
||||
<dl><div><dt>{content.owned}</dt><dd>{quantity}</dd></div><div><dt>{content.collection}</dt><dd>{catalog.collections.find((item) => item.id === entry.card.collectionId)?.name}</dd></div><div><dt>{content.finishes}</dt><dd>{entry.edition.finishIds.map((id) => catalog.finishes.find((item) => item.id === id)?.label).join(" · ")}</dd></div></dl>
|
||||
<div className="nds-toolbar nebula-card-detail-actions">
|
||||
<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>}
|
||||
<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) ? content.favoriteRemove : content.favoriteAdd}</button>
|
||||
{spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => recycleDuplicates(entry.edition.id))}>{fillTemplate(content.recycle, { value: formatStardust(value) })}</button>}
|
||||
{spare > 0 && onStartTransfer && <>
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("gift", entry.edition.id)}>Donner</button>
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("trade", entry.edition.id)}>Échanger</button>
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("gift", entry.edition.id)}>{content.give}</button>
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("trade", entry.edition.id)}>{content.trade}</button>
|
||||
</>}
|
||||
</div>
|
||||
{quantity > 1 && !spare && <p className="nebula-form-help">Les doublons de cette carte sont réservés par une proposition d’échange en cours.</p>}
|
||||
{quantity > 1 && !spare && <p className="nebula-form-help">{content.reserved}</p>}
|
||||
</>;
|
||||
const improve = progress && <>
|
||||
<CardSummary progress={progress} preview={previewStats} />
|
||||
<CardSummary progress={progress} preview={previewStats} content={content} />
|
||||
<CardProgress state={state} progress={progress} eclats={state.wallet.eclats ?? 0} locked={Boolean(expedition)} busy={busy} runMutation={runMutation}
|
||||
onPreview={(stats) => setPreview({ key: planKey, stats })} />
|
||||
onPreview={(stats) => setPreview({ key: planKey, stats })} content={content} />
|
||||
</>;
|
||||
|
||||
return <Modal dialogClassName="confirm-modal nds-modal nebula-card-detail" labelledBy="nebula-card-detail-title" onRequestClose={onClose} dialogRef={dialogRef}>
|
||||
|
|
@ -110,14 +113,14 @@ export function CardDetailModal({ catalog, state, entry, runMutation, busy, onCl
|
|||
<div className="nebula-card-detail-side"><NebulaCard catalog={catalog} entry={entry} size="lg" /></div>
|
||||
<div className="nebula-card-detail-main">
|
||||
<header><p className="eyebrow">{catalog.rarities.find((item) => item.id === entry.edition.rarity)?.label}</p><h2 id="nebula-card-detail-title">{entry.card.name}</h2></header>
|
||||
{expedition && <p className="nds-inline-notice" data-variant="info">En expédition jusqu’à {new Date(expedition.returnsAt).toLocaleString("fr-FR", { weekday: "long", hour: "2-digit", minute: "2-digit" })}.</p>}
|
||||
{expedition && <p className="nds-inline-notice" data-variant="info">{fillTemplate(content.busyUntil, { date: new Date(expedition.returnsAt).toLocaleString("fr-FR", { weekday: "long", hour: "2-digit", minute: "2-digit" }) })}</p>}
|
||||
{/* Une carte des Expéditions a deux onglets : la carte et son lore, puis son amélioration. */}
|
||||
{progress && <Tabs className="nebula-card-detail-tabs" tabs={TABS} activeTab={activeTab} onChange={setTab} />}
|
||||
<div className="nebula-card-detail-panel" role={progress ? "tabpanel" : undefined} aria-label={progress ? TABS.find((item) => item.id === activeTab).label : undefined}>
|
||||
{progress && <Tabs className="nebula-card-detail-tabs" tabs={tabs} activeTab={activeTab} onChange={setTab} />}
|
||||
<div className="nebula-card-detail-panel" role={progress ? "tabpanel" : undefined} aria-label={progress ? content.tabs[activeTab] : undefined}>
|
||||
{activeTab === "improve" ? improve : info}
|
||||
</div>
|
||||
<div className="nds-toolbar nebula-card-detail-close">
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={onClose}>Fermer</button>
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={onClose}>{content.close}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,23 +6,21 @@
|
|||
// « Personnalisé » reste gratuit.
|
||||
import { useState } from "react";
|
||||
import { setCardPlan } from "./cardsApi.js";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
|
||||
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
|
||||
const PROFILES = [
|
||||
{ id: "leader", stat: "bravoure", label: "Meneur", help: "Surtout de la Bravoure, pour les destinations qui en demandent beaucoup." },
|
||||
{ id: "guardian", stat: "endurance", label: "Gardien", help: "Surtout de l’Endurance, pour les destinations qui en demandent beaucoup." },
|
||||
{ id: "seeker", stat: "fortune", label: "Chercheur", help: "Surtout de la Fortune, pour les destinations qui en demandent beaucoup." },
|
||||
{ id: "navigator", stat: "orientation", label: "Navigateur", help: "Surtout de l’Orientation, pour les destinations qui en demandent beaucoup." }
|
||||
];
|
||||
const HELP = { collection: "Les points suivent le profil de la collection de la carte.", free: "Vous placez vous-même chaque point." };
|
||||
const ZERO = Object.fromEntries(STATS.map(([stat]) => [stat, 0]));
|
||||
const STATS = ["bravoure", "endurance", "fortune", "orientation"];
|
||||
// Profils et la stat que chacun privilégie (libellés et aides : cards.cardSheet.plan.profiles).
|
||||
const PROFILES = [{ id: "leader", stat: "bravoure" }, { id: "guardian", stat: "endurance" }, { id: "seeker", stat: "fortune" }, { id: "navigator", stat: "orientation" }];
|
||||
const ZERO = Object.fromEntries(STATS.map((stat) => [stat, 0]));
|
||||
const total = (stats) => Object.values(stats).reduce((sum, value) => sum + value, 0);
|
||||
const toDraft = (allocation) => Object.fromEntries(STATS.map(([stat]) => [stat, String(allocation?.[stat] ?? 0)]));
|
||||
const toAllocation = (draft) => Object.fromEntries(STATS.map(([stat]) => [stat, Math.max(0, Number.parseInt(draft[stat], 10) || 0)]));
|
||||
const toDraft = (allocation) => Object.fromEntries(STATS.map((stat) => [stat, String(allocation?.[stat] ?? 0)]));
|
||||
const toAllocation = (draft) => Object.fromEntries(STATS.map((stat) => [stat, Math.max(0, Number.parseInt(draft[stat], 10) || 0)]));
|
||||
const plural = (count) => (count > 1 ? "s" : "");
|
||||
|
||||
// `locked` : la carte est en expédition, sa répartition ne change pas avant son retour.
|
||||
export function CardPlan({ progress, oblivions, locked = false, busy, runMutation, onPreview = () => {} }) {
|
||||
// `locked` : la carte est en expédition, sa répartition ne change pas avant son retour. `content` : textes cards.cardSheet.plan,
|
||||
// `statNames` : noms des stats.
|
||||
export function CardPlan({ progress, oblivions, content, statNames, locked = false, busy, runMutation, onPreview = () => {} }) {
|
||||
const plan = progress.plan;
|
||||
// Choix encore ouvert : premier choix, ou après une réinitialisation.
|
||||
const open = !plan.paid;
|
||||
|
|
@ -33,8 +31,8 @@ export function CardPlan({ progress, oblivions, locked = false, busy, runMutatio
|
|||
const profile = PROFILES.find((item) => item.id === choice) || null;
|
||||
const allocation = toAllocation(draft);
|
||||
const left = plan.points - total(allocation);
|
||||
const statsFor = (id, points) => (id === "free" ? Object.fromEntries(STATS.map(([stat]) => [stat, plan.levelBase[stat] + points[stat]])) : plan.previews[id]);
|
||||
const unchangedFor = (id, points) => id === plan.id && (id !== "free" || STATS.every(([stat]) => points[stat] === placed[stat]));
|
||||
const statsFor = (id, points) => (id === "free" ? Object.fromEntries(STATS.map((stat) => [stat, plan.levelBase[stat] + points[stat]])) : plan.previews[id]);
|
||||
const unchangedFor = (id, points) => id === plan.id && (id !== "free" || STATS.every((stat) => points[stat] === placed[stat]));
|
||||
const unchanged = unchangedFor(choice, allocation);
|
||||
// Le profil qui donne à la carte sa stat la plus haute.
|
||||
const best = PROFILES.reduce((top, item) => (plan.previews[item.id][item.stat] > plan.previews[top.id][top.stat] ? item : top), PROFILES[0]).id;
|
||||
|
|
@ -61,39 +59,39 @@ export function CardPlan({ progress, oblivions, locked = false, busy, runMutatio
|
|||
const reset = async () => {
|
||||
if (await runMutation(() => setCardPlan(progress.editionId, "free", ZERO))) onPreview(null);
|
||||
};
|
||||
const removesPoints = free && plan.id === "free" && STATS.some(([stat]) => allocation[stat] < placed[stat]);
|
||||
const removesPoints = free && plan.id === "free" && STATS.some((stat) => allocation[stat] < placed[stat]);
|
||||
const editable = !locked && (open || plan.id === "free");
|
||||
const option = (id, label, stat = null) => <button key={id} type="button" className="nds-button" data-size="sm" data-variant={id === choice ? "primary" : "secondary"} aria-pressed={id === choice}
|
||||
disabled={busy || locked || (!open && id !== choice)} onClick={() => choose(id)}>
|
||||
{stat && <MaskIcon name={stat} />}{label}{id === best && <span className="nebula-card-plan-best" aria-label="(le plus adapté à cette carte)" title="Le plus adapté à cette carte">★</span>}
|
||||
{stat && <MaskIcon name={stat} />}{label}{id === best && <span className="nebula-card-plan-best" aria-label={content.best} title={content.bestTitle}>★</span>}
|
||||
</button>;
|
||||
|
||||
// « Valider » et « Annuler » dans le cadre du choix en cours, sous ce qui a changé.
|
||||
const actions = !unchanged && <div className="nebula-card-plan-actions">
|
||||
{plan.id === "collection" && !free && <p className="nebula-form-help">Premier choix gratuit : ensuite, le changer demandera de réinitialiser la répartition avec un Parchemin d’oubli.</p>}
|
||||
{removesPoints && <p className="nebula-form-help">Pour retirer des points déjà placés, réinitialisez la répartition.</p>}
|
||||
{plan.id === "collection" && !free && <p className="nebula-form-help">{content.firstFree}</p>}
|
||||
{removesPoints && <p className="nebula-form-help">{content.removeNeedsReset}</p>}
|
||||
<div className="nds-toolbar">
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || locked || removesPoints} onClick={save}>Valider</button>
|
||||
<button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={cancel}>Annuler</button>
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || locked || removesPoints} onClick={save}>{content.save}</button>
|
||||
<button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={cancel}>{content.cancel}</button>
|
||||
</div>
|
||||
</div>;
|
||||
|
||||
return <section className="nebula-card-plan" aria-labelledby="nebula-card-plan-title">
|
||||
<h3 id="nebula-card-plan-title">Répartition des statistiques</h3>
|
||||
<h3 id="nebula-card-plan-title">{content.title}</h3>
|
||||
<p className="nebula-form-help">{plan.points
|
||||
? `${plan.points} point${plan.points > 1 ? "s" : ""} gagné${plan.points > 1 ? "s" : ""} en améliorant la carte.`
|
||||
: "Chaque amélioration donne des points de stats, répartis selon ce choix."}</p>
|
||||
? fillTemplate(content.pointsGained, { count: plan.points, s: plural(plan.points) })
|
||||
: content.pointsLater}</p>
|
||||
{/* Deux cadres : « Par défaut » ou « Personnalisé » (et ses points juste dessous), puis les profils ; le cadre du choix en cours
|
||||
est souligné d'or. */}
|
||||
<div role="group" aria-label="Par défaut ou personnalisé" className="nebula-card-plan-frame" data-active={!profile || undefined}>
|
||||
<div className="nds-toolbar">{option("collection", "Par défaut")}{option("free", "Personnalisé")}</div>
|
||||
{!profile && <p className="nebula-form-help">{HELP[choice]}</p>}
|
||||
<div role="group" aria-label={content.defaultOrCustom} className="nebula-card-plan-frame" data-active={!profile || undefined}>
|
||||
<div className="nds-toolbar">{option("collection", content.default)}{option("free", content.custom)}</div>
|
||||
{!profile && <p className="nebula-form-help">{content.help[choice]}</p>}
|
||||
{free && <div className="nebula-card-plan-points">
|
||||
<p className="nebula-card-plan-left" role="status">{!plan.points ? "Aucun point à répartir pour l’instant : améliorez la carte." : <>
|
||||
{left > 0 ? `${left} point${left > 1 ? "s" : ""} à répartir` : "Tous les points sont répartis."}
|
||||
<small>{`Au plus ${plan.maxStatPoints} dans une même stat.`}</small>
|
||||
<p className="nebula-card-plan-left" role="status">{!plan.points ? content.noPoints : <>
|
||||
{left > 0 ? fillTemplate(content.left, { count: left, s: plural(left) }) : content.allPlaced}
|
||||
<small>{fillTemplate(content.cap, { count: plan.maxStatPoints })}</small>
|
||||
</>}</p>
|
||||
{STATS.map(([stat, label]) => <label key={stat}><span><MaskIcon name={stat} />{label}</span>
|
||||
{STATS.map((stat) => <label key={stat}><span><MaskIcon name={stat} />{statNames[stat]}</span>
|
||||
<input className="nds-input" type="number" inputMode="numeric" min={open ? 0 : placed[stat]} max={plan.maxStatPoints} step="1" value={draft[stat]} disabled={busy || !editable || !plan.points}
|
||||
onChange={(event) => setPoints(stat, event.target.value)} onBlur={() => { if (draft[stat] === "") setDraft((current) => ({ ...current, [stat]: "0" })); }} />
|
||||
</label>)}
|
||||
|
|
@ -101,15 +99,15 @@ export function CardPlan({ progress, oblivions, locked = false, busy, runMutatio
|
|||
{!profile && actions}
|
||||
</div>
|
||||
<div role="group" aria-labelledby="nebula-card-plan-profiles" className="nebula-card-plan-frame" data-active={profile ? true : undefined}>
|
||||
<h4 id="nebula-card-plan-profiles">Répartition automatique par profil</h4>
|
||||
<div className="nds-toolbar">{PROFILES.map((item) => option(item.id, item.label, item.stat))}</div>
|
||||
{profile && <p className="nebula-form-help">{profile.help}</p>}
|
||||
<h4 id="nebula-card-plan-profiles">{content.profilesTitle}</h4>
|
||||
<div className="nds-toolbar">{PROFILES.map((item) => option(item.id, content.profiles[item.id].label, item.stat))}</div>
|
||||
{profile && <p className="nebula-form-help">{content.profiles[profile.id].help}</p>}
|
||||
{profile && actions}
|
||||
</div>
|
||||
{locked && <p className="nebula-form-help">Cette carte est en expédition : sa répartition pourra changer à son retour.</p>}
|
||||
{locked && <p className="nebula-form-help">{content.locked}</p>}
|
||||
{!open && !locked && <div className="nebula-card-plan-reset">
|
||||
<button className="nds-button" data-variant="secondary" type="button" disabled={busy || oblivions < 1} onClick={reset}>Réinitialiser la répartition · 1 Parchemin d’oubli</button>
|
||||
<p className="nebula-form-help">{`Vous en avez ${oblivions}.${oblivions < 1 ? " Ils s’achètent dans la Boutique." : " La carte repasse en « Personnalisé », tous ses points à répartir : un profil les répartit tout seul."}`}</p>
|
||||
<button className="nds-button" data-variant="secondary" type="button" disabled={busy || oblivions < 1} onClick={reset}>{content.reset}</button>
|
||||
<p className="nebula-form-help">{`${fillTemplate(content.resetCount, { count: oblivions })} ${oblivions < 1 ? content.resetBuy : content.resetHelp}`}</p>
|
||||
</div>}
|
||||
</section>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function GuildBanner({ state, content, guildContent }) {
|
|||
</section>;
|
||||
}
|
||||
|
||||
export function CardsHomePanel({ catalog, state, runMutation, busy, content, guildContent, onOpenPacks }) {
|
||||
export function CardsHomePanel({ catalog, state, runMutation, busy, content, guildContent, cardSheetContent, onOpenPacks }) {
|
||||
const [detailOpen, setDetailOpen] = useState(false);
|
||||
const collectibleCards = catalog.cards.filter((card) => catalog.editions.some((edition) => edition.cardId === card.id && !edition.promotional));
|
||||
const collectibleEditions = catalog.editions.filter((edition) => !edition.promotional);
|
||||
|
|
@ -68,6 +68,6 @@ export function CardsHomePanel({ catalog, state, runMutation, busy, content, gui
|
|||
<DashboardStat label={content.stardust} value={<StardustBalance value={state.wallet.stardust} />} />
|
||||
<DashboardStat label={content.recyclable} value={state.recycling.count} />
|
||||
</section>
|
||||
{detailOpen && rarest && <CardDetailModal catalog={catalog} state={state} entry={rarest} runMutation={runMutation} busy={busy} onClose={() => setDetailOpen(false)} />}
|
||||
{detailOpen && rarest && <CardDetailModal catalog={catalog} state={state} entry={rarest} content={cardSheetContent} runMutation={runMutation} busy={busy} onClose={() => setDetailOpen(false)} />}
|
||||
</section>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,7 +251,8 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", player
|
|||
setTransferDraft({ type, editionId });
|
||||
navigate("/cards/transfers");
|
||||
};
|
||||
const panelProps = { catalog, state, runMutation, busy: busy || offline };
|
||||
// `cardSheetContent` : textes de la fiche d'une carte, ouverte depuis plusieurs panneaux.
|
||||
const panelProps = { catalog, state, runMutation, busy: busy || offline, cardSheetContent: content.cardSheet };
|
||||
const hero = <header className="page-hero nds-page-hero nebula-player-hero">
|
||||
<div><p className="eyebrow">{content.eyebrow}</p><h1>{content.title}</h1><p>{content.description}</p></div>
|
||||
<CardsAccount player={state.player} onLogout={offline ? null : logout} />
|
||||
|
|
@ -275,7 +276,7 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", player
|
|||
{section === "home" && <CardsHomePanel {...panelProps} content={content.home} guildContent={content.guild} onOpenPacks={openPacks} />}
|
||||
{section === "guild" && <GuildPanel catalog={catalog} state={state} content={content.guild} />}
|
||||
{section === "daily" && <DailyPanel {...panelProps} content={content.daily} />}
|
||||
{section === "expeditions" && <ExpeditionsPanel {...panelProps} content={content.expeditions} joinId={decodeURIComponent(playerSubsection)} />}
|
||||
{section === "expeditions" && <ExpeditionsPanel {...panelProps} content={{ ...content.expeditions, cardSheet: content.cardSheet }} joinId={decodeURIComponent(playerSubsection)} />}
|
||||
{section === "packs" && <PackPanel {...panelProps} content={content.packs} reserveContent={content.home} />}
|
||||
{section === "collection" && <CollectionPanel {...panelProps} headingContent={content.collection} recyclingContent={content.recycling} onStartTransfer={startTransfer} />}
|
||||
{section === "shop" && <ShopPanel {...panelProps} content={content.shop} onOpenPacks={openPacks} />}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { formatStardust } from "./stardustFormat.js";
|
|||
const OWNERSHIP_OPTIONS = [{ value: "owned", label: "Possédées" }, { value: "missing", label: "Manquantes" }, { value: "duplicates", label: "Doublons" }];
|
||||
const countDuplicates = (count) => `${count} doublon${count > 1 ? "s" : ""}`;
|
||||
|
||||
export function CollectionPanel({ catalog, state, runMutation, busy, headingContent, recyclingContent: content, onStartTransfer }) {
|
||||
export function CollectionPanel({ catalog, state, runMutation, busy, headingContent, recyclingContent: content, cardSheetContent, onStartTransfer }) {
|
||||
const [search, setSearch] = useState("");
|
||||
const [collectionIds, setCollectionIds] = useState([]);
|
||||
const [rarities, setRarities] = useState([]);
|
||||
|
|
@ -126,6 +126,6 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
|
|||
>
|
||||
<ul className="nebula-shop-rates" aria-label={content.ratesLabel}>{catalog.rarities.map((rarity) => <li key={rarity.id} data-rarity={rarity.id}><span>{rarity.label}</span><StardustBalance value={shop.stardustValues[rarity.id] ?? 0} /></li>)}</ul>
|
||||
</ConfirmModal>}
|
||||
{selected && <CardDetailModal catalog={catalog} state={state} entry={selected} runMutation={runMutation} busy={busy} onClose={() => setSelected(null)} onStartTransfer={onStartTransfer} />}
|
||||
{selected && <CardDetailModal catalog={catalog} state={state} entry={selected} content={cardSheetContent} runMutation={runMutation} busy={busy} onClose={() => setSelected(null)} onStartTransfer={onStartTransfer} />}
|
||||
</>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { useState } from "react";
|
|||
import { Modal } from "../../components/Modal.jsx";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
import { editionEntry, POWER_TEXT, powerDetails } from "./expeditionFormat.js";
|
||||
import { editionEntry, powerDetails, powerText } from "./expeditionFormat.js";
|
||||
import { NebulaCard } from "./NebulaCard.jsx";
|
||||
|
||||
const RECIPE_SIZE = 3;
|
||||
|
|
@ -20,8 +20,8 @@ function CraftedCard({ catalog, entry, content, powerValues }) {
|
|||
{entry.card.description && <p className="nebula-atelier-description">{entry.card.description}</p>}
|
||||
{power && <section className="nebula-atelier-power" aria-label={content.atelierPower}>
|
||||
<h4><MaskIcon name="power" />{content.powers[power] || power}</h4>
|
||||
<p>{POWER_TEXT[power]}</p>
|
||||
{powerDetails(power, powerValues).length > 0 && <ul>{powerDetails(power, powerValues).map((line) => <li key={line}>{line}</li>)}</ul>}
|
||||
<p>{powerText(power, content)}</p>
|
||||
{powerDetails(power, powerValues, content).length > 0 && <ul>{powerDetails(power, powerValues, content).map((line) => <li key={line}>{line}</li>)}</ul>}
|
||||
</section>}
|
||||
</div>
|
||||
</div>;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { Modal } from "../../components/Modal.jsx";
|
|||
import { Tooltip } from "../../components/Tooltip.jsx";
|
||||
import { equipCard } from "./cardsApi.js";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { editionEntry, POWER_TEXT, powerDetails, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
|
||||
import { editionEntry, powerDetails, powerText, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
|
||||
import { MaskIcon, StatValue } from "./ExpeditionLabels.jsx";
|
||||
import { NebulaCard } from "./NebulaCard.jsx";
|
||||
|
||||
|
|
@ -28,18 +28,18 @@ const PLACEHOLDER_SLOTS = [0, 1, 2];
|
|||
// stat (icône de fiole et nom en or, effet au survol), pour ne pas ressembler aux pastilles d'étiquette. Posée en synergie,
|
||||
// le bonus de synergie suit la stat qu'il renforce, dans la couleur de l'étiquette partagée : « +8 (+2) ».
|
||||
// Infobulle d'un pouvoir : sa description, puis ses effets chiffrés.
|
||||
export function PowerTooltipContent({ power, values }) {
|
||||
export function PowerTooltipContent({ power, values, content }) {
|
||||
return <span className="nebula-tooltip-lines">
|
||||
<span>{POWER_TEXT[power]}</span>
|
||||
{powerDetails(power, values).map((line) => <span key={line} className="nebula-power-detail">{line}</span>)}
|
||||
<span>{powerText(power, content)}</span>
|
||||
{powerDetails(power, values, content).map((line) => <span key={line} className="nebula-power-detail">{line}</span>)}
|
||||
</span>;
|
||||
}
|
||||
|
||||
export function EquipmentStats({ item, content, color, powerValues }) {
|
||||
// Une commune de pouvoir n'a pas de stats ; posée en synergie, son bonus va à la première stat, et s'affiche sous le pouvoir.
|
||||
if (item.power) return <span className="nebula-equipment-stats">
|
||||
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={item.power} values={powerValues} />}
|
||||
aria-label={[`${content.powers[item.power]} : ${POWER_TEXT[item.power]}`, ...powerDetails(item.power, powerValues)].join(" ; ")} tabIndex={-1}>
|
||||
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={item.power} values={powerValues} content={content} />}
|
||||
aria-label={[`${content.powers[item.power]} : ${powerText(item.power, content)}`, ...powerDetails(item.power, powerValues, content)].join(" ; ")} tabIndex={-1}>
|
||||
<MaskIcon name="power" /><span aria-hidden="true">{content.powers[item.power]}</span>
|
||||
</Tooltip>
|
||||
{item.synergyStat && item.synergyBonus > 0 && <Tooltip className="nebula-stat-value" content={content.stats[item.synergyStat]} aria-label={`${content.stats[item.synergyStat]} : +${item.synergyBonus}`} tabIndex={-1}>
|
||||
|
|
|
|||
|
|
@ -204,17 +204,18 @@ export function EngraveModal({ catalog, state, view, content, busy, runMutation,
|
|||
</Modal>;
|
||||
}
|
||||
|
||||
export function CardSheet({ catalog, state, editionId, focus = null, busy, runMutation, onClose }) {
|
||||
// `content` : textes cards.cardSheet.
|
||||
export function CardSheet({ catalog, state, editionId, content, focus = null, busy, runMutation, onClose }) {
|
||||
const entry = editionEntry(catalog, editionId);
|
||||
if (!entry) return null;
|
||||
return <CardDetailModal catalog={catalog} state={state} entry={entry} focus={focus} initialTab="improve" runMutation={runMutation} busy={busy} onClose={onClose} />;
|
||||
return <CardDetailModal catalog={catalog} state={state} entry={entry} content={content} focus={focus} initialTab="improve" runMutation={runMutation} busy={busy} onClose={onClose} />;
|
||||
}
|
||||
|
||||
export function ImproveCardPicker({ catalog, state, view, item, content, busy, runMutation, onClose }) {
|
||||
const [chosen, setChosen] = useState(null);
|
||||
const filters = useCardFilters();
|
||||
const cards = applyCardFilters([...view.cards].sort((a, b) => b.power - a.power), filters, { entryOf: (card) => editionEntry(catalog, card.editionId), statOf: (card, stat) => card.stats[stat], mode: "sort" });
|
||||
if (chosen) return <CardSheet catalog={catalog} state={state} editionId={chosen} focus="plan" busy={busy} runMutation={runMutation} onClose={onClose} />;
|
||||
if (chosen) return <CardSheet catalog={catalog} state={state} editionId={chosen} content={content.cardSheet} focus="plan" busy={busy} runMutation={runMutation} onClose={onClose} />;
|
||||
return <Modal dialogClassName="confirm-modal nds-modal nebula-expedition-picker" labelledBy="nebula-improve-picker-title" onRequestClose={onClose}>
|
||||
<h2 id="nebula-improve-picker-title">{content.items[item]}</h2>
|
||||
<p className="nebula-form-help">{content.improvePickerHelp[item]}</p>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { fillTemplate } from "./dailyShare.js";
|
|||
import { ExpeditionCardTile } from "./ExpeditionCardTile.jsx";
|
||||
import { EquipmentPicker, EquipmentSlots, PowerTooltipContent } from "./ExpeditionEquipmentSlots.jsx";
|
||||
import { CardSheet, EngraveModal } from "./ExpeditionImprove.jsx";
|
||||
import { editionEntry, formatDecimal, helpScore, POWER_TEXT, powerDetails, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
|
||||
import { editionEntry, formatDecimal, helpScore, powerDetails, powerText, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
import { NebulaCard } from "./NebulaCard.jsx";
|
||||
|
||||
|
|
@ -99,16 +99,16 @@ export function ExpeditionLoadout({ catalog, state, view, destination, card, onC
|
|||
</li>;
|
||||
})}</ul>
|
||||
{card.powers?.length > 0 && <ul className="nebula-expedition-chosen-powers" aria-label={content.chosenPowers}>{card.powers.map((power) => <li key={power}>
|
||||
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={power} values={view.powers} />}
|
||||
aria-label={[`${content.powers[power]} : ${POWER_TEXT[power]}`, ...powerDetails(power, view.powers)].join(" ; ")} tabIndex={0}>
|
||||
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={power} values={view.powers} content={content} />}
|
||||
aria-label={[`${content.powers[power]} : ${powerText(power, content)}`, ...powerDetails(power, view.powers, content)].join(" ; ")} tabIndex={0}>
|
||||
<MaskIcon name="power" /><span aria-hidden="true">{content.powers[power]}</span>
|
||||
</Tooltip> {POWER_TEXT[power]}
|
||||
</Tooltip> {powerText(power, content)}
|
||||
</li>)}</ul>}
|
||||
</section>}
|
||||
</div>
|
||||
</div>
|
||||
{picker?.engrave && progress && <EngraveModal catalog={catalog} state={state} view={view} equipmentId={picker.engrave} characterId={progress.editionId} content={content} busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} />}
|
||||
{picker === "sheet" && card && <CardSheet catalog={catalog} state={state} editionId={card.editionId} busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} />}
|
||||
{picker === "sheet" && card && <CardSheet catalog={catalog} state={state} editionId={card.editionId} content={content.cardSheet} busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} />}
|
||||
{picker === "card" && <CardPicker catalog={catalog} view={view} destination={destination} selectedId={card?.editionId} content={content} onChoose={onChooseCard} onClose={() => setPicker(null)} />}
|
||||
{typeof picker === "number" && progress && <EquipmentPicker catalog={catalog} state={state} progress={progress} cardName={entry?.card.name || ""} slot={picker} content={content}
|
||||
busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} powerValues={view.powers} />}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// le palier et le score, l'effet du palier sur le butin, le butin attendu et les pouvoirs de l'équipe.
|
||||
import { Tooltip } from "../../components/Tooltip.jsx";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { formatEclats, POWER_TEXT, TIER_VARIANTS } from "./expeditionFormat.js";
|
||||
import { formatEclats, powerText, TIER_VARIANTS } from "./expeditionFormat.js";
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
|
||||
// Effet du palier prévu sur le butin, en une phrase ; le pourcentage en rouge (réduit) ou en vert (augmenté).
|
||||
|
|
@ -16,7 +16,7 @@ export function TierLoot({ pct, content }) {
|
|||
|
||||
// Nom d'un pouvoir de l'équipe (icône de fiole), sa description au survol.
|
||||
export function PowerName({ power, content }) {
|
||||
return <Tooltip className="nebula-equipment-power" content={POWER_TEXT[power]} aria-label={`${content.powers[power]} : ${POWER_TEXT[power]}`} tabIndex={0}>
|
||||
return <Tooltip className="nebula-equipment-power" content={powerText(power, content)} aria-label={`${content.powers[power]} : ${powerText(power, content)}`} tabIndex={0}>
|
||||
<MaskIcon name="power" /><span aria-hidden="true">{content.powers[power]}</span>
|
||||
</Tooltip>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,17 @@ function LootEffects({ specialty, settings, content }) {
|
|||
})}</span>;
|
||||
}
|
||||
|
||||
// Légende du butin des destinations, une fois en tête de l'étape : chaque icône avec son nom, et le sens des flèches.
|
||||
function LootLegend({ content }) {
|
||||
return <p className="nebula-loot-legend" aria-label={content.lootLegendLabel}>
|
||||
<span className="nebula-loot-legend-kinds">{LOOT_KINDS.map((kind) => <span key={kind}><MaskIcon name={kind} />{content.loot[kind]}</span>)}</span>
|
||||
<span className="nebula-loot-legend-trends">
|
||||
<span data-trend="up"><svg className="nebula-loot-arrow" viewBox="0 0 10 10" aria-hidden="true"><path d={ARROW_PATHS.up} /></svg>{content.lootLegendUp}</span>
|
||||
<span data-trend="down"><svg className="nebula-loot-arrow" viewBox="0 0 10 10" aria-hidden="true"><path d={ARROW_PATHS.down} /></svg>{content.lootLegendDown}</span>
|
||||
</span>
|
||||
</p>;
|
||||
}
|
||||
|
||||
// Illustration d'une destination : son paysage dans la forme du coup de pinceau, sinon l'image de sa carte de couverture.
|
||||
// Toujours un bandeau de même forme, pour que les cartes voisines restent alignées.
|
||||
function DestinationCover({ catalog, destination }) {
|
||||
|
|
@ -203,6 +214,7 @@ export function ExpeditionPlanner({ catalog, state, view, content, busy, onStart
|
|||
</button>}
|
||||
</div>
|
||||
{view.unlocked && view.unlocked.count < view.unlocked.total && <p className="nebula-form-help">{fillTemplate(content.unlockedDestinations, view.unlocked)}</p>}
|
||||
<LootLegend content={content} />
|
||||
<p className="nebula-form-help">{card ? fillTemplate(content.requirementsHelpCard, { card: editionEntry(catalog, card.editionId)?.card.name || "" }) : content.requirementsHelp}</p>
|
||||
<div className="nebula-expedition-destinations">{destinations.map((item) => <DestinationOption key={item.id} catalog={catalog} item={item} selected={item.id === destination.id} card={card}
|
||||
view={view} content={content} onSelect={() => setDestinationId(item.id)} />)}</div>
|
||||
|
|
|
|||
|
|
@ -48,8 +48,28 @@ function ItemArt({ id, count }) {
|
|||
</span>;
|
||||
}
|
||||
|
||||
// Sac replié ou déplié : une préférence de ce navigateur seulement, gardée d'une visite à l'autre.
|
||||
const BAG_OPEN_KEY = "sokko-tcg-bag-open";
|
||||
const readBagOpen = () => {
|
||||
try {
|
||||
return globalThis.localStorage?.getItem(BAG_OPEN_KEY) !== "false";
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtelierClosed, runMutation }) {
|
||||
const [crafting, setCrafting] = useState(false);
|
||||
// Replié, le Sac n'est qu'une rangée d'objets et leur quantité : la préparation de l'expédition remonte.
|
||||
const [open, setOpen] = useState(readBagOpen);
|
||||
const toggle = () => {
|
||||
setOpen(!open);
|
||||
try {
|
||||
globalThis.localStorage?.setItem(BAG_OPEN_KEY, String(!open));
|
||||
} catch {
|
||||
// Sans stockage, le choix vaut pour cette visite.
|
||||
}
|
||||
};
|
||||
// Burin ou Parchemin : la fenêtre des cartes ouverte pour cet objet, puis la fiche de la carte choisie.
|
||||
const [improving, setImproving] = useState(null);
|
||||
const { items } = view;
|
||||
|
|
@ -61,9 +81,17 @@ function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtel
|
|||
.sort(([a], [b]) => BAG_ORDER.indexOf(a) - BAG_ORDER.indexOf(b));
|
||||
// Sans objet, pas de Sac du Veilleur.
|
||||
if (!owned.length) return null;
|
||||
return <section className="nds-panel nebula-expedition-bag" aria-labelledby="nebula-expedition-bag-title">
|
||||
<h3 id="nebula-expedition-bag-title">{content.bagTitle}</h3>
|
||||
<ul>{owned.map(([id, count]) => {
|
||||
return <section className="nds-panel nebula-expedition-bag" aria-labelledby="nebula-expedition-bag-title" data-open={open || undefined}>
|
||||
<div className="nebula-expedition-bag-heading">
|
||||
<h3 id="nebula-expedition-bag-title">{content.bagTitle}</h3>
|
||||
{!open && <ul className="nebula-bag-strip" aria-label={content.bagTitle}>{owned.map(([id, count]) => <li key={id} title={content.items[id]}>
|
||||
<ItemArt id={id} count={count} /><span className="sr-only">{`${content.items[id]} ×${count}`}</span>
|
||||
</li>)}</ul>}
|
||||
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" aria-expanded={open} aria-controls="nebula-expedition-bag-items" onClick={toggle}>
|
||||
{open ? content.bagHide : content.bagShow}
|
||||
</button>
|
||||
</div>
|
||||
{open && <ul id="nebula-expedition-bag-items">{owned.map(([id, count]) => {
|
||||
const action = actions[id];
|
||||
return <li key={id} className="nds-card nebula-bag-item">
|
||||
<ItemArt id={id} count={count} />
|
||||
|
|
@ -74,7 +102,7 @@ function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtel
|
|||
aria-label={fillTemplate(content.useItemLabel, { item: content.items[id] })} onClick={() => setImproving(id)}>{content.useItem}</button>}
|
||||
{id === "plan" && view.atelierAvailable && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => setCrafting(true)}>{content.atelierOpen}</button>}
|
||||
</li>;
|
||||
})}</ul>
|
||||
})}</ul>}
|
||||
{improving === "engraving" && <EngraveModal catalog={catalog} state={state} view={view} content={content} busy={busy} runMutation={runMutation} onClose={() => setImproving(null)} />}
|
||||
{improving === "oblivion" && <ImproveCardPicker catalog={catalog} state={state} view={view} item={improving} content={content} busy={busy} runMutation={runMutation} onClose={() => setImproving(null)} />}
|
||||
{crafting && <ExpeditionAtelier catalog={catalog} state={state} content={content} busy={busy} powerValues={view.powers} onCraft={onCraft} onClose={() => { setCrafting(false); onAtelierClosed(); }} />}
|
||||
|
|
|
|||
|
|
@ -5,37 +5,15 @@ export const STAT_IDS = ["bravoure", "endurance", "fortune", "orientation"];
|
|||
// Variante de badge de chaque palier.
|
||||
export const TIER_VARIANTS = { struggle: "neutral", success: "success", triumph: "gold" };
|
||||
|
||||
// Pouvoirs des communes des Carnets : un avantage, une contrepartie (les valeurs se règlent dans l'administration).
|
||||
export const POWER_TEXT = {
|
||||
longsight: "Plus de chance de rapporter une carte, mais un trajet plus long.",
|
||||
rations: "Un trajet plus court, mais moins de butin.",
|
||||
treasureMap: "Rapporte toujours un objet rare en plus, mais le score baisse un peu.",
|
||||
talisman: "Toujours une Réussite : jamais de Retour difficile, mais jamais de Triomphe.",
|
||||
madCompass: "Bien plus de butin, mais des exigences incertaines : elles peuvent être plus basses ou plus hautes qu’affiché, et ne sont révélées qu’au retour.",
|
||||
starNet: "Une chance de rapporter en plus une carte des Carnets des Veilleurs, mais un peu moins de Fortune.",
|
||||
stormLantern: "Les dangers non parés font moins baisser les stats, mais le trajet est plus long.",
|
||||
fogBell: "En groupe, le score de l’équipe augmente ; seul, vous rapportez moins de butin."
|
||||
};
|
||||
// Pouvoirs des communes des Carnets : un avantage, une contrepartie (textes cards.expeditions.powerText ; les valeurs se règlent
|
||||
// dans l'administration).
|
||||
export const powerText = (power, content) => content.powerText?.[power] || "";
|
||||
|
||||
const STAT_NAMES = { bravoure: "Bravoure", endurance: "Endurance", fortune: "Fortune", orientation: "Orientation" };
|
||||
// Effet d'un équipement : son pouvoir, ou les stats qu'il ajoute (« +3 Bravoure · +3 Fortune »).
|
||||
export const equipmentEffect = (item) => (item.power ? POWER_TEXT[item.power]
|
||||
: Object.entries(item.stats || {}).map(([stat, value]) => `${value > 0 ? "+" : "−"}${Math.abs(value)} ${STAT_NAMES[stat]}`).join(" · "));
|
||||
|
||||
// Effets chiffrés d'un pouvoir, avec les valeurs réglées dans l'administration (`values` : réglages `powers`), une ligne par effet.
|
||||
export function powerDetails(power, values) {
|
||||
// Effets chiffrés d'un pouvoir, une ligne par effet : les modèles cards.expeditions.powerDetails, remplis avec les valeurs réglées
|
||||
// dans l'administration (`values` : réglages `powers`).
|
||||
export function powerDetails(power, values, content) {
|
||||
if (!values) return [];
|
||||
const pct = (value) => `${value}\u00a0%`;
|
||||
return {
|
||||
longsight: [`Chance de carte : +${pct(values.longsightPackPct)}`, `Trajet : +${values.longsightExtraHours} h`],
|
||||
rations: [`Trajet : −${pct(values.rationsTimePct)}`, `Butin : −${pct(values.rationsLootPct)}`],
|
||||
treasureMap: ["Objet rare en plus : fragment, burin ou plan", `Score : −${pct(values.treasureMapScorePct)}`],
|
||||
talisman: ["Palier : toujours Réussite (butin ×1)", "Ni Retour difficile, ni Triomphe"],
|
||||
madCompass: [`Butin : +${pct(values.madCompassLootPct)}`, `Exigences réelles : ${pct(values.madCompassMinPct)} à ${pct(values.madCompassMaxPct)}`, "Révélées au retour"],
|
||||
starNet: [`Carte des Carnets en plus : ${pct(values.starNetCardPct)}`, `Fortune de l’équipe : −${values.starNetFortune}`],
|
||||
stormLantern: [`Malus d’un danger subi : −${pct(values.stormLanternDangerPct)}`, `Trajet : +${values.stormLanternExtraHours} h`],
|
||||
fogBell: [`Score en groupe : +${pct(values.fogBellSynergyPct)}`, `Butin seul : −${pct(values.fogBellSoloLootPct)}`]
|
||||
}[power] || [];
|
||||
return (content.powerDetails?.[power] || []).map((line) => fillTemplate(line, values));
|
||||
}
|
||||
|
||||
export const formatEclats = (value) => Number(value).toLocaleString("fr-FR", { maximumFractionDigits: 1 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue