Make duplicates awaken cards at Power 70, 85 and 100
Opening packs stays useful once a collection is complete: the level that reaches an awakening tier can no longer be bought with Éclats, a duplicate or field experience. The card awakens without Éclats, with one of its own duplicates (a mythic also takes its legendary version) or with duplicates of its collection and rarity: 6 rares, 2 epics or 1 legendary, numbers that follow the 24/8/3 drop rates so a tier costs about the same packs at every rarity. Tiers and counts are admin settings, and the balance guide records the simulations and the options set aside. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c7f951920e
commit
0ecb2cdbc5
12 changed files with 285 additions and 25 deletions
|
|
@ -2,10 +2,11 @@
|
|||
// Expéditions, deux onglets. « La carte » (par défaut depuis la collection) : son lore, ses informations (exemplaires, collection,
|
||||
// finitions) et les actions (favori, recyclage d'un doublon, don, échange). « Amélioration » (par défaut depuis les Expéditions,
|
||||
// `initialTab`) : un récapitulatif (Puissance, niveau et expérience, les quatre stats et celles que donnerait la répartition en
|
||||
// cours de choix), l'amélioration et la répartition des statistiques. L'équipement se règle depuis les Expéditions.
|
||||
// cours de choix), l'amélioration (ou l'Éveil devant un palier) et la répartition des statistiques. L'équipement se règle depuis les Expéditions.
|
||||
// `focus` (« plan ») ouvre « Amélioration » et fait défiler la fiche jusqu'à cette section, depuis un objet du Sac.
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Modal } from "../../components/Modal.jsx";
|
||||
import { ConfirmModal } from "../../components/ToolboxModals.jsx";
|
||||
import { Tabs } from "../../components/Tabs.jsx";
|
||||
import { recycleDuplicates, setFavorite, upgradeCard } from "./cardsApi.js";
|
||||
import { CardPlan } from "./CardPlan.jsx";
|
||||
|
|
@ -30,7 +31,7 @@ function CardSummary({ progress, preview, content }) {
|
|||
<div className="nebula-card-summary-power"><span>{content.power}</span><strong>{progress.power}</strong></div>
|
||||
<div className="nebula-card-summary-level">
|
||||
<span>{content.level} <strong>{progress.level}</strong> / {progress.maxLevel}</span>
|
||||
{atCap ? <small>{content.atCap}</small> : <>
|
||||
{atCap ? <small>{content.atCap}</small> : progress.awakening ? <small>{fillTemplate(content.awakeningWait, { power: progress.awakening.power })}</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>
|
||||
</>}
|
||||
|
|
@ -49,17 +50,52 @@ function CardSummary({ progress, preview, content }) {
|
|||
</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, content }) {
|
||||
// Éveil d'une carte arrêtée devant un palier : un doublon d'elle-même (pour une mythique, sa version légendaire), ou des doublons de
|
||||
// sa collection et de sa rareté, montrés avant d'être consommés. L'Éveil ne coûte pas d'Éclats.
|
||||
function CardAwakening({ catalog, progress, busy, runMutation, content }) {
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
const { awakening } = progress;
|
||||
const editionOf = (id) => catalog.editions.find((edition) => edition.id === id);
|
||||
const cardName = (id) => catalog.cards.find((card) => card.id === editionOf(id)?.cardId)?.name ?? id;
|
||||
const own = editionOf(progress.editionId);
|
||||
const rarityLabel = (id) => catalog.rarities.find((item) => item.id === id)?.label ?? id;
|
||||
const accepted = own?.rarity === "mythic" ? `${rarityLabel("legendary")} ou ${rarityLabel("mythic")}` : rarityLabel(own?.rarity);
|
||||
const collectionName = catalog.collections.find((item) => item.id === catalog.cards.find((card) => card.id === own?.cardId)?.collectionId)?.name ?? "";
|
||||
const exactIsOther = awakening.exact && awakening.exact !== progress.editionId;
|
||||
const plural = awakening.needed > 1 ? "s" : "";
|
||||
const used = awakening.picks.map((item) => `${cardName(item.editionId)}${item.count > 1 ? ` ×${item.count}` : ""}`).join(", ");
|
||||
return <section className="nebula-card-upgrade nebula-card-awakening" aria-labelledby="nebula-card-awakening-title">
|
||||
<h3 id="nebula-card-awakening-title">{fillTemplate(content.awakeningTitle, { power: awakening.power })}</h3>
|
||||
<p className="nebula-form-help">{content.awakeningText}</p>
|
||||
<div className="nds-toolbar">
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !awakening.exact} onClick={() => runMutation(() => upgradeCard(progress.editionId, "duplicate"))}>{exactIsOther ? content.awakenLegendary : content.awakenExact}</button>
|
||||
<button className="nds-button" data-variant="secondary" type="button" disabled={busy || !awakening.picks.length} onClick={() => setConfirming(true)}>{fillTemplate(content.awakenPool, { count: awakening.needed, s: plural, rarity: accepted })}</button>
|
||||
</div>
|
||||
<p className="nebula-form-help">{fillTemplate(content.awakenPoolCount, { available: Math.min(awakening.available, awakening.needed), count: awakening.needed, s: plural, rarity: accepted, collection: collectionName })}</p>
|
||||
{confirming && <ConfirmModal
|
||||
title={content.awakenConfirmTitle}
|
||||
message={fillTemplate(content.awakenConfirmText, { cards: used })}
|
||||
confirmLabel={content.awakenConfirm}
|
||||
onClose={(confirmed) => { setConfirming(false); if (confirmed) void runMutation(() => upgradeCard(progress.editionId, "awaken")); }}
|
||||
/>}
|
||||
</section>;
|
||||
}
|
||||
|
||||
// Amélioration d'une carte rare ou mieux : Éclats, ou doublon de la même édition (l'Éveil devant un palier) ; puis la répartition
|
||||
// de ses statistiques.
|
||||
function CardProgress({ catalog, state, progress, eclats, locked, busy, runMutation, onPreview, content }) {
|
||||
const atCap = progress.nextCost == null;
|
||||
const nextAwakening = progress.awakeningsAhead?.[0];
|
||||
return <>
|
||||
{!atCap && <section className="nebula-card-upgrade" aria-labelledby="nebula-card-upgrade-title">
|
||||
{!atCap && progress.awakening && <CardAwakening catalog={catalog} progress={progress} busy={busy} runMutation={runMutation} content={content} />}
|
||||
{!atCap && !progress.awakening && <section className="nebula-card-upgrade" aria-labelledby="nebula-card-upgrade-title">
|
||||
<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"))}>{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">{fillTemplate(content.upgradeHelp, { eclats: formatEclats(eclats) })}</p>
|
||||
{nextAwakening && <p className="nebula-form-help">{fillTemplate(content.nextAwakening, { power: nextAwakening })}</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} content={content.plan} statNames={content.stats} />
|
||||
</>;
|
||||
|
|
@ -104,7 +140,7 @@ export function CardDetailModal({ catalog, state, entry, content, runMutation, b
|
|||
</>;
|
||||
const improve = progress && <>
|
||||
<CardSummary progress={progress} preview={previewStats} content={content} />
|
||||
<CardProgress state={state} progress={progress} eclats={state.wallet.eclats ?? 0} locked={Boolean(expedition)} busy={busy} runMutation={runMutation}
|
||||
<CardProgress catalog={catalog} state={state} progress={progress} eclats={state.wallet.eclats ?? 0} locked={Boolean(expedition)} busy={busy} runMutation={runMutation}
|
||||
onPreview={(stats) => setPreview({ key: planKey, stats })} content={content} />
|
||||
</>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue