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:
parent
6b7605d04e
commit
e0ffccd1c8
22 changed files with 373 additions and 10 deletions
|
|
@ -1,11 +1,12 @@
|
|||
// Rôle : présente les Expéditions, quête de la Guilde : expéditions du joueur (retour, butin) et préparation d'une expédition solo.
|
||||
import { useEffect, useState } from "react";
|
||||
import { claimExpedition, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, startExpedition } from "./cardsApi.js";
|
||||
import { claimExpedition, convertStardust, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, startExpedition } from "./cardsApi.js";
|
||||
import { fillTemplate, formatCountdown } from "./dailyShare.js";
|
||||
import { ExpeditionGroupCard } from "./ExpeditionGroupCard.jsx";
|
||||
import { ExpeditionPlanner } from "./ExpeditionPlanner.jsx";
|
||||
import { ExpeditionReport } from "./ExpeditionReport.jsx";
|
||||
import { formatEclats } from "./expeditionFormat.js";
|
||||
import { formatStardust } from "./stardustFormat.js";
|
||||
|
||||
const COUNTDOWN_TICK_MS = 30_000;
|
||||
|
||||
|
|
@ -19,6 +20,22 @@ const expeditionCall = (call) => async () => {
|
|||
}
|
||||
};
|
||||
|
||||
// Pont des Veilleurs : de la poussière vers les Éclats, au taux réglé ; la conversion inverse n'existe pas.
|
||||
function BridgeForm({ rate, stardust, busy, content, onConvert }) {
|
||||
const [amount, setAmount] = useState("1");
|
||||
const eclats = /^\d+$/.test(amount) ? Number(amount) : 0;
|
||||
const cost = eclats * rate;
|
||||
return <form className="nds-panel nebula-expedition-bridge" aria-labelledby="nebula-expedition-bridge-title" onSubmit={async (event) => { event.preventDefault(); if (await onConvert(eclats)) setAmount("1"); }}>
|
||||
<h3 id="nebula-expedition-bridge-title">{content.bridgeTitle}</h3>
|
||||
<p className="nebula-form-help">{fillTemplate(content.bridgeHelp, { rate })}</p>
|
||||
<div className="nebula-expedition-bridge-row">
|
||||
<label><span>{content.bridgeLabel}</span><input className="nds-input" type="number" inputMode="numeric" min="1" max="10000" step="1" value={amount} disabled={busy} onChange={(event) => setAmount(event.target.value)} /></label>
|
||||
<span className="nebula-form-help">{fillTemplate(content.bridgeCost, { cost: formatStardust(cost) })}</span>
|
||||
<button className="nds-button" data-size="sm" data-variant="secondary" type="submit" disabled={busy || eclats < 1 || cost > stardust}>{content.bridgeAction}</button>
|
||||
</div>
|
||||
</form>;
|
||||
}
|
||||
|
||||
export function ExpeditionsPanel({ catalog, state, runMutation, busy, content }) {
|
||||
const [view, setView] = useState(null);
|
||||
const [loadError, setLoadError] = useState("");
|
||||
|
|
@ -59,6 +76,11 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
|
|||
const claim = async (id) => handle(await runMutation(expeditionCall(() => claimExpedition(id))), content.claimed);
|
||||
const join = async (id, choice) => handle(await runMutation(expeditionCall(() => joinExpedition(id, choice))), content.joined);
|
||||
const leave = async (id) => handle(await runMutation(expeditionCall(() => leaveExpedition(id))), content.left);
|
||||
const convert = async (eclats) => {
|
||||
const result = await runMutation(() => convertStardust(eclats));
|
||||
if (result) setNotice({ variant: "success", text: fillTemplate(content.bridged, { eclats: formatEclats(eclats) }) });
|
||||
return Boolean(result);
|
||||
};
|
||||
const depart = async (id) => handle(await runMutation(expeditionCall(() => departExpedition(id))), content.departed);
|
||||
|
||||
const expired = view.enabled && now >= view.nextDayAt;
|
||||
|
|
@ -75,6 +97,7 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
|
|||
</div>
|
||||
</div>
|
||||
<p className="nebula-form-help">{content.eclatsHelp}</p>
|
||||
<BridgeForm rate={view.progression.stardustPerEclat} stardust={state.wallet.stardust} busy={busy} content={content} onConvert={convert} />
|
||||
{notice && <p className="nds-inline-notice" data-variant={notice.variant} role="status">{notice.text}</p>}
|
||||
{expired && <div className="nds-inline-notice nebula-daily-expired" data-variant="warning" role="status"><span>{content.expired}</span><button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={reload}>{content.reload}</button></div>}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue