Rebuild the Expeditions page around one guided journey: one card, no roles, leave alone or open to a group, follow the trip, keep a Journal
An expedition now opens with a single card. Its creator leaves alone right away, or opens it to the Guild board with an invite link and launches it whenever they want; at the end of recruitment it leaves by itself, alone or as a group, and is never dissolved for lack of players. Stars no longer depend on the number of players, a player has one expedition at a time, and roles are gone: each card brings its stats and a team adds them up, so every requirement is its per-slot share times the number of slots. The page follows the player's path: the offered destination card is revealed once in a modal, then Préparer shows the destinations (stat requirements, condition and dangers coloured for the chosen card, loot effects), a frame with the sent card in large size, its equipment slots and stats, and the duration and departure. Cards and commons are chosen in modals with sorts and highlighted current picks; tags get matching colours on the card and on equipment synergies. Once gone, the trip is shown with a progress bar and moving cards, the loot opens in a modal, and finished expeditions move to a Journal tab with the Grimoire. Power commons get short power names of their own and show their exact effects on hover, a card holds one power at a time, and Coup de folie now draws the real requirements between 80 % and 130 % of the shown ones, revealed on return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d70ae51265
commit
3720fd01f7
41 changed files with 1807 additions and 894 deletions
107
website/src/features/cards/ExpeditionLoadout.jsx
Normal file
107
website/src/features/cards/ExpeditionLoadout.jsx
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
// Rôle : étape « Votre carte » de la préparation d'une expédition. Un cadre réunit l'emplacement de la carte envoyée (en `lg`, un
|
||||
// « + » tant qu'aucune n'est choisie), ses stats pour l'expédition et ses trois emplacements d'équipement (en `md`). Un clic sur
|
||||
// l'emplacement de la carte ouvre la liste des cartes jouables (tris, étiquettes utiles à la destination) ; un clic sur un
|
||||
// emplacement d'équipement ouvre le choix des communes.
|
||||
import { useMemo, useState } from "react";
|
||||
import { Modal } from "../../components/Modal.jsx";
|
||||
import { Tooltip } from "../../components/Tooltip.jsx";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { ExpeditionCardTile } from "./ExpeditionCardTile.jsx";
|
||||
import { EquipmentPicker, EquipmentSlots, PowerTooltipContent } from "./ExpeditionEquipmentSlots.jsx";
|
||||
import { editionEntry, formatDecimal, helpScore, POWER_TEXT, powerDetails, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
import { NebulaCard } from "./NebulaCard.jsx";
|
||||
|
||||
// Tris des cartes jouables : utiles à la destination (condition, dangers, Affinité), Puissance ou une stat.
|
||||
const SORTS = ["useful", "power", ...STAT_IDS];
|
||||
|
||||
// Total d'une stat de la carte pour l'expédition, et au survol son détail : la valeur de la carte et l'apport de chaque commune
|
||||
// (synergie comprise).
|
||||
function StatTotal({ card, stat, content }) {
|
||||
const sign = (value) => `${value > 0 ? "+" : "−"}${formatDecimal(Math.abs(value))}`;
|
||||
const base = card.baseStats?.[stat] ?? card.stats[stat];
|
||||
const lines = [
|
||||
fillTemplate(content.statBase, { value: formatDecimal(base) }),
|
||||
...(card.equipment || []).map((item) => {
|
||||
const value = (item.stats?.[stat] || 0) + (item.synergyStat === stat ? item.synergyBonus || 0 : 0);
|
||||
return value ? fillTemplate(content.bonusFrom, { card: item.name, value: sign(value) }) : null;
|
||||
}).filter(Boolean)
|
||||
];
|
||||
return <Tooltip className="nebula-loadout-stat-total" content={<span className="nebula-tooltip-lines">{lines.map((line) => <span key={line}>{line}</span>)}</span>}
|
||||
aria-label={`${content.stats[stat]} : ${formatDecimal(card.stats[stat])}. ${lines.join(" ; ")}`} tabIndex={0}>
|
||||
<strong aria-hidden="true">{formatDecimal(card.stats[stat])}</strong>
|
||||
</Tooltip>;
|
||||
}
|
||||
|
||||
// Liste des cartes jouables, dans une fenêtre : un clic choisit la carte et la ferme.
|
||||
function CardPicker({ catalog, view, destination, selectedId, content, onChoose, onClose }) {
|
||||
const mainStat = destination?.stats[0];
|
||||
// Tri par défaut : la stat principale de la destination.
|
||||
const [sort, setSort] = useState(null);
|
||||
const sortKey = sort || mainStat;
|
||||
// La carte déjà choisie en tête, puis les cartes libres avant celles en expédition, dans l'ordre du tri.
|
||||
const cards = useMemo(() => [...view.cards].sort((a, b) => Number(b.editionId === selectedId) - Number(a.editionId === selectedId) || Number(a.busy) - Number(b.busy)
|
||||
|| (sortKey === "useful" ? helpScore(b, destination) - helpScore(a, destination) || (b.stats[mainStat] ?? 0) - (a.stats[mainStat] ?? 0)
|
||||
: sortKey === "power" ? b.power - a.power : (b.stats[sortKey] ?? 0) - (a.stats[sortKey] ?? 0) || b.power - a.power)), [view.cards, sortKey, destination, mainStat, selectedId]);
|
||||
return <Modal dialogClassName="confirm-modal nds-modal nebula-expedition-picker" labelledBy="nebula-card-picker-title" onRequestClose={onClose}>
|
||||
<h2 id="nebula-card-picker-title">{content.cardPickerTitle}</h2>
|
||||
<p className="nebula-form-help">{fillTemplate(content.cardPickerHelp, { destination: destination?.name || "" })}</p>
|
||||
<div className="nebula-expedition-sort" role="group" aria-label={content.sortLabel}>
|
||||
<span className="nebula-form-help">{content.sortLabel}</span>
|
||||
{SORTS.map((id) => <button key={id} type="button" className="nds-button" data-size="sm" data-variant={id === sortKey ? "primary" : "secondary"} aria-pressed={id === sortKey} onClick={() => setSort(id)}>
|
||||
{id === "useful" ? content.sortUseful : id === "power" ? content.sortPower : <><MaskIcon name={id} />{content.stats[id]}</>}
|
||||
</button>)}
|
||||
</div>
|
||||
{cards.length ? <ul className="nebula-expedition-cards" aria-label={content.cardsLabel}>{cards.map((item) => <ExpeditionCardTile key={item.editionId} catalog={catalog} card={item}
|
||||
destination={destination} content={content} selected={item.editionId === selectedId} sortKey={sortKey} onSelect={() => { onChoose(item.editionId); onClose(); }} />)}</ul>
|
||||
: <p className="nds-inline-notice" data-variant="info">{content.noCards}</p>}
|
||||
<div className="nds-toolbar nebula-expedition-picker-actions">
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={onClose}>{content.cancel}</button>
|
||||
</div>
|
||||
</Modal>;
|
||||
}
|
||||
|
||||
export function ExpeditionLoadout({ catalog, state, view, destination, card, onChooseCard, content, busy, runMutation }) {
|
||||
// Fenêtre ouverte : « card » (choix de la carte) ou le numéro de l'emplacement d'équipement.
|
||||
const [picker, setPicker] = useState(null);
|
||||
// Exigences de la destination choisie pour une carte seule : elles ne donnent que la couleur des totaux.
|
||||
const requirements = destination?.requirements || [];
|
||||
const entry = card && editionEntry(catalog, card.editionId);
|
||||
const progress = card && state.cardProgress?.find((item) => item.editionId === card.editionId);
|
||||
return <div className="nebula-expedition-loadout">
|
||||
<div className="nebula-loadout-card">
|
||||
{entry ? <NebulaCard catalog={catalog} entry={entry} size="lg" onSelect={() => setPicker("card")} selectLabel={fillTemplate(content.changeCard, { card: entry.card.name })} />
|
||||
: <button className="nebula-loadout-empty" type="button" onClick={() => setPicker("card")}><span aria-hidden="true">+</span><strong>{content.chooseCardSlot}</strong></button>}
|
||||
{card?.tags?.length > 0 && <ul className="nebula-loadout-tags" aria-label={content.tagsTitle}>{card.tags.map((tag) => <li key={tag} className="nebula-tag-chip" data-tag-color={tagColor(card.tags, tag)}>{tagLabel(catalog, tag)}</li>)}</ul>}
|
||||
</div>
|
||||
<div className="nebula-loadout-body">
|
||||
{card ? <h4>{entry?.card.name}</h4> : <p className="nebula-form-help">{content.loadoutEmpty}</p>}
|
||||
<div className="nebula-loadout-columns">
|
||||
<section className="nebula-loadout-equipment" aria-label={content.equipmentTitle}>
|
||||
<h5>{content.equipmentTitle}</h5>
|
||||
<EquipmentSlots catalog={catalog} progress={progress} content={content} busy={busy} runMutation={runMutation} onOpen={setPicker} powerValues={view.powers} />
|
||||
</section>
|
||||
{card && <section className="nebula-loadout-stats" aria-label={content.chosenStats}>
|
||||
<h5>{content.chosenStatsTitle}</h5>
|
||||
<ul className="nebula-expedition-chosen-stats">{STAT_IDS.map((stat) => {
|
||||
const requirement = requirements.find((item) => item.stat === stat);
|
||||
const met = requirement ? card.stats[stat] >= requirement.value : null;
|
||||
return <li key={stat} data-met={met == null ? undefined : String(met)}>
|
||||
<span className="nebula-loadout-stat-name"><MaskIcon name={stat} />{content.stats[stat]}</span>
|
||||
<StatTotal card={card} stat={stat} content={content} />
|
||||
</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}>
|
||||
<MaskIcon name="power" /><span aria-hidden="true">{content.powers[power]}</span>
|
||||
</Tooltip> {POWER_TEXT[power]}
|
||||
</li>)}</ul>}
|
||||
</section>}
|
||||
</div>
|
||||
</div>
|
||||
{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} />}
|
||||
</div>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue