Offer the destination items under Sokko TCG's destinations of the day
- Each owned item that would add a destination today (guide star, sky chart, or enough treasure map fragments) gets a dashed frame under the destinations: what it does, the difficulty and the loot bonus of the added destination. A click uses the item, as in the bag. - Frames appear only while the item is owned in sufficient number and its slot is still free, and share the destinations' grid. - "1 destinations débloquées" becomes singular. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bffbe36cbe
commit
9d2c561fc6
10 changed files with 94 additions and 6 deletions
|
|
@ -158,6 +158,29 @@ function DestinationRequirements({ requirements, card, content }) {
|
|||
|
||||
// Une destination du jour, en deux rangées alignées avec celles de la carte voisine : en-tête (paysage réduit à gauche ; nom, étoiles,
|
||||
// description et butin à droite), puis ses exigences (stats, condition et dangers).
|
||||
// Objets du Sac qui ajouteraient une destination aujourd'hui : un cadre pointillé par objet possédé en nombre suffisant et dont la
|
||||
// place est libre, avec ce que vaudrait la destination ajoutée (étoiles, butin). Un clic utilise l'objet.
|
||||
function BonusOffers({ view, content, busy, onBonus }) {
|
||||
const offers = (view.bonusOffers || []).filter((offer) => view.enabled && !offer.used && (view.items?.[offer.item] ?? 0) >= offer.required);
|
||||
if (!offers.length) return null;
|
||||
return <ul className="nebula-bonus-offers" aria-label={content.bonusOffersTitle}>{offers.map((offer) => {
|
||||
const title = fillTemplate(content.bonusOffer[offer.item].title, { count: offer.required });
|
||||
return <li key={offer.item}>
|
||||
<button className="nebula-bonus-offer" type="button" disabled={busy} onClick={() => onBonus(offer.item)}>
|
||||
<img src={ITEM_ART[offer.item]} alt="" />
|
||||
<span className="nebula-bonus-offer-copy">
|
||||
<strong>{title}</strong>
|
||||
<span className="nebula-form-help">{content.bonusOffer[offer.item].effect}</span>
|
||||
<span className="nebula-bonus-offer-badges">
|
||||
<span className="nds-badge" data-variant="gold">{fillTemplate(content.bonusOfferStars, { stars: "★".repeat(offer.stars) })}</span>
|
||||
{offer.lootPct !== 100 && <span className="nds-badge" data-variant="success">{fillTemplate(content.bonusOfferLoot, { value: formatEclats(offer.lootPct / 100) })}</span>}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</li>;
|
||||
})}</ul>;
|
||||
}
|
||||
|
||||
function DestinationOption({ catalog, item, selected, card, view, content, onSelect }) {
|
||||
const collection = item.rewardCollectionId && (catalog.collections.find((entry) => entry.id === item.rewardCollectionId)?.name || item.rewardCollectionId);
|
||||
return <button type="button" className="nebula-expedition-destination" aria-pressed={selected} onClick={onSelect}>
|
||||
|
|
@ -184,7 +207,7 @@ function DestinationOption({ catalog, item, selected, card, view, content, onSel
|
|||
</button>;
|
||||
}
|
||||
|
||||
export function ExpeditionPlanner({ catalog, state, view, content, busy, onStart, onReroll, runMutation }) {
|
||||
export function ExpeditionPlanner({ catalog, state, view, content, busy, onStart, onReroll, onBonus, runMutation }) {
|
||||
// Destinations de la plus facile à la plus difficile.
|
||||
const destinations = useMemo(() => [...view.destinations].sort((a, b) => (a.level ?? 0) - (b.level ?? 0)), [view.destinations]);
|
||||
const [destinationId, setDestinationId] = useState(destinations[0]?.id || "");
|
||||
|
|
@ -227,11 +250,12 @@ export function ExpeditionPlanner({ catalog, state, view, content, busy, onStart
|
|||
<img src={ITEM_ART.windRose} alt="" />{fillTemplate(content.useWindRose, { count: view.items.windRose })}
|
||||
</button>}
|
||||
</div>
|
||||
{view.unlocked && view.unlocked.count < view.unlocked.total && <p className="nebula-form-help">{fillTemplate(content.unlockedDestinations, view.unlocked)}</p>}
|
||||
{view.unlocked && view.unlocked.count < view.unlocked.total && <p className="nebula-form-help">{fillTemplate(content.unlockedDestinations, { ...view.unlocked, s: view.unlocked.count > 1 ? "s" : "" })}</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>
|
||||
<BonusOffers view={view} content={content} busy={busy} onBonus={onBonus} />
|
||||
</section>
|
||||
|
||||
<section className="nds-panel nebula-expedition-step" aria-labelledby="nebula-expedition-team-title">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue