Let players choose how their cards spend level points with vocations or free points, and sell the Parchemin d'oubli

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-16 23:00:40 +01:00
parent 18bcf435b5
commit 7d331d1a3f
24 changed files with 473 additions and 60 deletions

View file

@ -201,6 +201,21 @@ Expéditions (migration 8, règles pures dans `services/cards/expedition-rules.j
expérience de terrain (0 à 99 % du niveau suivant) d'une édition possédée. Puissance = base de la
rareté + niveau × gain, plafonnée ; une ligne absente vaut le niveau 0. La progression suit
l'exemplaire gardé ; le compte supprimé perd ses lignes.
- Plans de progression (migration 15) : `card_progress.plan` (`leader`, `guardian`, `seeker`, `navigator`,
`free`, ou NULL pour « selon sa collection ») et `card_progress.allocation_json` (points placés en libre).
La base de la rareté suit toujours le profil de la collection ; les points de niveau (Puissance au-delà de
la base) suivent le plan : le profil de la collection, une vocation (la stat de son rôle à
`plans.maxStatPct` %, le reste partagé entre deux stats secondaires) ou les points placés, jamais plus de
`plans.maxStatPct` % dans une stat. Sans plan, les stats sont celles d'avant les plans. Une répartition
libre qui ne respecte plus un réglage abaissé est ramenée dedans à la lecture. `PUT
/api/cards/progress/plan` (`{ editionId, plan, allocation }`) : gratuit tant que la carte suit sa
collection et pour ajouter des points en libre ; sinon un Parchemin d'oubli (`oblivion`) est consommé.
`PLAN_INVALID`, `ALLOCATION_INVALID`, `NOT_ENOUGH_ITEMS`, `EXPEDITION_CARD_BUSY`, `CARD_NOT_OWNED`,
`EXPEDITION_CARD_INVALID` ; `card_plan_changed` dans l'historique (`{ plan, allocation?, oblivion }`).
`POST /api/cards/shop/oblivion` (`{ count }`, 1 à 100) achète des Parchemins à `progression.oblivionPrice`
poussières (`NOT_ENOUGH_STARDUST`, `PURCHASE_INVALID`) ; `oblivion_bought` dans l'historique. Prix réglé
dans Administration › Boutique, donné par `getState().shop.oblivionPrice`. `cardProgress[].plan` donne le
plan, les points, le plafond par stat, les points placés, la base et l'aperçu des stats de chaque vocation.
- `POST /api/cards/progress/upgrade` (`{ editionId, method: "eclats" | "duplicate" }`) : un niveau
contre `costFactor × (Puissance − costOffset)` Éclats, ou `duplicateLevels` niveaux contre un
doublon libre de la même édition. `CARD_NOT_OWNED`, `EXPEDITION_CARD_INVALID`, `CARD_MAX_LEVEL`,
@ -239,7 +254,8 @@ Expéditions (migration 8, règles pures dans `services/cards/expedition-rules.j
ou abandonnées sont purgées après 30 jours ; un compte supprimé perd ses choix et sa file.
`getState().alerts` vaut `{ available, groupOpened, expeditionReturned }`.
- Objets (migration 12, `services/cards/expedition-items.js`) : `player_items(player_id, item_id, quantity)`
pour `fragment`, `engraving`, `plan`, `anchor`, `guideStar` et `skyChart`. Une expédition en rapporte
pour `fragment`, `engraving`, `plan`, `anchor`, `guideStar`, `skyChart` et `oblivion` (Parchemin d'oubli,
vendu en boutique, sans poids de tirage : jamais dans le butin). Une expédition en rapporte
au départ (`reward_json.items`, crédités au retour) : chance `items.chancePerHourPermille` par heure,
multipliée comme le butin, au plus `items.maxPerExpedition` ; fragments, burins et plans demandent
une Orientation moyenne par place d'au moins `items.orientationPerSlot`, et le plan attend l'atelier.

View file

@ -365,6 +365,15 @@ export function createCardsApiHandler({
json(res, 200, service.expeditions.equip(session.player.id, { editionId: body.editionId, slot: body.slot, equipmentEditionId: body.equipmentEditionId ?? null }));
return true;
}
if (req.method === "PUT" && url.pathname === "/api/cards/progress/plan") {
const body = await readBody(req);
json(res, 200, service.expeditions.setCardPlan(session.player.id, { editionId: body.editionId, plan: body.plan, allocation: body.allocation ?? null }));
return true;
}
if (req.method === "POST" && url.pathname === "/api/cards/shop/oblivion") {
json(res, 200, service.expeditions.buyOblivion(session.player.id, { count: (await readBody(req)).count }));
return true;
}
if (req.method === "POST" && url.pathname === "/api/cards/eclats/convert") {
json(res, 200, service.expeditions.convertStardust(session.player.id, { eclats: (await readBody(req)).eclats }));
return true;

View file

@ -392,6 +392,12 @@ const MIGRATIONS = [
created_at INTEGER NOT NULL,
PRIMARY KEY (player_id, day)
) STRICT;
`,
// Plan de progression d'une carte : comment ses points de niveau se répartissent (collection, vocation ou libre) et,
// en libre, les points placés par le joueur. NULL : jamais choisi (le premier choix est gratuit).
`
ALTER TABLE card_progress ADD COLUMN plan TEXT CHECK (plan IS NULL OR plan IN ('collection', 'leader', 'guardian', 'seeker', 'navigator', 'free'));
ALTER TABLE card_progress ADD COLUMN allocation_json TEXT CHECK (allocation_json IS NULL OR json_valid(allocation_json));
`
];

View file

@ -27,8 +27,9 @@ export const equipmentMethods = {
},
// Une carte prête à partir : stats de sa Puissance, plus ses équipements (dans ses emplacements ouverts) et leurs synergies.
loadout(editionId, level, equipped, settings, engravings = null) {
const data = editionExpeditionData(this.cards.catalog, editionId, level, settings);
// `progress` : { level, plan, allocation } de la carte chez le joueur.
loadout(editionId, progress, equipped, settings, engravings = null) {
const data = editionExpeditionData(this.cards.catalog, editionId, progress?.level ?? 0, settings, progress);
if (!data) return null;
const slots = unlockedSlots(data.power, settings);
const items = (equipped || []).filter((item) => item.slot < slots).map((item) => ({ slot: item.slot, ...this.equipmentItem(item.equipmentEditionId, engravings) })).filter((item) => item.editionId);

View file

@ -1,6 +1,7 @@
// Rôle : améliorations des cartes Sokko TCG pour les Expéditions : niveaux par Éclats ou doublon, expérience de terrain, pont depuis la poussière.
// Rôle : améliorations des cartes Sokko TCG pour les Expéditions : niveaux par Éclats ou doublon, expérience de terrain, plans de progression
// (vocation ou points libres, changés avec un Parchemin d'oubli), pont depuis la poussière et achat de Parchemins.
// Ces méthodes s'ajoutent à ExpeditionService (Object.assign sur son prototype) et utilisent `this` comme lui.
import { editionExpeditionData, gainProgress, maxLevel, upgradeCost } from "./expedition-rules.js";
import { allocationError, cardExpeditionData, clampAllocation, editionExpeditionData, gainProgress, levelPoints, maxLevel, maxStatPoints, PLAN_IDS, planStats, splitPower, STAT_IDS, upgradeCost, VOCATION_IDS } from "./expedition-rules.js";
function fail(status, code, message) {
throw Object.assign(new Error(message), { status, code });
@ -8,16 +9,20 @@ function fail(status, code, message) {
// Au plus ce nombre d'Éclats par conversion, pour qu'une faute de frappe ne vide pas un solde de poussière.
export const MAX_CONVERT_ECLATS = 10_000;
// Au plus ce nombre de Parchemins d'oubli par achat.
export const MAX_OBLIVION_PER_PURCHASE = 100;
const readAllocation = (json) => (json ? JSON.parse(json) : null);
export const progressMethods = {
levelsOf(playerId) {
return new Map(this.db.prepare("SELECT edition_id, level, field_xp FROM card_progress WHERE player_id = ?").all(playerId)
.map((row) => [row.edition_id, { level: row.level, fieldXp: row.field_xp }]));
return new Map(this.db.prepare("SELECT edition_id, level, field_xp, plan, allocation_json FROM card_progress WHERE player_id = ?").all(playerId)
.map((row) => [row.edition_id, { level: row.level, fieldXp: row.field_xp, plan: row.plan, allocation: readAllocation(row.allocation_json) }]));
},
progressOf(playerId, editionId) {
const row = this.db.prepare("SELECT level, field_xp FROM card_progress WHERE player_id = ? AND edition_id = ?").get(playerId, editionId);
return { level: row?.level ?? 0, fieldXp: row?.field_xp ?? 0 };
const row = this.db.prepare("SELECT level, field_xp, plan, allocation_json FROM card_progress WHERE player_id = ? AND edition_id = ?").get(playerId, editionId);
return { level: row?.level ?? 0, fieldXp: row?.field_xp ?? 0, plan: row?.plan ?? null, allocation: readAllocation(row?.allocation_json) };
},
writeProgress(playerId, editionId, { level, fieldXp }) {
@ -32,11 +37,12 @@ export const progressMethods = {
const equipment = this.equipmentOf(playerId);
const engravings = this.engravingsOf(playerId);
return this.cards.collectionOf(playerId).map((entry) => {
const progress = levels.get(entry.editionId) || { level: 0, fieldXp: 0 };
const data = this.loadout(entry.editionId, progress.level, equipment.get(entry.editionId), settings, engravings);
const progress = levels.get(entry.editionId) || { level: 0, fieldXp: 0, plan: null, allocation: null };
const data = this.loadout(entry.editionId, progress, equipment.get(entry.editionId), settings, engravings);
if (!data) return null;
return {
editionId: entry.editionId, level: progress.level, fieldXp: progress.fieldXp, power: data.power, baseStats: data.baseStats, stats: data.stats,
plan: this.planView(data, progress, settings),
maxLevel: maxLevel(data.rarity, settings), nextCost: upgradeCost(data.rarity, progress.level, settings), spare: entry.spare,
slots: data.slots, maxSlots: settings.equipment.maxPerCard, tags: data.tags, equipment: data.equipment,
slotPowers: [0, settings.equipment.secondSlotPower, settings.equipment.thirdSlotPower].slice(0, settings.equipment.maxPerCard)
@ -44,6 +50,68 @@ export const progressMethods = {
}).filter(Boolean);
},
// Plan de progression d'une carte : plan choisi, points de niveau (placés en libre), plafond par stat, et les stats que donnerait
// chaque vocation (sans équipement) pour l'aperçu. `paid` : changer de plan coûterait un Parchemin d'oubli.
planView(data, progress, settings) {
const profile = cardExpeditionData(this.cards.catalog, data.cardId).profile;
const points = levelPoints(data.rarity, data.level, settings);
const plan = progress.plan ?? "collection";
const preview = (id) => planStats(data.rarity, data.level, profile, { plan: id }, settings);
return {
id: plan, points, maxStatPoints: maxStatPoints(points, settings), paid: plan !== "collection",
allocation: plan === "free" ? clampAllocation(progress.allocation, points, settings) : null,
levelBase: splitPower(data.power - points, profile),
previews: Object.fromEntries(["collection", ...VOCATION_IDS].map((id) => [id, preview(id)]))
};
},
// Change le plan de progression d'une carte. Tant qu'elle suit sa collection, choisir est gratuit ; ensuite, changer de plan
// ou retirer des points placés en libre consomme un Parchemin d'oubli (ajouter des points en libre reste gratuit).
setCardPlan(playerId, { editionId, plan, allocation = null } = {}) {
const settings = this.settings;
if (!PLAN_IDS.includes(plan)) fail(400, "PLAN_INVALID", "Plan de progression inconnu.");
this.cards.database.transaction(() => {
if (!this.cards.collectionOf(playerId).some((entry) => entry.editionId === editionId)) fail(404, "CARD_NOT_OWNED", "Vous ne possédez pas cette carte.");
const data = editionExpeditionData(this.cards.catalog, editionId, 0, settings);
if (!data) fail(400, "EXPEDITION_CARD_INVALID", "Seules les cartes rares, épiques, légendaires et mythiques ont un plan de progression.");
if (this.busyEditions(playerId).has(editionId)) fail(409, "EXPEDITION_CARD_BUSY", "Cette carte est en expédition : son plan ne change pas avant son retour.");
const progress = this.progressOf(playerId, editionId);
const points = levelPoints(data.rarity, progress.level, settings);
const current = progress.plan ?? "collection";
let next = null;
if (plan === "free") {
const error = allocationError(allocation, points, settings);
if (error) fail(400, "ALLOCATION_INVALID", error);
next = Object.fromEntries(STAT_IDS.map((stat) => [stat, allocation[stat] ?? 0]));
}
const placed = current === "free" ? clampAllocation(progress.allocation, points, settings) : null;
if (plan === current && (plan !== "free" || STAT_IDS.every((stat) => next[stat] === placed[stat]))) return;
const onlyAdds = plan === "free" && current === "free" && STAT_IDS.every((stat) => next[stat] >= placed[stat]);
const paid = current !== "collection" && !onlyAdds;
if (paid) this.consumeItemInTx(playerId, "oblivion");
this.db.prepare(`INSERT INTO card_progress(player_id, edition_id, level, field_xp, plan, allocation_json, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(player_id, edition_id) DO UPDATE SET plan = excluded.plan, allocation_json = excluded.allocation_json, updated_at = excluded.updated_at`)
.run(playerId, editionId, progress.level, progress.fieldXp, plan === "collection" ? null : plan, next ? JSON.stringify(next) : null, this.now());
this.cards.audit(playerId, "card_plan_changed", editionId, { plan, ...(next ? { allocation: next } : {}), oblivion: paid });
});
return { progress: this.cardProgressView(playerId, settings).find((item) => item.editionId === editionId), state: this.cards.getState(playerId) };
},
// Achète des Parchemins d'oubli avec de la poussière d'étoiles, au prix réglé dans la boutique.
buyOblivion(playerId, { count = 1 } = {}) {
const settings = this.settings;
if (!Number.isInteger(count) || count < 1 || count > MAX_OBLIVION_PER_PURCHASE) fail(400, "PURCHASE_INVALID", `Nombre de Parchemins invalide : un entier entre 1 et ${MAX_OBLIVION_PER_PURCHASE}.`);
const cost = count * settings.progression.oblivionPrice;
this.cards.database.transaction(() => {
this.cards.refreshRecharge(playerId);
const paid = this.db.prepare("UPDATE players SET stardust = stardust - ? WHERE id = ? AND stardust >= ?").run(cost, playerId, cost);
if (!paid.changes) fail(409, "NOT_ENOUGH_STARDUST", "Pas assez de poussière d’étoiles.");
this.addItemsInTx(playerId, Array.from({ length: count }, () => "oblivion"));
this.cards.audit(playerId, "oblivion_bought", "shop", { count, stardust: cost });
});
return this.cards.getState(playerId);
},
// Monte une carte d'un niveau avec des Éclats, ou de `duplicateLevels` niveaux en consommant un doublon de la même édition.
upgradeCard(playerId, { editionId, method } = {}) {
const settings = this.settings;

View file

@ -31,6 +31,67 @@ export function maxLevel(rarity, settings) {
return Math.ceil((settings.power.cap - base) / settings.power.perLevel);
}
// Plan de progression d'une carte : comment se répartissent ses points de niveau (la Puissance gagnée au-delà de celle de sa rareté).
// « collection » : comme sa base, selon le profil de la collection (le défaut) ; une vocation (leader, guardian, seeker, navigator) :
// la stat de son rôle au plafond, le reste partagé entre deux stats secondaires ; « free » : les points placés par le joueur.
export const PLAN_IDS = Object.freeze(["collection", "leader", "guardian", "seeker", "navigator", "free"]);
export const VOCATION_IDS = Object.freeze(["leader", "guardian", "seeker", "navigator"]);
const VOCATION_SECONDARY = Object.freeze({ leader: ["endurance", "orientation"], guardian: ["bravoure", "orientation"], seeker: ["endurance", "orientation"], navigator: ["fortune", "endurance"] });
// Points de niveau d'une carte : sa Puissance au-delà de celle de sa rareté (plafond compris).
export function levelPoints(rarity, level, settings) {
const base = settings.power[rarity];
if (!Number.isInteger(base)) return 0;
return cardPower(rarity, level, settings) - Math.min(settings.power.cap, base);
}
// Au plus ce nombre de points de niveau dans une même stat.
export const maxStatPoints = (points, settings) => Math.floor((points * settings.plans.maxStatPct) / 100);
// Répartition d'une vocation, en pourcentages : la stat de son rôle au plafond, le reste partagé entre ses deux stats secondaires.
export function vocationProfile(plan, settings) {
const max = settings.plans.maxStatPct;
const [first, second] = VOCATION_SECONDARY[plan];
return { ...Object.fromEntries(STAT_IDS.map((stat) => [stat, 0])), [STAT_BY_ROLE[plan]]: max, [first]: Math.ceil((100 - max) / 2), [second]: Math.floor((100 - max) / 2) };
}
// Points placés en libre, ramenés dans les règles du moment (un réglage abaissé ne casse pas une répartition) : chaque stat au plafond,
// puis le surplus retiré de la plus haute.
export function clampAllocation(allocation, points, settings) {
const cap = maxStatPoints(points, settings);
const result = Object.fromEntries(STAT_IDS.map((stat) => [stat, Math.max(0, Math.min(cap, Math.floor(Number(allocation?.[stat]) || 0)))]));
let excess = STAT_IDS.reduce((sum, stat) => sum + result[stat], 0) - points;
while (excess > 0) {
const top = STAT_IDS.reduce((best, stat) => (result[stat] > result[best] ? stat : best));
result[top] -= 1;
excess -= 1;
}
return result;
}
// Erreur d'une répartition libre envoyée par un joueur, ou null.
export function allocationError(allocation, points, settings) {
if (!allocation || typeof allocation !== "object") return "Répartition des points invalide.";
if (Object.keys(allocation).some((key) => !STAT_IDS.includes(key))) return "Répartition des points invalide.";
const values = STAT_IDS.map((stat) => allocation[stat] ?? 0);
if (values.some((value) => !Number.isInteger(value) || value < 0)) return "Chaque stat reçoit un nombre entier de points.";
if (values.reduce((sum, value) => sum + value, 0) > points) return `Cette carte n’a que ${points} points à placer.`;
const cap = maxStatPoints(points, settings);
if (values.some((value) => value > cap)) return `Une stat ne peut pas recevoir plus de ${cap} points.`;
return null;
}
// Stats d'une carte selon son plan : la base de sa rareté suit le profil de sa collection, ses points de niveau suivent son plan.
// Sans plan (ou « collection »), toute la Puissance suit le profil, comme avant les plans.
export function planStats(rarity, level, profile, progress, settings) {
const power = cardPower(rarity, level, settings);
const plan = progress?.plan;
if (!plan || plan === "collection" || !PLAN_IDS.includes(plan)) return splitPower(power, profile);
const points = levelPoints(rarity, level, settings);
const extra = plan === "free" ? clampAllocation(progress.allocation, points, settings) : splitPower(points, vocationProfile(plan, settings));
return addStats(splitPower(power - points, profile), extra);
}
// Répartit la Puissance selon le profil (pourcentages), au plus grand reste : la somme des stats vaut exactement la Puissance.
export function splitPower(power, profile) {
const raw = STAT_IDS.map((stat) => (power * profile[stat]) / 100);
@ -60,13 +121,14 @@ export function cardExpeditionData(catalog, cardId) {
}
// Ce qu'une édition apporte à une expédition : rareté de l'édition (une mythique garde la sienne), Puissance et stats.
export function editionExpeditionData(catalog, editionId, level, settings) {
// `progress` : { plan, allocation } de la carte chez le joueur (voir planStats), ou null.
export function editionExpeditionData(catalog, editionId, level, settings, progress = null) {
const edition = catalog.editions.find((item) => item.id === editionId);
if (!edition) return null;
const data = cardExpeditionData(catalog, edition.cardId);
if (!data?.profile || !EXPEDITION_RARITIES.includes(edition.rarity)) return null;
const power = cardPower(edition.rarity, level, settings);
return { ...data, editionId, rarity: edition.rarity, level, power, stats: splitPower(power, data.profile) };
return { ...data, editionId, rarity: edition.rarity, level, power, stats: planStats(edition.rarity, level, data.profile, progress, settings) };
}
export const isExpeditionCard = (catalog, cardId) => EXPEDITION_RARITIES.includes(cardRarity(catalog, cardId)) && Boolean(cardExpeditionData(catalog, cardId));
@ -422,7 +484,8 @@ export function teamSynergy({ destination, slots, cohesionPct: cohesion = 0, bel
return { affinity, resonances, cohesionPct: cohesion, bellPct, totalPct: Math.min(settings.score.synergyCapPct, totalPct) };
}
export const ITEM_IDS = Object.freeze(["fragment", "engraving", "plan", "anchor", "guideStar", "skyChart"]);
// Le Parchemin d'oubli (oblivion) s'achète en boutique : sans poids de tirage, il ne sort jamais du butin.
export const ITEM_IDS = Object.freeze(["fragment", "engraving", "plan", "anchor", "guideStar", "skyChart", "oblivion"]);
// Partie cachée du butin : elle ne s'ouvre qu'avec assez d'Orientation moyenne par place.
export const HIDDEN_ITEMS = Object.freeze(["fragment", "engraving", "plan"]);

View file

@ -144,10 +144,10 @@ export class ExpeditionService {
const equipment = this.equipmentOf(playerId);
const engravings = this.engravingsOf(playerId);
return this.cards.visibleCollection(playerId, pending?.id).map((entry) => {
const data = this.loadout(entry.editionId, levels.get(entry.editionId)?.level ?? 0, equipment.get(entry.editionId), settings, engravings);
const data = this.loadout(entry.editionId, levels.get(entry.editionId), equipment.get(entry.editionId), settings, engravings);
if (!data) return null;
const busyEntry = busy.get(entry.editionId);
return { ...data, busy: Boolean(busyEntry), busyUntil: busyEntry?.returnsAt ?? null };
return { ...data, plan: levels.get(entry.editionId)?.plan ?? null, busy: Boolean(busyEntry), busyUntil: busyEntry?.returnsAt ?? null };
}).filter(Boolean);
}

View file

@ -15,8 +15,11 @@ export const DEFAULT_EXPEDITION_SETTINGS = Object.freeze({
power: { rare: 40, epic: 55, legendary: 70, mythic: 85, perLevel: 5, cap: 100 },
roles: { multiplierPct: 200 },
// Améliorations : coût d'un niveau en Éclats = costFactor × (Puissance actuelle − costOffset), niveaux donnés par un doublon,
// expérience de terrain par retour d'expédition (% d'un niveau) et taux du pont depuis la poussière (poussières pour 1 Éclat).
progression: { costFactor: 2, costOffset: 35, duplicateLevels: 1, fieldXpPct: 10, stardustPerEclat: 3 },
// expérience de terrain par retour d'expédition (% d'un niveau), taux du pont depuis la poussière (poussières pour 1 Éclat)
// et prix en poussière d'un Parchemin d'oubli (changer le plan de progression d'une carte).
progression: { costFactor: 2, costOffset: 35, duplicateLevels: 1, fieldXpPct: 10, stardustPerEclat: 3, oblivionPrice: 150 },
// Plans de progression : part maximale des points de niveau d'une carte dans une même stat (atteinte par les vocations).
plans: { maxStatPct: 60 },
// Équipements : emplacements au plus, Puissance qui ouvre le 2e et le 3e, points ajoutés quand une commune partage une étiquette avec sa carte.
equipment: { maxPerCard: 3, secondSlotPower: 70, thirdSlotPower: 100, synergyBonus: 2 },
// Synergies de score : Affinité avec la destination, Résonances (Écho, Lignée, Étoiles sœurs) et nombre de cartes d'un même thème.
@ -101,6 +104,8 @@ export const EXPEDITION_SETTINGS_SCHEMA = Object.freeze([
int("progression.duplicateLevels", 0, 12),
int("progression.fieldXpPct", 0, 100),
int("progression.stardustPerEclat", 1, 1000),
int("progression.oblivionPrice", 1, 100000),
int("plans.maxStatPct", 25, 100),
int("equipment.maxPerCard", 0, 3),
int("equipment.secondSlotPower", 1, 300),
int("equipment.thirdSlotPower", 1, 300),

View file

@ -2,7 +2,7 @@
// Module pur : il appelle les mêmes règles que le serveur, sans base ni hasard.
import { cardRarity } from "./daily.js";
import {
cardExpeditionData, cardPower, evaluateTeam, EXPEDITION_RARITIES, expectedLoot, maxLevel, MAX_STARS, soloRoles, splitPower, TIER_IDS
cardExpeditionData, cardPower, evaluateTeam, EXPEDITION_RARITIES, expectedLoot, maxLevel, MAX_STARS, planStats, ROLE_BY_STAT, soloRoles, splitPower, TIER_IDS
} from "./expedition-rules.js";
// Cartes jouables : chaque carte rare ou mieux à sa rareté, plus une mythique virtuelle pour chaque légendaire.
@ -25,14 +25,18 @@ const atLevel = (card, level, settings) => {
const entryFor = (destination) => ({ condition: destination.conditions[0], dangers: destination.dangers.slice(0, 2) });
// Carte construite pour une place : ses points de niveau suivent la vocation du rôle de la place.
const builtFor = (card, role, settings) => ({ ...card, stats: planStats(card.rarity, card.level, card.profile, { plan: ROLE_BY_STAT[role] }, settings) });
// Meilleur score d'une paire sur une destination : les deux façons de placer les cartes sur les deux rôles du solo.
export function bestPairScore(first, second, destination, stars, durationIndex, settings) {
// `built` : chaque carte a la vocation de sa place (une équipe construite pour la destination).
export function bestPairScore(first, second, destination, stars, durationIndex, settings, built = false) {
const roles = soloRoles(destination, 2);
let best = null;
for (const [a, b] of [[first, second], [second, first]]) {
const result = evaluateTeam({
destination, entry: entryFor(destination), stars, durationIndex,
slots: [{ ...a, role: roles[0] }, { ...b, role: roles[1] }]
slots: [{ ...(built ? builtFor(a, roles[0], settings) : a), role: roles[0] }, { ...(built ? builtFor(b, roles[1], settings) : b), role: roles[1] }]
}, settings);
if (!best || result.scorePct > best.scorePct) best = result;
}
@ -71,12 +75,13 @@ export function simulate(catalog, destinations, settings) {
// 2. Score par rareté (paires de même rareté), étoiles et niveau : minimum, médiane et maximum sur toutes les destinations.
const byRarity = [];
for (const [label, cards] of [["niveau 0", atZero], ["niveau max", atMax]]) {
// « niveau max, vocations » : les mêmes paires, chaque carte avec la vocation de sa place (plans de progression).
for (const [label, cards, built] of [["niveau 0", atZero, false], ["niveau max", atMax, false], ["max+vocat.", atMax, true]]) {
for (const rarity of EXPEDITION_RARITIES) {
const pairs = pairsOf(cards, (a, b) => a.rarity === rarity && b.rarity === rarity);
for (let stars = 1; stars <= MAX_STARS; stars += 1) {
const scores = [];
for (const [a, b] of pairs) for (const destination of visible) scores.push(bestPairScore(a, b, destination, stars, 0, settings).scorePct);
for (const [a, b] of pairs) for (const destination of visible) scores.push(bestPairScore(a, b, destination, stars, 0, settings, built).scorePct);
scores.sort((x, y) => x - y);
byRarity.push({ level: label, rarity, stars, min: scores[0] ?? 0, median: scores[Math.floor(scores.length / 2)] ?? 0, max: scores.at(-1) ?? 0 });
}

View file

@ -39,7 +39,7 @@ const ADMIN_HISTORY_PAGE_SIZE = 50;
const PLAYER_HISTORY_EVENTS = Object.freeze([
"welcome_opening", "pack_opened", "gift_pack_opened", "cards_recycled", "opening_purchased", "campaign_claimed",
"trade_created", "trade_received", "trade_declined", "trade_joined", "trade_completed", "trade_cancelled",
"gift_created", "gift_joined", "gift_completed", "gift_cancelled", "daily_won", "expedition_completed", "expedition_cancelled_by_guild", "expedition_dissolved", "card_upgraded", "eclats_converted", "item_used", "destination_starter"
"gift_created", "gift_joined", "gift_completed", "gift_cancelled", "daily_won", "expedition_completed", "expedition_cancelled_by_guild", "expedition_dissolved", "card_upgraded", "eclats_converted", "item_used", "destination_starter", "card_plan_changed", "oblivion_bought"
]);
const DEV_STARDUST = 1000;
const DELETED_PLAYER_NAME = "Joueur supprimé";
@ -502,7 +502,7 @@ export class CardsService {
player: publicPlayer(player), recharge, collection, favorites,
wallet: { stardust: player.stardust, purchasedOpenings: player.purchased_openings, eclats: player.eclats },
// Le Pont des Veilleurs (poussière vers Éclats) est vendu en boutique, au taux réglé dans les Expéditions.
shop: { stardustValues: shop.stardustValues, openingPrice: shop.openingPrice, shopPackPrice: shop.shopPackPrice, shopPackShare: shop.shopPackShare, dailyReward: shop.dailyReward, stardustPerEclat: this.expeditions.settings.progression.stardustPerEclat },
shop: { stardustValues: shop.stardustValues, openingPrice: shop.openingPrice, shopPackPrice: shop.shopPackPrice, shopPackShare: shop.shopPackShare, dailyReward: shop.dailyReward, stardustPerEclat: this.expeditions.settings.progression.stardustPerEclat, oblivionPrice: this.expeditions.settings.progression.oblivionPrice },
daily: this.dailySummary(playerId),
expeditions: this.expeditions.summary(playerId),
cardProgress: this.expeditions.cardProgressView(playerId),

View file

@ -569,6 +569,71 @@ test("cards level up with Éclats or a duplicate, gain field experience and stro
assert.equal(database.db.prepare("SELECT COUNT(*) AS count FROM card_progress WHERE player_id = ?").get(player.id).count, 0);
});
test("progression plans spread level points by vocation or by hand, and a Parchemin d'oubli pays for each change", () => {
const { service, player, open, rares, database } = expeditionService();
open();
const [card] = rares;
// Niveau 4 d'une rare : Puissance 60, dont 20 points de niveau, 12 au plus dans une stat (60 %).
database.db.prepare("INSERT INTO card_progress(player_id, edition_id, level, field_xp, updated_at) VALUES (?, ?, 4, 0, 0)").run(player.id, card);
const progressOf = () => service.getState(player.id).cardProgress.find((item) => item.editionId === card);
const sum = (stats) => Object.values(stats).reduce((total, value) => total + value, 0);
const before = progressOf();
assert.deepEqual([before.power, before.plan.id, before.plan.points, before.plan.maxStatPoints, before.plan.paid], [60, "collection", 20, 12, false]);
assert.deepEqual(before.stats, before.plan.previews.collection);
assert.equal(sum(before.plan.levelBase), 40);
// Tant que la carte suit sa collection, choisir une vocation est gratuit et s'applique aux points déjà gagnés.
const guardian = service.expeditions.setCardPlan(player.id, { editionId: card, plan: "guardian" }).progress;
const base = before.plan.levelBase;
assert.deepEqual(guardian.stats, { bravoure: base.bravoure + 4, endurance: base.endurance + 12, fortune: base.fortune, orientation: base.orientation + 4 });
assert.deepEqual(guardian.stats, before.plan.previews.guardian);
assert.equal(guardian.plan.paid, true);
assert.deepEqual(service.expeditions.getExpeditions(player.id).cards.find((item) => item.editionId === card).stats, guardian.stats);
// Ensuite, changer de plan consomme un Parchemin d'oubli, acheté en boutique avec de la poussière.
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: card, plan: "navigator" }), (error) => error.code === "NOT_ENOUGH_ITEMS");
database.db.prepare("UPDATE players SET stardust = 400 WHERE id = ?").run(player.id);
assert.throws(() => service.expeditions.buyOblivion(player.id, { count: 3 }), (error) => error.code === "NOT_ENOUGH_STARDUST");
assert.throws(() => service.expeditions.buyOblivion(player.id, { count: 0 }), (error) => error.code === "PURCHASE_INVALID");
assert.equal(service.expeditions.buyOblivion(player.id, { count: 2 }).wallet.stardust, 100);
assert.equal(service.expeditions.itemsOf(player.id).oblivion, 2);
assert.equal(service.expeditions.setCardPlan(player.id, { editionId: card, plan: "navigator" }).progress.stats.orientation, base.orientation + 12);
assert.equal(service.expeditions.itemsOf(player.id).oblivion, 1);
// Reprendre le même plan ne coûte rien.
service.expeditions.setCardPlan(player.id, { editionId: card, plan: "navigator" });
assert.equal(service.expeditions.itemsOf(player.id).oblivion, 1);
// En libre : au plus 12 points dans une stat et 20 en tout ; ajouter des points est gratuit, en retirer coûte un Parchemin.
const allocation = (bravoure, fortune) => ({ bravoure, endurance: 0, fortune, orientation: 0 });
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: card, plan: "free", allocation: allocation(13, 0) }), (error) => error.code === "ALLOCATION_INVALID");
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: card, plan: "free", allocation: { bravoure: 12, fortune: 12 } }), (error) => error.code === "ALLOCATION_INVALID");
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: card, plan: "free", allocation: { bravoure: 1.5 } }), (error) => error.code === "ALLOCATION_INVALID");
const free = service.expeditions.setCardPlan(player.id, { editionId: card, plan: "free", allocation: allocation(12, 3) }).progress;
assert.equal(service.expeditions.itemsOf(player.id).oblivion, 0);
assert.deepEqual(free.plan.allocation, allocation(12, 3));
assert.equal(sum(free.stats), 55, "5 points restent à placer");
service.expeditions.setCardPlan(player.id, { editionId: card, plan: "free", allocation: allocation(12, 8) });
assert.equal(sum(progressOf().stats), 60);
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: card, plan: "free", allocation: allocation(10, 8) }), (error) => error.code === "NOT_ENOUGH_ITEMS");
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: card, plan: "wizard" }), (error) => error.code === "PLAN_INVALID");
// Un niveau de plus en libre : 5 nouveaux points à placer, les anciens restent.
database.db.prepare("UPDATE card_progress SET level = 5 WHERE player_id = ? AND edition_id = ?").run(player.id, card);
assert.deepEqual([progressOf().plan.points, sum(progressOf().stats)], [25, 60]);
// Le plan d'une carte en expédition ne change pas avant son retour.
const view = service.expeditions.getExpeditions(player.id);
service.expeditions.startSolo(player.id, soloBody(view, [card, rares[1]]), "planned");
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: card, plan: "free", allocation: allocation(12, 13) }), (error) => error.code === "EXPEDITION_CARD_BUSY");
assert.throws(() => service.expeditions.setCardPlan(player.id, { editionId: editionsOf("common")[0], plan: "guardian" }), (error) => error.code === "CARD_NOT_OWNED");
const history = service.getState(player.id).history;
assert.deepEqual(history.filter((entry) => entry.type === "card_plan_changed").map((entry) => [entry.details.plan, entry.details.oblivion]),
[["guardian", false], ["navigator", true], ["free", true], ["free", false]]);
assert.ok(history.some((entry) => entry.type === "oblivion_bought" && entry.details.count === 2 && entry.details.stardust === 300));
assert.equal(service.getState(player.id).shop.oblivionPrice, 150);
});
test("the one-way bridge turns stardust into Éclats at the configured rate", async (t) => {
const { service, player, admin, database } = expeditionService();
database.db.prepare("UPDATE players SET stardust = 40 WHERE id = ?").run(player.id);

View file

@ -8,7 +8,7 @@ import {
applyHazards, cardPower, drawExpeditionDay, editionExpeditionData, efficiency, evaluateTeam, expectedLoot, maxLevel,
requirementsFor, resolveDayEntry, rollLoot, roundStochastic, scoreExpedition, soloRoles, splitPower, STAT_IDS, teamStats, upgradeCost, gainProgress,
equipmentBonus, LINEAGES, resonancesOf, teamSynergy, unlockedSlots, bonusLootPct, pickItems, HIDDEN_ITEMS, teamPowers, travelHours,
bonusLevel, levelCount, starsForLevel
bonusLevel, levelCount, starsForLevel, planStats, vocationProfile, clampAllocation, allocationError, levelPoints, maxStatPoints
} from "../services/cards/expedition-rules.js";
import { drawCollectionCard } from "../services/cards/game-rules.js";
import {
@ -435,3 +435,20 @@ test("powers trade an advantage for a cost and count once per team", () => {
assert.equal(groupLoot(["fogBell"]).eclats, groupLoot([]).eclats);
assert.equal(teamSynergy({ destination, slots: [], bellPct: settings.powers.fogBellSynergyPct }, settings).totalPct, 10);
});
test("progression plans: the default keeps today's stats, vocations reach the cap and free points stay within the rules", () => {
const profile = { bravoure: 25, endurance: 25, fortune: 20, orientation: 30 };
for (const level of [0, 3, 12]) assert.deepEqual(planStats("rare", level, profile, null, settings), splitPower(cardPower("rare", level, settings), profile));
assert.deepEqual([levelPoints("rare", 4, settings), levelPoints("legendary", 6, settings), levelPoints("legendary", 9, settings), maxStatPoints(25, settings)], [20, 30, 30, 15]);
assert.deepEqual(vocationProfile("navigator", settings), { bravoure: 0, endurance: 20, fortune: 20, orientation: 60 });
assert.deepEqual(vocationProfile("leader", { ...settings, plans: { maxStatPct: 45 } }), { bravoure: 45, endurance: 28, fortune: 0, orientation: 27 });
// Rare de niveau 4 : base 40 selon le profil, puis 20 points en vocation de Gardien (12 / 4 / 4).
assert.deepEqual(planStats("rare", 4, profile, { plan: "guardian" }, settings), { bravoure: 14, endurance: 22, fortune: 8, orientation: 16 });
assert.deepEqual(planStats("rare", 4, profile, { plan: "free", allocation: { fortune: 7 } }, settings), { bravoure: 10, endurance: 10, fortune: 15, orientation: 12 });
// Une répartition qui ne respecte plus les règles (réglage abaissé) est ramenée dedans, sans erreur.
assert.deepEqual(clampAllocation({ bravoure: 20, endurance: 9 }, 20, settings), { bravoure: 11, endurance: 9, fortune: 0, orientation: 0 });
assert.equal(allocationError({ bravoure: 12, fortune: 8 }, 20, settings), null);
assert.match(allocationError({ bravoure: 13 }, 20, settings), /12 points/);
assert.match(allocationError({ bravoure: 10, fortune: 11 }, 20, settings), /20 points/);
assert.ok(allocationError({ magic: 1 }, 20, settings));
});

View file

@ -497,7 +497,7 @@ test("duplicates become stardust that buys openings kept apart from the recharge
const before = service.getState(player.id);
assert.deepEqual(before.wallet, { stardust: 0, purchasedOpenings: 0, eclats: 0 });
assert.deepEqual(before.shop, { stardustValues: INITIAL_SHOP_SETTING.stardustValues, openingPrice: INITIAL_SHOP_SETTING.openingPrice, shopPackPrice: 60, shopPackShare: 50, dailyReward: 10, stardustPerEclat: 3 });
assert.deepEqual(before.shop, { stardustValues: INITIAL_SHOP_SETTING.stardustValues, openingPrice: INITIAL_SHOP_SETTING.openingPrice, shopPackPrice: 60, shopPackShare: 50, dailyReward: 10, stardustPerEclat: 3, oblivionPrice: 150 });
assert.deepEqual(before.recycling, { count: 2, stardust: 2 * value });
// Une favorite garde son exemplaire : ses doublons se recyclent comme les autres.
service.setFavorite(player.id, editionId, true);

View file

@ -76,6 +76,10 @@
"eclatsLabel": "Éclats à obtenir",
"eclatsAction": "Convertir",
"eclatsDone": "+{eclats} Éclats d’étoile ! Améliorez une carte depuis sa fiche dans la Collection.",
"oblivionTitle": "Parchemin d’oubli",
"oblivionDescription": "Change le plan de progression d’une carte, depuis sa fiche. Vous en avez {count}.",
"oblivionLabel": "Parchemins à acheter",
"oblivionDone": "{count} Parchemin{s} d’oubli dans votre Sac du Veilleur.",
"eclatsBalance": "Vos Éclats d’étoile"
},
"transfers": {
@ -327,8 +331,8 @@
"crafted": "L’atelier a fabriqué : {card}.",
"bagTitle": "Sac du Veilleur",
"bagEmpty": "Les expéditions rapportent parfois des objets : ils apparaîtront ici.",
"items": { "fragment": "Fragment de carte au trésor", "engraving": "Burin de graveur", "plan": "Plan d’atelier", "anchor": "Ancre des Veilleurs", "guideStar": "Étoile guide", "skyChart": "Carte céleste" },
"itemHelp": { "fragment": "Réunis, ils ouvrent une destination cachée pour la journée.", "engraving": "Grave une étiquette sur une commune équipée, depuis la fiche de la carte.", "plan": "Sert à l’atelier, pour fabriquer une commune de pouvoir.", "anchor": "Rappelle une expédition solo en route, avec la part de butin déjà gagnée.", "guideStar": "Ajoute une 5e destination à votre journée.", "skyChart": "Ajoute une 6e destination à votre journée, au butin plus riche." },
"items": { "fragment": "Fragment de carte au trésor", "engraving": "Burin de graveur", "plan": "Plan d’atelier", "anchor": "Ancre des Veilleurs", "guideStar": "Étoile guide", "skyChart": "Carte céleste", "oblivion": "Parchemin d’oubli" },
"itemHelp": { "fragment": "Réunis, ils ouvrent une destination cachée pour la journée.", "engraving": "Grave une étiquette sur une commune équipée, depuis la fiche de la carte.", "plan": "Sert à l’atelier, pour fabriquer une commune de pouvoir.", "anchor": "Rappelle une expédition solo en route, avec la part de butin déjà gagnée.", "guideStar": "Ajoute une 5e destination à votre journée.", "skyChart": "Ajoute une 6e destination à votre journée, au butin plus riche.", "oblivion": "Change le plan de progression d’une carte, depuis sa fiche. S’achète en boutique." },
"useGuideStar": "Ajouter une 5e destination",
"useSkyChart": "Ajouter une 6e destination",
"useFragments": "Ouvrir une destination cachée",

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -1,7 +1,8 @@
// Rôle : affiche la fiche détaillée d'une carte possédée (grand format, favori, recyclage d'un doublon).
// Rôle : affiche la fiche détaillée d'une carte possédée (grand format, favori, recyclage d'un doublon, progression d'expédition).
import { Modal } from "../../components/Modal.jsx";
import { recycleDuplicates, setFavorite, upgradeCard } from "./cardsApi.js";
import { CardEquipment } from "./CardEquipment.jsx";
import { CardPlan } from "./CardPlan.jsx";
import { CurrencyAmount } from "./Currency.jsx";
import { readCollection } from "./collectionState.js";
import { NebulaCard } from "./NebulaCard.jsx";
@ -11,7 +12,7 @@ import { formatStardust } from "./stardustFormat.js";
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
// Expéditions : niveau, Puissance, stats et amélioration d'une carte rare ou mieux (Éclats, ou doublon de la même édition).
function CardProgress({ catalog, state, progress, eclats, busy, runMutation }) {
function CardProgress({ catalog, state, progress, eclats, locked, busy, runMutation }) {
const atCap = progress.nextCost == null;
return <section className="nebula-card-progress" aria-labelledby="nebula-card-progress-title">
<h3 id="nebula-card-progress-title">Expéditions · niveau {progress.level} / {progress.maxLevel}</h3>
@ -22,6 +23,7 @@ function CardProgress({ catalog, state, progress, eclats, busy, runMutation }) {
{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>}
</div>}
{!atCap && <p className="nebula-form-help">Vous avez {formatEclats(eclats)} Éclats. Chaque retour d’expédition donne de l’expérience de terrain ({progress.fieldXp} % du niveau suivant).</p>}
<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} />
<CardEquipment catalog={catalog} state={state} progress={progress} busy={busy} runMutation={runMutation} />
</section>;
}
@ -39,7 +41,7 @@ export function CardDetailModal({ catalog, state, entry, runMutation, busy, onCl
<div className="nebula-card-detail-layout"><NebulaCard catalog={catalog} entry={entry} size="lg" />
<div><p className="eyebrow">{catalog.rarities.find((item) => item.id === entry.edition.rarity)?.label}</p><h2 id="nebula-card-detail-title">{entry.card.name}</h2><p>{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>
{progress && <CardProgress catalog={catalog} state={state} progress={progress} eclats={state.wallet.eclats ?? 0} busy={busy} runMutation={runMutation} />}
{progress && <CardProgress catalog={catalog} state={state} progress={progress} eclats={state.wallet.eclats ?? 0} locked={Boolean(expedition)} busy={busy} runMutation={runMutation} />}
<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>}
{spare > 0 && onStartTransfer && <>

View file

@ -0,0 +1,78 @@
// Rôle : plan de progression d'une carte depuis sa fiche : ses points de niveau suivent sa collection, une vocation (la stat d'un rôle)
// ou la répartition du joueur. Aperçu des stats avant de valider ; le premier choix est gratuit, les changements suivants coûtent
// un Parchemin d'oubli (ajouter des points en libre reste gratuit).
import { useState } from "react";
import { setCardPlan } from "./cardsApi.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
const PLANS = [
{ id: "collection", label: "Sa collection", help: "Les points suivent le profil de la collection de la carte." },
{ id: "leader", stat: "bravoure", label: "Meneur", help: "Faite pour la place de Meneur : surtout de la Bravoure." },
{ id: "guardian", stat: "endurance", label: "Gardien", help: "Faite pour la place de Gardien : surtout de l’Endurance." },
{ id: "seeker", stat: "fortune", label: "Chercheur", help: "Faite pour la place de Chercheur : surtout de la Fortune." },
{ id: "navigator", stat: "orientation", label: "Navigateur", help: "Faite pour la place de Navigateur : surtout de l’Orientation." },
{ id: "free", label: "Libre", help: "Vous placez vous-même chaque point." }
];
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)]));
function StatPreview({ before, after }) {
return <ul className="nebula-card-plan-preview" aria-label="Stats de la carte avec ce plan, hors équipement">{STATS.map(([stat, label]) => {
const delta = after[stat] - before[stat];
return <li key={stat} data-trend={delta > 0 ? "up" : delta < 0 ? "down" : undefined}>
<span><MaskIcon name={stat} />{label}</span>
<strong>{delta ? <>{before[stat]} → {after[stat]}</> : after[stat]}</strong>
</li>;
})}</ul>;
}
// `locked` : la carte est en expédition, son plan ne change pas avant son retour.
export function CardPlan({ progress, oblivions, locked = false, busy, runMutation }) {
const plan = progress.plan;
const [choice, setChoice] = useState(plan.id);
const [draft, setDraft] = useState(() => toDraft(plan.allocation));
const free = choice === "free";
const allocation = Object.fromEntries(STATS.map(([stat]) => [stat, Math.max(0, Number.parseInt(draft[stat], 10) || 0)]));
const left = plan.points - total(allocation);
const placed = plan.allocation || toDraft(null);
const unchanged = choice === plan.id && (!free || STATS.every(([stat]) => allocation[stat] === Number(placed[stat])));
const onlyAdds = free && plan.id === "free" && STATS.every(([stat]) => allocation[stat] >= Number(placed[stat]));
const paid = plan.paid && !onlyAdds;
const preview = free ? Object.fromEntries(STATS.map(([stat]) => [stat, plan.levelBase[stat] + allocation[stat]])) : plan.previews[choice];
const chosen = PLANS.find((item) => item.id === choice);
// Un point de plus ne dépasse ni le plafond d'une stat, ni les points restants.
const setPoints = (stat, raw) => {
const limit = Math.min(plan.maxStatPoints, allocation[stat] + left);
setDraft((current) => ({ ...current, [stat]: raw !== "" && Number(raw) > limit ? String(limit) : raw }));
};
return <section className="nebula-card-plan" aria-labelledby="nebula-card-plan-title">
<h4 id="nebula-card-plan-title">Plan de progression</h4>
<p className="nebula-form-help">{plan.points
? `Ses ${plan.points} points de niveau se répartissent selon ce plan, au plus ${plan.maxStatPoints} dans une même stat.`
: "Chaque amélioration donne des points de stats, répartis selon ce plan."}</p>
<div role="group" aria-label="Plan de progression" className="nds-toolbar nebula-card-plan-choices">{PLANS.map((item) => <button key={item.id} type="button" className="nds-button" data-size="sm"
data-variant={item.id === choice ? "primary" : "secondary"} aria-pressed={item.id === choice} disabled={busy} onClick={() => setChoice(item.id)}>
{item.stat && <MaskIcon name={item.stat} />}{item.label}
</button>)}</div>
<p className="nebula-form-help">{chosen.help}</p>
{free && <div className="nebula-card-plan-points">
{STATS.map(([stat, label]) => <label key={stat}><span><MaskIcon name={stat} />{label}</span>
<input className="nds-input" type="number" inputMode="numeric" min="0" max={plan.maxStatPoints} step="1" value={draft[stat]} disabled={busy || !plan.points}
onChange={(event) => setPoints(stat, event.target.value)} onBlur={() => { if (draft[stat] === "") setDraft((current) => ({ ...current, [stat]: "0" })); }} />
</label>)}
<p className="nebula-form-help" role="status">{!plan.points ? "Aucun point à placer pour l’instant : améliorez la carte." : left > 0 ? `${left} point${left > 1 ? "s" : ""} à placer.` : "Tous les points sont placés."}</p>
</div>}
<StatPreview before={progress.baseStats} after={preview} />
{!unchanged && <p className="nebula-form-help">{paid
? `Coûte 1 Parchemin d’oubli : vous en avez ${oblivions}.${oblivions < 1 ? " Ils s’achètent dans la Boutique." : ""}`
: plan.id === "collection" ? "Premier choix gratuit : ensuite, changer de plan coûtera un Parchemin d’oubli." : "Placer de nouveaux points est gratuit."}</p>}
{locked && <p className="nebula-form-help">Cette carte est en expédition : son plan pourra changer à son retour.</p>}
<div className="nds-toolbar">
<button className="nds-button" data-variant="primary" type="button" disabled={busy || locked || unchanged || (paid && oblivions < 1)}
onClick={() => runMutation(() => setCardPlan(progress.editionId, choice, free ? allocation : null))}>{free ? "Valider les points" : "Choisir ce plan"}</button>
{!unchanged && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => { setChoice(plan.id); setDraft(toDraft(plan.allocation)); }}>Annuler</button>}
</div>
</section>;
}

View file

@ -11,6 +11,8 @@ import { NebulaCard } from "./NebulaCard.jsx";
const PREVIEW_DELAY_MS = 250;
const TIER_VARIANTS = { struggle: "neutral", success: "success", triumph: "gold" };
const LOOT_KINDS = ["eclats", "stardust", "cards", "items"];
// Vocation d'une carte (son plan de progression) : icône de la stat de son rôle à côté de sa Puissance.
const STAT_BY_PLAN = { leader: "bravoure", guardian: "endurance", seeker: "fortune", navigator: "orientation" };
// Effet de la spécialité sur le butin : flèche verte sur ce qui augmente, rouge sur ce qui baisse.
function LootEffects({ specialty, pct, content }) {
@ -185,7 +187,7 @@ export function ExpeditionPlanner({ catalog, view, mode = "solo", content, busy,
const selected = slots.includes(card.editionId);
return <li key={card.editionId} data-busy={card.busy || undefined}>
<NebulaCard catalog={catalog} entry={entry} size="sm" selected={selected} disabled={card.busy} onSelect={card.busy ? undefined : () => choose(card)} selectLabel={fillTemplate(content.chooseCard, { card: entry.card.name, role: content.roles[roleStat] })} />
<span className="nebula-expedition-card-power">{card.busy ? content.busy : fillTemplate(content.power, { power: card.power })}</span>
<span className="nebula-expedition-card-power">{STAT_BY_PLAN[card.plan] && <MaskIcon name={STAT_BY_PLAN[card.plan]} />}{card.busy ? content.busy : fillTemplate(content.power, { power: card.power })}</span>
<StatLine stats={card.stats} content={content} />
</li>;
})}</ul> : <p className="nds-inline-notice" data-variant="info">{fillTemplate(content.noCards, { count: slotCount })}</p>}

View file

@ -23,9 +23,13 @@ const EVENT_LABELS = {
card_upgraded: "Carte améliorée",
eclats_converted: "Éclats d’étoile obtenus",
item_used: "Objet utilisé",
destination_starter: "Carte de destination offerte"
destination_starter: "Carte de destination offerte",
card_plan_changed: "Plan de progression choisi",
oblivion_bought: "Parchemins d’oubli achetés"
};
const PLAN_NAMES = { collection: "selon sa collection", leader: "Meneur", guardian: "Gardien", seeker: "Chercheur", navigator: "Navigateur", free: "points libres" };
// Le journal garde la quantité réellement offerte : les comptes plus anciens n'ont reçu qu'une ouverture.
function eventLabel(entry) {
if (entry.type !== "welcome_opening") return EVENT_LABELS[entry.type];
@ -74,6 +78,8 @@ function HistoryDetail({ entry, catalog }) {
return <span>{[name, detail].filter(Boolean).join(" · ")}</span>;
}
if (entry.type === "destination_starter") return <span>{cardReference(details.editionId, catalog)} · par la Guilde des Veilleurs</span>;
if (entry.type === "card_plan_changed") return <span>{[cardReference(entry.entityId, catalog), PLAN_NAMES[details.plan] || details.plan, details.oblivion && "un Parchemin d’oubli utilisé"].filter(Boolean).join(" · ")}</span>;
if (entry.type === "oblivion_bought") return <span>{details.count} Parchemin{details.count > 1 ? "s" : ""} · −{formatStardust(details.stardust)} d’étoiles</span>;
if (entry.type === "eclats_converted") return <span>+{details.eclats} Éclats · −{formatStardust(details.stardust)} d’étoiles</span>;
if (entry.type === "opening_purchased") return <span>{details.count > 1 && `${details.count} ouvertures · `}−{formatStardust(details.stardust ?? details.price)} d’étoiles</span>;
if (!details.collectionId) return null;

View file

@ -1,7 +1,7 @@
// Rôle : boutique du joueur ; affiche le solde de poussière d'étoiles, achète des ouvertures de paquet et, quand les Expéditions
// sont ouvertes, change la poussière en Éclats d'étoile (Pont des Veilleurs).
// sont ouvertes, change la poussière en Éclats d'étoile (Pont des Veilleurs) et vend les Parchemins d'oubli.
import { useState } from "react";
import { buyOpening, buyShopPack, convertStardust } from "./cardsApi.js";
import { buyOblivion, buyOpening, buyShopPack, convertStardust } from "./cardsApi.js";
import { DashboardAside } from "./CardsDashboard.jsx";
import { CollectionCardBack } from "./CollectionCardBack.jsx";
import { EclatsBalance, StardustBalance } from "./Currency.jsx";
@ -13,6 +13,7 @@ import { formatStardust } from "./stardustFormat.js";
// Bornes du serveur par achat (service.js et expedition-progress.js) : la quantité ne dépasse ni elles, ni ce que la poussière paie.
const MAX_OPENINGS_PER_PURCHASE = 100;
const MAX_ECLATS_PER_CONVERSION = 10_000;
const MAX_OBLIVION_PER_PURCHASE = 100;
const affordable = (stardust, price, limit) => (price > 0 ? Math.min(Math.floor(stardust / price), limit) : limit);
// Quantité saisie (texte du champ) : jamais au-dessus du maximum payable. Si le solde baisse (un autre achat), la valeur
@ -54,6 +55,10 @@ export function ShopEclatsCover() {
return <div className="nds-card-cover nebula-shop-item-cover"><img src="/static/img/cards/shop/eclats.webp" alt="" loading="lazy" /></div>;
}
export function ShopOblivionCover() {
return <div className="nds-card-cover nebula-shop-item-cover"><img src="/static/img/cards/shop/oblivion.webp" alt="" loading="lazy" /></div>;
}
// Bouton d'achat pleine largeur : l'action et le coût total en poussière.
function BuyButton({ label, total, disabled, type = "submit", onClick }) {
return <button className="nds-button nebula-shop-buy" data-variant="primary" type={type} disabled={disabled} aria-label={`${label} · ${formatStardust(total)}`} onClick={onClick}>
@ -116,6 +121,13 @@ export function ShopPanel({ catalog, state, runMutation, busy, content, onOpenPa
return Boolean(result);
}
async function buyScrolls(count) {
setNotice("");
const result = await runMutation(() => buyOblivion(count));
if (result) setNotice(fillTemplate(content.oblivionDone, { count, s: count > 1 ? "s" : "" }));
return Boolean(result);
}
return <div className="nebula-shop">
<div className="nds-section-heading nebula-section-heading">
<div><p className="eyebrow">Poussière d’étoiles</p><h2>Boutique</h2></div>
@ -144,6 +156,10 @@ export function ShopPanel({ catalog, state, runMutation, busy, content, onOpenPa
{showEclats && <QuantityItem id="eclats" cover={<ShopEclatsCover />} title={content.eclatsTitle} description={content.eclatsDescription}
quantityLabel={content.eclatsLabel} rateLabel={content.unitRate} price={shop.stardustPerEclat} limit={MAX_ECLATS_PER_CONVERSION} actionLabel={content.eclatsAction}
stardust={wallet.stardust} busy={busy} onSubmit={convert} />}
{/* Parchemin d'oubli : change le plan de progression d'une carte (fiche de la carte), au prix réglé dans la boutique. */}
{showEclats && <QuantityItem id="oblivion" cover={<ShopOblivionCover />} title={content.oblivionTitle} description={fillTemplate(content.oblivionDescription, { count: state.items?.oblivion ?? 0 })}
quantityLabel={content.oblivionLabel} rateLabel={content.unitRate} price={shop.oblivionPrice} limit={MAX_OBLIVION_PER_PURCHASE} actionLabel="Acheter"
stardust={wallet.stardust} busy={busy} onSubmit={buyScrolls} />}
</div>
</section>
</div>;

View file

@ -1,11 +1,11 @@
// Rôle : règle la boutique ; poussière d'étoiles gagnée par doublon recyclé et prix des articles achetables, dont l'Éclat
// d'étoile (Pont des Veilleurs), enregistré avec les réglages des Expéditions.
// d'étoile (Pont des Veilleurs) et le Parchemin d'oubli, enregistrés avec les réglages des Expéditions.
import { useState } from "react";
import { updateExpeditionSettings } from "../cardsApi.js";
import { ShopEclatsCover, ShopOpeningCover, ShopPackCover } from "../ShopPanel.jsx";
import { ShopEclatsCover, ShopOblivionCover, ShopOpeningCover, ShopPackCover } from "../ShopPanel.jsx";
import { formatStardust } from "../stardustFormat.js";
import { ApplyActions } from "./adminSettingForm.jsx";
import { ECLAT_PRICE_PATH } from "./expeditionSettingFields.js";
import { ECLAT_PRICE_PATH, OBLIVION_PRICE_PATH } from "./expeditionSettingFields.js";
import { inRange, MAX_VALUE, parse, shopSettingSaver } from "./adminSettings.js";
function RecyclingForm({ catalog, setting, busy, save }) {
@ -35,26 +35,35 @@ function RecyclingForm({ catalog, setting, busy, save }) {
</section>;
}
// Éclat d'étoile : prix, bornes du schéma des Expéditions, ouverture des Expéditions et coût du premier niveau d'une légendaire.
function eclatArticle(expedition) {
// Articles des Expéditions : prix de l'Éclat d'étoile et du Parchemin d'oubli avec les bornes du schéma, ouverture des Expéditions
// et coût du premier niveau d'une légendaire.
function expeditionArticles(expedition) {
if (!expedition) return null;
const { settings, schema } = expedition;
const field = schema.find((item) => item.path === ECLAT_PRICE_PATH);
const bounds = (path) => { const field = schema.find((item) => item.path === path); return { min: field.min, max: field.max }; };
const legendaryLevel = settings.progression.costFactor * (settings.power.legendary - settings.progression.costOffset);
return { price: settings.progression.stardustPerEclat, min: field.min, max: field.max, open: settings.enabled, legendaryLevel };
return {
open: settings.enabled,
eclat: { price: settings.progression.stardustPerEclat, ...bounds(ECLAT_PRICE_PATH), legendaryLevel },
oblivion: { price: settings.progression.oblivionPrice, ...bounds(OBLIVION_PRICE_PATH) }
};
}
function ArticlesForm({ catalog, setting, eclat, busy, save, saveEclatPrice }) {
const toDraft = () => ({ openingPrice: String(setting.openingPrice), packPrice: String(setting.shopPackPrice), eclatPrice: eclat ? String(eclat.price) : "" });
function ArticlesForm({ catalog, setting, articles, busy, save, saveExpeditionPrices }) {
const eclat = articles?.eclat;
const oblivion = articles?.oblivion;
const toDraft = () => ({ openingPrice: String(setting.openingPrice), packPrice: String(setting.shopPackPrice), eclatPrice: eclat ? String(eclat.price) : "", oblivionPrice: oblivion ? String(oblivion.price) : "" });
const [draft, setDraft] = useState(toDraft);
const openingPrice = parse(draft.openingPrice);
const shopPackPrice = parse(draft.packPrice);
const eclatPrice = parse(draft.eclatPrice);
const oblivionPrice = parse(draft.oblivionPrice);
const eclatValid = !eclat || inRange(eclatPrice, eclat.min, eclat.max);
const valid = inRange(openingPrice, 1, MAX_VALUE) && inRange(shopPackPrice, 1, MAX_VALUE) && eclatValid;
const oblivionValid = !oblivion || inRange(oblivionPrice, oblivion.min, oblivion.max);
const valid = inRange(openingPrice, 1, MAX_VALUE) && inRange(shopPackPrice, 1, MAX_VALUE) && eclatValid && oblivionValid;
const shopChanged = openingPrice !== setting.openingPrice || shopPackPrice !== setting.shopPackPrice;
const eclatChanged = Boolean(eclat) && eclatPrice !== eclat.price;
const changed = valid && (shopChanged || eclatChanged);
const expeditionChanged = Boolean(articles) && (eclatPrice !== eclat.price || oblivionPrice !== oblivion.price);
const changed = valid && (shopChanged || expeditionChanged);
const shopPack = catalog.collections.find((collection) => collection.packCategory === "shop");
// Repère : combien de doublons communs il faut recycler pour une ouverture, selon le barème en vigueur.
const commonValue = setting.stardustValues.common;
@ -86,12 +95,23 @@ function ArticlesForm({ catalog, setting, eclat, busy, save, saveEclatPrice }) {
<ShopEclatsCover />
<div className="nds-card-body nebula-shop-item-body nebula-admin-shop-item-fields">
<h4>Éclats d’étoile</h4>
{!eclat.open && <span className="nds-badge" data-variant="neutral">Fermé aux joueurs</span>}
{!articles.open && <span className="nds-badge" data-variant="neutral">Fermé aux joueurs</span>}
<label><span>Prix d’un Éclat</span><input className="nds-input" aria-label="Prix d’un Éclat d’étoile" type="number" inputMode="numeric" min={eclat.min} max={eclat.max} step="1" {...field("eclatPrice")} /></label>
{eclatValid
? <p className="nebula-form-help">Premier niveau d’une légendaire ({eclat.legendaryLevel.toLocaleString("fr-FR")} Éclats) = {formatStardust(eclat.legendaryLevel * eclatPrice)}.</p>
: <p className="nebula-form-help" role="alert">Prix d’un Éclat : entier de {eclat.min} à {eclat.max.toLocaleString("fr-FR")}.</p>}
{!eclat.open && <p className="nebula-form-help">Proposé aux joueurs quand les Expéditions sont ouvertes.</p>}
{!articles.open && <p className="nebula-form-help">Proposé aux joueurs quand les Expéditions sont ouvertes.</p>}
</div>
</article>}
{oblivion && <article className="nds-card nebula-shop-item" data-item="oblivion">
<ShopOblivionCover />
<div className="nds-card-body nebula-shop-item-body nebula-admin-shop-item-fields">
<h4>Parchemin d’oubli</h4>
{!articles.open && <span className="nds-badge" data-variant="neutral">Fermé aux joueurs</span>}
<label><span>Prix</span><input className="nds-input" aria-label="Prix d’un Parchemin d’oubli" type="number" inputMode="numeric" min={oblivion.min} max={oblivion.max} step="1" {...field("oblivionPrice")} /></label>
{oblivionValid
? <p className="nebula-form-help">Change le plan de progression d’une carte. Le premier choix de plan est gratuit.</p>
: <p className="nebula-form-help" role="alert">Prix d’un Parchemin : entier de {oblivion.min} à {oblivion.max.toLocaleString("fr-FR")}.</p>}
</div>
</article>}
</div>
@ -102,7 +122,7 @@ function ArticlesForm({ catalog, setting, eclat, busy, save, saveEclatPrice }) {
onCancel={() => setDraft(toDraft())}
onApply={async () => {
if (shopChanged) await save({ openingPrice, shopPackPrice });
if (eclatChanged) await saveEclatPrice(eclatPrice);
if (expeditionChanged) await saveExpeditionPrices({ eclatPrice, oblivionPrice });
}}
confirmTitle="Appliquer les nouveaux prix ?"
confirmMessage="Les prix s’appliquent immédiatement à tous les joueurs. Les ouvertures déjà achetées ne changent pas."
@ -117,11 +137,12 @@ export function AdminShop({ catalog, dashboard, busy, runMutation, refreshDashbo
const purchased = players.reduce((total, player) => total + player.purchasedOpenings, 0);
const save = shopSettingSaver(setting, runMutation, refreshDashboard);
const expedition = dashboard?.expeditionSettings;
const eclat = eclatArticle(expedition);
// Le prix d'un Éclat vit dans les réglages des Expéditions : on renvoie ces réglages avec ce seul prix changé.
const saveEclatPrice = async (price) => {
const articles = expeditionArticles(expedition);
// Ces prix vivent dans les réglages des Expéditions : on renvoie ces réglages avec ces seuls prix changés.
const saveExpeditionPrices = async ({ eclatPrice, oblivionPrice }) => {
const next = structuredClone(expedition.settings);
next.progression.stardustPerEclat = price;
next.progression.stardustPerEclat = eclatPrice;
next.progression.oblivionPrice = oblivionPrice;
if (await runMutation(() => updateExpeditionSettings(next))) await refreshDashboard();
};
return <div className="nebula-admin-shop-page">
@ -132,7 +153,7 @@ export function AdminShop({ catalog, dashboard, busy, runMutation, refreshDashbo
{setting
? <>
<RecyclingForm key={JSON.stringify(setting.stardustValues)} catalog={catalog} setting={setting} busy={busy} save={save} />
<ArticlesForm key={`${setting.openingPrice}-${setting.shopPackPrice}-${eclat?.price}`} catalog={catalog} setting={setting} eclat={eclat} busy={busy} save={save} saveEclatPrice={saveEclatPrice} />
<ArticlesForm key={`${setting.openingPrice}-${setting.shopPackPrice}-${articles?.eclat.price}-${articles?.oblivion.price}`} catalog={catalog} setting={setting} articles={articles} busy={busy} save={save} saveExpeditionPrices={saveExpeditionPrices} />
</>
: <div className="nds-empty-state" aria-busy="true"><p>Chargement de la boutique…</p></div>}
</div>;

View file

@ -9,6 +9,8 @@ const STATS_IN_ORDER = ["principale", "2e stat", "3e stat", "4e stat"];
export const EXPEDITION_OPEN_PATH = "enabled";
// Le prix d'un Éclat (Pont des Veilleurs) se règle dans Administration › Boutique, avec les autres articles.
export const ECLAT_PRICE_PATH = "progression.stardustPerEclat";
// Le prix d'un Parchemin d'oubli (changer le plan de progression d'une carte) aussi.
export const OBLIVION_PRICE_PATH = "progression.oblivionPrice";
// Onglets de l'administration : chacun réunit des panneaux (groupes de réglages, ou « destinations », la liste des destinations).
export const EXPEDITION_SETTING_THEMES = [
@ -27,7 +29,10 @@ export const EXPEDITION_SETTING_GROUPS = [
{
id: "shop",
title: "Boutique",
fields: [{ path: ECLAT_PRICE_PATH, label: "Prix d’un Éclat d’étoile en boutique", unit: "poussières" }]
fields: [
{ path: ECLAT_PRICE_PATH, label: "Prix d’un Éclat d’étoile en boutique", unit: "poussières" },
{ path: OBLIVION_PRICE_PATH, label: "Prix d’un Parchemin d’oubli en boutique", unit: "poussières" }
]
},
{
id: "general",
@ -77,12 +82,13 @@ export const EXPEDITION_SETTING_GROUPS = [
{
id: "progression",
title: "Améliorations",
help: "Coût d’un niveau en Éclats selon la Puissance actuelle, niveaux donnés par un doublon de la même carte et expérience gagnée à chaque retour. Le prix d’un Éclat se règle dans la Boutique.",
help: "Coût d’un niveau en Éclats selon la Puissance actuelle, niveaux donnés par un doublon de la même carte et expérience gagnée à chaque retour. Chaque niveau donne des points de stats, répartis selon le plan de progression de la carte (sa collection, une vocation ou des points libres) : une stat n’en reçoit jamais plus que la part maximale, que les vocations atteignent. Le prix d’un Éclat et celui d’un Parchemin d’oubli se règlent dans la Boutique.",
fields: [
{ path: "progression.costFactor", label: "Éclats par point de Puissance au-dessus du décalage" },
{ path: "progression.costOffset", label: "Décalage du coût (Puissance)" },
{ path: "progression.duplicateLevels", label: "Niveaux donnés par un doublon" },
{ path: "progression.fieldXpPct", label: "Expérience de terrain par retour, en part d’un niveau", unit: "%" }
{ path: "progression.fieldXpPct", label: "Expérience de terrain par retour, en part d’un niveau", unit: "%" },
{ path: "plans.maxStatPct", label: "Part maximale des points de niveau dans une stat", unit: "%" }
]
},
{

View file

@ -214,6 +214,16 @@ export function upgradeCard(editionId, method) {
return request("/progress/upgrade", { method: "POST", body: JSON.stringify({ editionId, method }) });
}
// Plan de progression d'une carte : « collection », une vocation (leader, guardian, seeker, navigator) ou « free » avec ses points placés.
export function setCardPlan(editionId, plan, allocation = null) {
return request("/progress/plan", { method: "PUT", body: JSON.stringify({ editionId, plan, allocation }) });
}
// Achète des Parchemins d'oubli avec de la poussière d'étoiles.
export function buyOblivion(count) {
return request("/shop/oblivion", { method: "POST", body: JSON.stringify({ count }) });
}
// Pont à sens unique : de la poussière vers les Éclats d'étoile.
export function convertStardust(eclats) {
return request("/eclats/convert", { method: "POST", body: JSON.stringify({ eclats }) });

View file

@ -85,7 +85,7 @@
.nebula-expedition-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--space-4) var(--space-3); max-height: 640px; margin: 0; padding: var(--space-1); overflow-y: auto; list-style: none; }
.nebula-expedition-cards li { display: grid; gap: var(--space-1); justify-items: center; text-align: center; }
.nebula-expedition-cards li[data-busy] { opacity: 0.55; }
.nebula-expedition-card-power { color: var(--color-text-primary); font-size: var(--font-size-xs); font-weight: 700; }
.nebula-expedition-card-power { display: inline-flex; align-items: center; justify-content: center; gap: 0.35em; color: var(--color-text-primary); font-size: var(--font-size-xs); font-weight: 700; }
.nebula-expedition-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1) var(--space-2); color: var(--color-text-muted); font-size: var(--font-size-xs); }
.nebula-expedition-preview { display: grid; gap: var(--space-3); }
@ -161,6 +161,19 @@
.nebula-card-progress p { font-size: var(--font-size-sm); }
// Équipements dans la fiche de carte et Grimoire des Expéditions.
// Plan de progression : choix du plan, points libres et aperçu des stats (flèche verte ou rouge selon l'écart).
.nebula-card-plan { display: grid; gap: var(--space-2); }
.nebula-card-plan h4 { margin: 0; font-size: var(--font-size-sm); }
.nebula-card-plan-choices .nds-button { display: inline-flex; align-items: center; gap: 0.4em; }
.nebula-card-plan-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: var(--space-2); }
.nebula-card-plan-points label { display: grid; gap: var(--space-1); font-size: var(--font-size-sm); }
.nebula-card-plan-points label > span, .nebula-card-plan-preview li > span { display: inline-flex; align-items: center; gap: 0.4em; }
.nebula-card-plan-points .nebula-form-help { grid-column: 1 / -1; }
.nebula-card-plan-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.nebula-card-plan-preview li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); background: var(--color-bg-surface-alt); font-size: var(--font-size-sm); }
.nebula-card-plan-preview strong { white-space: nowrap; }
.nebula-card-plan-preview li[data-trend="up"] strong { color: var(--color-success); }
.nebula-card-plan-preview li[data-trend="down"] strong { color: var(--color-danger); }
.nebula-card-equipment { display: grid; gap: var(--space-2); }
.nebula-card-equipment h4 { margin: 0; font-size: var(--font-size-sm); }
.nebula-card-equipment-slots, .nebula-card-equipment-choices { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }