Bring back objects from Sokko TCG Expeditions and open bonus and hidden destinations
- Expeditions bring back objects by weight, proportional to the loot; treasure-map fragments, burins and workshop plans need enough average Orientation. - A guide star adds a fifth destination to the player's day, a sky chart a sixth with richer loot, and enough fragments open one of two hidden destinations: Le Passage Écarlate and L'Observatoire perdu. - An anchor recalls a running solo expedition and keeps the Éclats and stardust already earned; a burin engraves a tag on a common to create the synergy a player wants. - The Veilleur's bag lists objects with their use, reports show brought-back objects, and Administration › Guilde tunes object chances, weights, the Orientation threshold and hidden-destination loot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
320498d878
commit
ae23adfdd9
28 changed files with 532 additions and 73 deletions
|
|
@ -349,3 +349,4 @@
|
|||
{"id":"int-8268aa35e75af62cd990afd91d02ef81","kind":"field_change","created_at":"2026-11-15T13:52:38.41466395Z","actor":"Shinuwa","issue_id":"sokko-g-v3u4.5","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Améliorations : niveaux par Éclats ou doublon, expérience de terrain, pont poussière vers Éclats, progression dans la fiche de carte, réglages admin. npm run check 317/317, e2e cards 13/13."}}
|
||||
{"id":"int-9284bbbbd915014e70ce8d7ed8b6add7","kind":"field_change","created_at":"2026-11-15T15:39:53.856492101Z","actor":"Shinuwa","issue_id":"sokko-g-v3u4.6","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Équipements (68 communes, budget de 6 points, emplacements par Puissance, synergie d'étiquette) et synergies de score (Affinité, Écho, Lignée, Étoiles sœurs, plafond), Grimoire, réglages admin. npm run check 321/321, e2e cards 13/13."}}
|
||||
{"id":"int-7221ee6a1c4c6d46e5dd9d72bd5bf4d3","kind":"field_change","created_at":"2026-11-15T16:09:18.427272366Z","actor":"Shinuwa","issue_id":"sokko-g-v3u4.8","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Alertes Discord : route DM dans palico-bot (branche discord-direct-messages), préférences joueur (désactivées par défaut), file d'envoi avec reprise, retours et groupes ouverts, réglage global admin, notice de confidentialité. npm run check 324/324, e2e cards 13/13, palico-bot check 12/12."}}
|
||||
{"id":"int-5a59aa9c238cb22fc5fd0a672685c565","kind":"field_change","created_at":"2026-11-15T16:27:54.100641728Z","actor":"Shinuwa","issue_id":"sokko-g-v3u4.7.1","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Objets : inventaire, butin d'objets avec seuil d'Orientation, ancre, étoile guide, carte céleste, fragments vers deux destinations cachées, burin. npm run check 327/327, e2e cards 13/13."}}
|
||||
|
|
|
|||
|
|
@ -1501,6 +1501,10 @@ Sous l'amélioration, la fiche liste les emplacements d'équipement en `nds-list
|
|||
« Équiper », occupé avec la commune, ses stats, un badge `success` « Synergie » et « Retirer », fermé
|
||||
en pointillés avec la Puissance qui l'ouvre) ; « Équiper » déroule les communes, synergies d'abord.
|
||||
Aperçus et rapports ajoutent un badge `success` par Affinité et par Résonance.
|
||||
Sous l'en-tête des Expéditions, le Sac du Veilleur (`nds-panel`) liste les objets en `nds-list-row` avec
|
||||
leur usage et, pour l'étoile guide, la carte céleste et les fragments, un bouton secondaire qui ajoute
|
||||
la destination ; une destination bonus porte un badge `gold`. Le rapport d'une expédition solo en route
|
||||
propose « Rappeler avec l’ancre » ; la fiche de carte propose « Graver » sur un équipement sans synergie.
|
||||
La page Compte ajoute, quand le bot Discord est configuré, un `nds-panel` « Alertes Discord » : une
|
||||
`nds-list-row` par alerte avec un bouton `sm` à `aria-pressed` (« Activée » primaire, « Désactivée »
|
||||
secondaire).
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ L'interface cible les fenêtres d'ordinateur en plein écran ou en demi-écran.
|
|||
la Puissance d'une carte jusqu'à un plafond commun à toutes les raretés ; un pont convertit la
|
||||
poussière en Éclats. Les cartes communes s'équipent sur les autres pour en modifier les stats ;
|
||||
étiquettes partagées, thème de la destination et Résonances (Écho, Lignée, Étoiles sœurs) donnent
|
||||
des bonus, inscrits dans un Grimoire. Chaque joueur peut activer des alertes Discord (groupe ouvert,
|
||||
des bonus, inscrits dans un Grimoire. Les expéditions rapportent aussi des objets : ancre, étoile guide
|
||||
et carte céleste (destinations en plus), fragments de carte au trésor (destinations cachées), burins. Chaque joueur peut activer des alertes Discord (groupe ouvert,
|
||||
expédition de retour), envoyées en message privé par palico-bot. Toutes les valeurs se règlent dans
|
||||
l'administration ; `node scripts/simulate-expeditions.mjs` affiche le rapport d'équilibrage.
|
||||
|
||||
|
|
|
|||
|
|
@ -203,6 +203,20 @@ Expéditions (migration 8, règles pures dans `services/cards/expedition-rules.j
|
|||
numérique) reçoivent des alertes ; le réglage `alerts.enabled` les coupe toutes. Les lignes envoyées
|
||||
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
|
||||
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.
|
||||
`player_bonus_destinations(player_id, day, slot, destination_id, created_at)` : `POST
|
||||
/api/cards/expeditions/bonus` (`{ item }`) ajoute pour la journée une 5e destination (`guideStar`),
|
||||
une 6e (`skyChart`, butin `loot.bonusSlotPct`) ou une destination cachée (`fragment` ×
|
||||
`items.fragmentsForMap`, butin `items.hiddenLootPct`) ; `BONUS_ALREADY_USED`, `BONUS_UNAVAILABLE`,
|
||||
`NOT_ENOUGH_ITEMS`. `setup_json.bonusSlot` garde la place. `POST /api/cards/expeditions/:id/recall`
|
||||
(ancre, solo) fait revenir l'expédition et garde Éclats et poussière au prorata (`reward_json.recalledPct`).
|
||||
`equipment_engravings(player_id, edition_id, tag, engraved_at)` : `POST /api/cards/equipment/engrave`
|
||||
(`{ editionId, tag }`, burin) ajoute une étiquette à une commune, une seule fois. `item_used` entre
|
||||
dans l'historique ; `getState().items` donne l'inventaire.
|
||||
- `POST /api/cards/admin/expeditions/:id/cancel` : libère les cartes sans butin ; `expedition_cancelled`
|
||||
côté administration, `expedition_cancelled_by_guild` dans l'historique du joueur.
|
||||
- `getState().expeditions` : résumé pour la tuile de la Guilde et la fiche de carte (ouverture, en
|
||||
|
|
|
|||
|
|
@ -1838,7 +1838,7 @@ test("an administrator opens expeditions and a player sends a team, then claims
|
|||
await general.getByRole("button", { name: "Appliquer", exact: true }).click();
|
||||
await page.getByRole("dialog").getByRole("button", { name: "Appliquer", exact: true }).click();
|
||||
await expect(general.getByRole("button", { name: "Expéditions ouvertes aux joueurs", exact: true })).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(page.getByRole("region", { name: "Destinations", exact: true }).getByRole("listitem")).toHaveCount(12);
|
||||
await expect(page.getByRole("region", { name: "Destinations", exact: true }).getByRole("listitem")).toHaveCount(14);
|
||||
|
||||
// Le partenaire possède deux légendaires distinctes : de quoi partir en solo.
|
||||
const { token } = JSON.parse(await readFile(join(tmpdir(), "sokkog-cards-e2e-partner.json"), "utf8"));
|
||||
|
|
@ -1903,6 +1903,7 @@ test("an administrator opens expeditions and a player sends a team, then claims
|
|||
|
||||
// Pont des Veilleurs : 3 poussières pour 1 Éclat ; la fiche de carte montre le niveau, la Puissance et l'expérience gagnée au retour.
|
||||
await expect(partner.getByRole("region", { name: /^Grimoire/ })).toContainText("Les paires de lore");
|
||||
await expect(partner.getByRole("region", { name: "Sac du Veilleur", exact: true })).toBeVisible();
|
||||
const bridge = partner.getByRole("form", { name: "Pont des Veilleurs" });
|
||||
await bridge.getByRole("spinbutton", { name: "Éclats à obtenir" }).fill("2");
|
||||
await expect(bridge).toContainText("Coût : 6");
|
||||
|
|
|
|||
|
|
@ -342,6 +342,15 @@ export function createCardsApiHandler({
|
|||
json(res, 200, service.expeditions.upgradeCard(session.player.id, { editionId: body.editionId, method: body.method }));
|
||||
return true;
|
||||
}
|
||||
if (req.method === "POST" && url.pathname === "/api/cards/expeditions/bonus") {
|
||||
json(res, 200, service.expeditions.addBonusDestination(session.player.id, { item: (await readBody(req)).item }));
|
||||
return true;
|
||||
}
|
||||
if (req.method === "POST" && url.pathname === "/api/cards/equipment/engrave") {
|
||||
const body = await readBody(req);
|
||||
json(res, 200, service.expeditions.engrave(session.player.id, { editionId: body.editionId, tag: body.tag }));
|
||||
return true;
|
||||
}
|
||||
if (req.method === "PUT" && url.pathname === "/api/cards/alerts") {
|
||||
const body = await readBody(req);
|
||||
json(res, 200, service.expeditions.setAlertPreferences(session.player.id, { groupOpened: body.groupOpened, expeditionReturned: body.expeditionReturned }));
|
||||
|
|
@ -368,6 +377,11 @@ export function createCardsApiHandler({
|
|||
}
|
||||
return true;
|
||||
}
|
||||
const expeditionRecall = routeMatch(url.pathname, /^\/api\/cards\/expeditions\/([^/]+)\/recall$/);
|
||||
if (req.method === "POST" && expeditionRecall) {
|
||||
json(res, 200, service.expeditions.recallExpedition(session.player.id, expeditionRecall[0]));
|
||||
return true;
|
||||
}
|
||||
const expeditionClaim = routeMatch(url.pathname, /^\/api\/cards\/expeditions\/([^/]+)\/claim$/);
|
||||
if (req.method === "POST" && expeditionClaim) {
|
||||
json(res, 200, service.expeditions.claim(session.player.id, expeditionClaim[0]));
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
"stats": ["orientation", "bravoure", "endurance", "fortune"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:voyage" }],
|
||||
"dangers": [
|
||||
{ "id": "crosscurrent", "label": "Courant contraire", "stat": "orientation", "unlessTags": ["lieu:vide"] },
|
||||
{ "id": "drifting-isle", "label": "Île à la dérive", "stat": "bravoure", "unlessTags": ["theme:constellations"] }
|
||||
{ "id": "crosscurrent", "label": "Courant contraire", "stat": "orientation", "unlessTags": ["lieu:vide"]},
|
||||
{ "id": "drifting-isle", "label": "Île à la dérive", "stat": "bravoure", "unlessTags": ["theme:constellations"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
"stats": ["bravoure", "orientation", "fortune", "endurance"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:veilleurs" }],
|
||||
"dangers": [
|
||||
{ "id": "meteor-shower", "label": "Pluie de météores", "stat": "bravoure", "unlessTags": ["theme:cometes"] },
|
||||
{ "id": "crater-smoke", "label": "Fumées du cratère", "stat": "orientation", "unlessTags": ["theme:veilleurs"] }
|
||||
{ "id": "meteor-shower", "label": "Pluie de météores", "stat": "bravoure", "unlessTags": ["theme:cometes"]},
|
||||
{ "id": "crater-smoke", "label": "Fumées du cratère", "stat": "orientation", "unlessTags": ["theme:veilleurs"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -36,8 +36,8 @@
|
|||
"stats": ["endurance", "bravoure", "orientation", "fortune"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:hiver" }],
|
||||
"dangers": [
|
||||
{ "id": "blizzard", "label": "Blizzard", "stat": "orientation", "unlessTags": ["theme:hiver"] },
|
||||
{ "id": "thin-ice", "label": "Glace fragile", "stat": "endurance", "unlessTags": ["lieu:glaces"] }
|
||||
{ "id": "blizzard", "label": "Blizzard", "stat": "orientation", "unlessTags": ["theme:hiver"]},
|
||||
{ "id": "thin-ice", "label": "Glace fragile", "stat": "endurance", "unlessTags": ["lieu:glaces"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -50,8 +50,8 @@
|
|||
"stats": ["fortune", "bravoure", "endurance", "orientation"],
|
||||
"conditions": [{ "type": "tag", "tag": "lieu:iles-jeux" }],
|
||||
"dangers": [
|
||||
{ "id": "final-boss", "label": "Boss de fin", "stat": "bravoure", "unlessTags": ["theme:aventure"] },
|
||||
{ "id": "falling-blocks", "label": "Pluie de blocs", "stat": "fortune", "unlessTags": ["personnage:cameleon", "theme:tresor"] }
|
||||
{ "id": "final-boss", "label": "Boss de fin", "stat": "bravoure", "unlessTags": ["theme:aventure"]},
|
||||
{ "id": "falling-blocks", "label": "Pluie de blocs", "stat": "fortune", "unlessTags": ["personnage:cameleon", "theme:tresor"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -64,8 +64,8 @@
|
|||
"stats": ["fortune", "orientation", "bravoure", "endurance"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:reves" }],
|
||||
"dangers": [
|
||||
{ "id": "deep-sleep", "label": "Sommeil profond", "stat": "endurance", "unlessTags": ["theme:nuit"] },
|
||||
{ "id": "dust-storm", "label": "Tempête de poussière", "stat": "orientation", "unlessTags": ["theme:poussiere"] }
|
||||
{ "id": "deep-sleep", "label": "Sommeil profond", "stat": "endurance", "unlessTags": ["theme:nuit"]},
|
||||
{ "id": "dust-storm", "label": "Tempête de poussière", "stat": "orientation", "unlessTags": ["theme:poussiere"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -78,8 +78,8 @@
|
|||
"stats": ["endurance", "fortune", "bravoure", "orientation"],
|
||||
"conditions": [{ "type": "tag", "tag": "lieu:soleil" }],
|
||||
"dangers": [
|
||||
{ "id": "scorching-wind", "label": "Vent brûlant", "stat": "endurance", "unlessTags": ["personnage:loup"] },
|
||||
{ "id": "blinding-light", "label": "Lumière aveuglante", "stat": "orientation", "unlessTags": ["lieu:soleil"] }
|
||||
{ "id": "scorching-wind", "label": "Vent brûlant", "stat": "endurance", "unlessTags": ["personnage:loup"]},
|
||||
{ "id": "blinding-light", "label": "Lumière aveuglante", "stat": "orientation", "unlessTags": ["lieu:soleil"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -92,8 +92,8 @@
|
|||
"stats": ["fortune", "endurance", "orientation", "bravoure"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:eau" }],
|
||||
"dangers": [
|
||||
{ "id": "flash-flood", "label": "Crue soudaine", "stat": "fortune", "unlessTags": ["personnage:loutre"] },
|
||||
{ "id": "comet-tail", "label": "Queue de comète", "stat": "endurance", "unlessTags": ["theme:cometes"] }
|
||||
{ "id": "flash-flood", "label": "Crue soudaine", "stat": "fortune", "unlessTags": ["personnage:loutre"]},
|
||||
{ "id": "comet-tail", "label": "Queue de comète", "stat": "endurance", "unlessTags": ["theme:cometes"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -106,8 +106,8 @@
|
|||
"stats": ["orientation", "endurance", "bravoure", "fortune"],
|
||||
"conditions": [{ "type": "tag", "tag": "lieu:vide" }],
|
||||
"dangers": [
|
||||
{ "id": "void-mist", "label": "Brume du vide", "stat": "orientation", "unlessTags": ["theme:constellations"] },
|
||||
{ "id": "silent-dark", "label": "Noir silencieux", "stat": "endurance", "unlessTags": ["theme:nuit"] }
|
||||
{ "id": "void-mist", "label": "Brume du vide", "stat": "orientation", "unlessTags": ["theme:constellations"]},
|
||||
{ "id": "silent-dark", "label": "Noir silencieux", "stat": "endurance", "unlessTags": ["theme:nuit"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -120,8 +120,8 @@
|
|||
"stats": ["orientation", "fortune", "endurance", "bravoure"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:veilleurs" }],
|
||||
"dangers": [
|
||||
{ "id": "starless-night", "label": "Nuit sans étoiles", "stat": "orientation", "unlessTags": ["personnage:hibou"] },
|
||||
{ "id": "crumbling-tower", "label": "Tour qui s'effrite", "stat": "fortune", "unlessTags": ["theme:veilleurs"] }
|
||||
{ "id": "starless-night", "label": "Nuit sans étoiles", "stat": "orientation", "unlessTags": ["personnage:hibou"]},
|
||||
{ "id": "crumbling-tower", "label": "Tour qui s'effrite", "stat": "fortune", "unlessTags": ["theme:veilleurs"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -134,8 +134,8 @@
|
|||
"stats": ["bravoure", "fortune", "orientation", "endurance"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:fete" }],
|
||||
"dangers": [
|
||||
{ "id": "feast-crowd", "label": "Foule du réveillon", "stat": "orientation", "unlessTags": ["theme:hiver"] },
|
||||
{ "id": "lost-gifts", "label": "Cadeaux égarés", "stat": "fortune", "unlessTags": ["theme:fete"] }
|
||||
{ "id": "feast-crowd", "label": "Foule du réveillon", "stat": "orientation", "unlessTags": ["theme:hiver"]},
|
||||
{ "id": "lost-gifts", "label": "Cadeaux égarés", "stat": "fortune", "unlessTags": ["theme:fete"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -148,8 +148,8 @@
|
|||
"stats": ["bravoure", "endurance", "orientation", "fortune"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:tresor" }],
|
||||
"dangers": [
|
||||
{ "id": "ancient-trap", "label": "Piège ancien", "stat": "endurance", "unlessTags": ["theme:aventure"] },
|
||||
{ "id": "maze-corridors", "label": "Couloirs en labyrinthe", "stat": "orientation", "unlessTags": ["personnage:herisson", "personnage:suricate"] }
|
||||
{ "id": "ancient-trap", "label": "Piège ancien", "stat": "endurance", "unlessTags": ["theme:aventure"]},
|
||||
{ "id": "maze-corridors", "label": "Couloirs en labyrinthe", "stat": "orientation", "unlessTags": ["personnage:herisson", "personnage:suricate"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
|
|
@ -162,9 +162,37 @@
|
|||
"stats": ["endurance", "orientation", "fortune", "bravoure"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:nuit" }],
|
||||
"dangers": [
|
||||
{ "id": "lunar-cold", "label": "Froid lunaire", "stat": "endurance", "unlessTags": ["lieu:glaces"] },
|
||||
{ "id": "veiled-moon", "label": "Lune voilée", "stat": "orientation", "unlessTags": ["lieu:lune-pale", "personnage:hibou"] }
|
||||
{ "id": "lunar-cold", "label": "Froid lunaire", "stat": "endurance", "unlessTags": ["lieu:glaces"]},
|
||||
{ "id": "veiled-moon", "label": "Lune voilée", "stat": "orientation", "unlessTags": ["lieu:lune-pale", "personnage:hibou"]}
|
||||
],
|
||||
"hidden": false
|
||||
},
|
||||
{
|
||||
"id": "crimson-passage",
|
||||
"name": "Le Passage Écarlate",
|
||||
"description": "Les nuits de Lune Écarlate, le Kitsune ouvre un passage vers une île qu’on ne voit jamais autrement. Une carte au trésor en garde la trace.",
|
||||
"coverCardId": "crimson-moon-kitsune",
|
||||
"themeTags": ["lieu:lune-ecarlate", "theme:passages"],
|
||||
"stats": ["orientation", "fortune", "bravoure", "endurance"],
|
||||
"conditions": [{ "type": "tag", "tag": "lieu:lune-ecarlate" }],
|
||||
"dangers": [
|
||||
{ "id": "closing-passage", "label": "Passage qui se referme", "stat": "orientation", "unlessTags": ["theme:passages", "personnage:kitsune"]},
|
||||
{ "id": "crimson-glare", "label": "Éclat de la Lune Écarlate", "stat": "endurance", "unlessTags": ["theme:nuit"]}
|
||||
],
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"id": "lost-observatory",
|
||||
"name": "L’Observatoire perdu",
|
||||
"description": "Le premier observatoire des Veilleurs, bâti autour de l’Écaille du Néant, dérive quelque part dans le vide. Une carte au trésor complète y mène.",
|
||||
"coverCardId": "observatory-key",
|
||||
"themeTags": ["theme:veilleurs", "lieu:vide"],
|
||||
"stats": ["bravoure", "orientation", "endurance", "fortune"],
|
||||
"conditions": [{ "type": "tag", "tag": "theme:veilleurs" }],
|
||||
"dangers": [
|
||||
{ "id": "drifting-island", "label": "Île à la dérive", "stat": "orientation", "unlessTags": ["theme:constellations"]},
|
||||
{ "id": "ancient-guardians", "label": "Gardiens anciens", "stat": "bravoure", "unlessTags": ["personnage:salamandre", "theme:veilleurs"]}
|
||||
],
|
||||
"hidden": true
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -352,6 +352,31 @@ const MIGRATIONS = [
|
|||
) STRICT;
|
||||
CREATE INDEX alert_outbox_pending_idx ON alert_outbox(sent_at, failed_at, created_at);
|
||||
ALTER TABLE expedition_members ADD COLUMN alerted_at INTEGER;
|
||||
`,
|
||||
// Objets des Expéditions : inventaire de chaque joueur, gravures posées sur ses équipements (une par commune) et destinations
|
||||
// bonus ajoutées à sa journée (5e, 6e, ou une destination cachée ouverte par une carte au trésor).
|
||||
`
|
||||
CREATE TABLE player_items (
|
||||
player_id TEXT NOT NULL REFERENCES players(id),
|
||||
item_id TEXT NOT NULL,
|
||||
quantity INTEGER NOT NULL CHECK (quantity >= 0),
|
||||
PRIMARY KEY (player_id, item_id)
|
||||
) STRICT;
|
||||
CREATE TABLE equipment_engravings (
|
||||
player_id TEXT NOT NULL REFERENCES players(id),
|
||||
edition_id TEXT NOT NULL,
|
||||
tag TEXT NOT NULL,
|
||||
engraved_at INTEGER NOT NULL,
|
||||
PRIMARY KEY (player_id, edition_id)
|
||||
) STRICT;
|
||||
CREATE TABLE player_bonus_destinations (
|
||||
player_id TEXT NOT NULL REFERENCES players(id),
|
||||
day TEXT NOT NULL,
|
||||
slot TEXT NOT NULL CHECK (slot IN ('5', '6', 'hidden')),
|
||||
destination_id TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
PRIMARY KEY (player_id, day, slot)
|
||||
) STRICT;
|
||||
`
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -16,23 +16,25 @@ export const equipmentMethods = {
|
|||
return map;
|
||||
},
|
||||
|
||||
// Une commune et ce qu'elle apporte comme équipement : ses stats et ses étiquettes.
|
||||
equipmentItem(editionId) {
|
||||
// Une commune et ce qu'elle apporte comme équipement : ses stats et ses étiquettes, plus celle gravée par le joueur (`engravings`).
|
||||
equipmentItem(editionId, engravings = null) {
|
||||
const edition = this.cards.index.editions.get(editionId);
|
||||
const card = edition && this.cards.index.cards.get(edition.cardId);
|
||||
return card?.expedition?.equipment ? { editionId, cardId: card.id, name: card.name, stats: card.expedition.equipment.stats, tags: card.expedition.tags } : null;
|
||||
if (!card?.expedition?.equipment) return null;
|
||||
const engraved = engravings?.get(editionId) ?? null;
|
||||
return { editionId, cardId: card.id, name: card.name, stats: card.expedition.equipment.stats, tags: engraved ? [...card.expedition.tags, engraved] : card.expedition.tags, engraved };
|
||||
},
|
||||
|
||||
// Une carte prête à partir : stats de sa Puissance, plus ses équipements (dans ses emplacements ouverts) et leurs synergies.
|
||||
loadout(editionId, level, equipped, settings) {
|
||||
loadout(editionId, level, equipped, settings, engravings = null) {
|
||||
const data = editionExpeditionData(this.cards.catalog, editionId, level, settings);
|
||||
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) })).filter((item) => item.stats);
|
||||
const items = (equipped || []).filter((item) => item.slot < slots).map((item) => ({ slot: item.slot, ...this.equipmentItem(item.equipmentEditionId, engravings) })).filter((item) => item.stats);
|
||||
const bonus = equipmentBonus(items, data.tags, settings);
|
||||
return {
|
||||
...data, baseStats: data.stats, stats: addStats(data.stats, bonus.stats), slots,
|
||||
equipment: items.map((item, index) => ({ slot: item.slot, editionId: item.editionId, cardId: item.cardId, name: item.name, stats: item.stats, synergyTag: bonus.pairs[index] }))
|
||||
equipment: items.map((item, index) => ({ slot: item.slot, editionId: item.editionId, cardId: item.cardId, name: item.name, stats: item.stats, engraved: item.engraved, synergyTag: bonus.pairs[index] }))
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -53,7 +55,7 @@ export const equipmentMethods = {
|
|||
this.db.prepare("DELETE FROM card_equipment WHERE player_id = ? AND edition_id = ? AND slot = ?").run(playerId, editionId, slot);
|
||||
return;
|
||||
}
|
||||
const item = this.equipmentItem(equipmentEditionId);
|
||||
const item = this.equipmentItem(equipmentEditionId, this.engravingsOf(playerId));
|
||||
if (!item) fail(400, "EQUIPMENT_INVALID", "Seules les communes servent d’équipement.");
|
||||
if (!owned.has(equipmentEditionId)) fail(404, "CARD_NOT_OWNED", "Vous ne possédez pas cette commune.");
|
||||
const elsewhere = this.db.prepare("SELECT edition_id FROM card_equipment WHERE player_id = ? AND equipment_edition_id = ?").get(playerId, equipmentEditionId);
|
||||
|
|
@ -86,9 +88,10 @@ export const equipmentMethods = {
|
|||
// Communes du joueur utilisables comme équipement, avec la carte qu'elles équipent.
|
||||
equipmentChoices(playerId) {
|
||||
const placed = new Map(this.db.prepare("SELECT equipment_edition_id, edition_id FROM card_equipment WHERE player_id = ?").all(playerId).map((row) => [row.equipment_edition_id, row.edition_id]));
|
||||
const engravings = this.engravingsOf(playerId);
|
||||
return this.cards.collectionOf(playerId).map((entry) => {
|
||||
const item = this.equipmentItem(entry.editionId);
|
||||
return item && { editionId: item.editionId, cardId: item.cardId, stats: item.stats, tags: item.tags, equippedOn: placed.get(item.editionId) ?? null };
|
||||
const item = this.equipmentItem(entry.editionId, engravings);
|
||||
return item && { editionId: item.editionId, cardId: item.cardId, stats: item.stats, tags: item.tags, engraved: item.engraved, equippedOn: placed.get(item.editionId) ?? null };
|
||||
}).filter(Boolean);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -55,8 +55,9 @@ export const groupMethods = {
|
|||
const card = this.ownedCard(playerId, body.editionId, settings);
|
||||
const slot = { ...card, role: body.role, position: 0 };
|
||||
const setup = this.groupSetup(resolved, stars, hours, settings);
|
||||
setup.bonusSlot = resolved.bonusSlot ?? null;
|
||||
const { evaluation, cohesion, synergy } = this.evaluateGroup(setup, [slot], settings);
|
||||
const expected = expectedLoot({ hours, stars, tier: evaluation.tier, fortune: evaluation.stats.fortune, slotCount: settings.group.slots, multiplierPct: groupLootPct(1, settings) }, settings);
|
||||
const expected = expectedLoot({ hours, stars, tier: evaluation.tier, fortune: evaluation.stats.fortune, slotCount: settings.group.slots, multiplierPct: groupLootPct(1, settings), bonusSlot: setup.bonusSlot }, settings);
|
||||
return { day, resolved, stars, durationIndex, hours, slot, setup, evaluation, cohesion, synergy, expected };
|
||||
},
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ export const groupMethods = {
|
|||
this.settleFormingInTx(settings);
|
||||
if (!settings.enabled) fail(409, "EXPEDITIONS_CLOSED", "Les Expéditions sont fermées pour le moment.");
|
||||
const day = dailyDayKey(this.now());
|
||||
const plan = this.prepareGroup(playerId, body, settings, { day, entries: this.ensureDay(day, settings) });
|
||||
const plan = this.prepareGroup(playerId, body, settings, { day, entries: this.playerEntries(playerId, day, settings) });
|
||||
if (plan.slot.busy) fail(409, "EXPEDITION_CARD_BUSY", "Cette carte est déjà en expédition.");
|
||||
if (this.activeCount(playerId, "group") >= settings.group.maxConcurrent) fail(409, "EXPEDITION_LIMIT", "Vous participez déjà au nombre maximal d’expéditions de groupe.");
|
||||
const now = this.now();
|
||||
|
|
@ -197,9 +198,9 @@ export const groupMethods = {
|
|||
const insertKeeper = this.db.prepare("INSERT INTO expedition_slots(expedition_id, position, role, player_id, edition_id, card_id, level, stats_json) VALUES (?, ?, NULL, NULL, NULL, NULL, 0, ?)");
|
||||
for (const position of free) insertKeeper.run(row.id, position, JSON.stringify(keeper.stats));
|
||||
const multiplierPct = groupLootPct(members.length, settings);
|
||||
const expected = expectedLoot({ hours: setup.hours, stars: setup.stars, tier: evaluation.tier, fortune: evaluation.stats.fortune, slotCount: setup.roles.length, multiplierPct }, settings);
|
||||
const expected = expectedLoot({ hours: setup.hours, stars: setup.stars, tier: evaluation.tier, fortune: evaluation.stats.fortune, slotCount: setup.roles.length, multiplierPct, bonusSlot: setup.bonusSlot ?? null }, settings);
|
||||
const updateReward = this.db.prepare("UPDATE expedition_members SET reward_json = ? WHERE expedition_id = ? AND player_id = ?");
|
||||
for (const member of members) updateReward.run(JSON.stringify(this.rollReward(expected, settings)), row.id, member.playerId);
|
||||
for (const member of members) updateReward.run(JSON.stringify(this.rollReward(expected, settings, evaluation.stats.orientation / setup.roles.length)), row.id, member.playerId);
|
||||
const result = this.resultView(evaluation, { players: members.length, cohesionPct: cohesion, lootPct: multiplierPct }, synergy);
|
||||
this.db.prepare("UPDATE expeditions SET status = 'running', departs_at = ?, returns_at = ?, result_json = ? WHERE id = ?")
|
||||
.run(at, at + setup.hours * HOUR_MS, JSON.stringify(result), row.id);
|
||||
|
|
|
|||
108
services/cards/expedition-items.js
Normal file
108
services/cards/expedition-items.js
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
// Rôle : objets des Expéditions Sokko TCG : inventaire, ancre (rappel), destinations bonus (étoile guide, carte céleste, carte au trésor)
|
||||
// et gravure d'une étiquette sur un équipement. Ces méthodes s'ajoutent à ExpeditionService (Object.assign sur son prototype).
|
||||
import { dailyDayKey } from "./daily.js";
|
||||
import { ITEM_IDS } from "./expedition-rules.js";
|
||||
|
||||
function fail(status, code, message) {
|
||||
throw Object.assign(new Error(message), { status, code });
|
||||
}
|
||||
|
||||
// Objet consommé pour chaque destination bonus, et place de la destination dans la journée du joueur.
|
||||
const BONUS_ITEMS = Object.freeze({ guideStar: "5", skyChart: "6", fragment: "hidden" });
|
||||
|
||||
export const itemMethods = {
|
||||
itemsOf(playerId) {
|
||||
const items = Object.fromEntries(ITEM_IDS.map((id) => [id, 0]));
|
||||
for (const row of this.db.prepare("SELECT item_id, quantity FROM player_items WHERE player_id = ?").all(playerId)) items[row.item_id] = row.quantity;
|
||||
return items;
|
||||
},
|
||||
|
||||
addItemsInTx(playerId, itemIds) {
|
||||
const add = this.db.prepare(`INSERT INTO player_items(player_id, item_id, quantity) VALUES (?, ?, 1)
|
||||
ON CONFLICT(player_id, item_id) DO UPDATE SET quantity = quantity + 1`);
|
||||
for (const itemId of itemIds) add.run(playerId, itemId);
|
||||
},
|
||||
|
||||
consumeItemInTx(playerId, itemId, count = 1) {
|
||||
const used = this.db.prepare("UPDATE player_items SET quantity = quantity - ? WHERE player_id = ? AND item_id = ? AND quantity >= ?").run(count, playerId, itemId, count);
|
||||
if (!used.changes) fail(409, "NOT_ENOUGH_ITEMS", "Vous n’avez pas assez de cet objet.");
|
||||
},
|
||||
|
||||
// Destinations bonus du joueur pour un jour : 5e, 6e ou cachée, avec leur première condition et leurs deux premiers dangers.
|
||||
bonusEntries(playerId, day) {
|
||||
return this.db.prepare("SELECT slot, destination_id FROM player_bonus_destinations WHERE player_id = ? AND day = ? ORDER BY slot").all(playerId, day).map((row) => {
|
||||
const destination = this.destinations.find((item) => item.id === row.destination_id);
|
||||
return destination && { destination, entry: { condition: destination.conditions[0], dangers: destination.dangers.slice(0, 2) }, bonusSlot: row.slot };
|
||||
}).filter(Boolean);
|
||||
},
|
||||
|
||||
// Destinations jouables du joueur : celles du jour, puis ses destinations bonus. À appeler dans une transaction.
|
||||
playerEntries(playerId, day, settings) {
|
||||
return [...this.ensureDay(day, settings), ...this.bonusEntries(playerId, day)];
|
||||
},
|
||||
|
||||
// Ajoute une destination bonus à la journée du joueur, en consommant l'objet correspondant (4 fragments pour une carte au trésor).
|
||||
addBonusDestination(playerId, { item } = {}) {
|
||||
const settings = this.settings;
|
||||
const slot = BONUS_ITEMS[item];
|
||||
if (!slot) fail(400, "ITEM_INVALID", "Cet objet n’ouvre pas de destination.");
|
||||
this.cards.database.transaction(() => {
|
||||
if (!settings.enabled) fail(409, "EXPEDITIONS_CLOSED", "Les Expéditions sont fermées pour le moment.");
|
||||
const day = dailyDayKey(this.now());
|
||||
const taken = this.playerEntries(playerId, day, settings);
|
||||
if (taken.some((entry) => entry.bonusSlot === slot)) fail(409, "BONUS_ALREADY_USED", "Vous avez déjà ajouté cette destination aujourd’hui.");
|
||||
const takenIds = new Set(taken.map((entry) => entry.destination.id));
|
||||
const pool = this.destinations.filter((destination) => (slot === "hidden" ? destination.hidden : !destination.hidden && settings.destinations[destination.id]?.active !== false) && !takenIds.has(destination.id));
|
||||
if (!pool.length) fail(409, "BONUS_UNAVAILABLE", "Aucune autre destination n’est disponible aujourd’hui.");
|
||||
this.consumeItemInTx(playerId, item, item === "fragment" ? settings.items.fragmentsForMap : 1);
|
||||
const destination = pool[this.random(pool.length)];
|
||||
this.db.prepare("INSERT INTO player_bonus_destinations(player_id, day, slot, destination_id, created_at) VALUES (?, ?, ?, ?, ?)").run(playerId, day, slot, destination.id, this.now());
|
||||
this.cards.audit(playerId, "item_used", item, { item, destinationId: destination.id, destinationName: destination.name });
|
||||
});
|
||||
return { expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||||
},
|
||||
|
||||
// Ancre : une expédition solo en route revient tout de suite, avec la part de butin déjà gagnée (Éclats et poussière au prorata).
|
||||
recallExpedition(playerId, expeditionId) {
|
||||
this.cards.database.transaction(() => {
|
||||
const row = this.db.prepare(`SELECT e.*, m.reward_json FROM expeditions e JOIN expedition_members m ON m.expedition_id = e.id AND m.player_id = ?
|
||||
WHERE e.id = ? AND m.claimed_at IS NULL`).get(playerId, expeditionId);
|
||||
if (!row || row.status !== "running") fail(404, "EXPEDITION_NOT_FOUND", "Cette expédition n’est pas en route.");
|
||||
if (row.mode !== "solo") fail(409, "RECALL_SOLO_ONLY", "Seule une expédition solo peut être rappelée.");
|
||||
const now = this.now();
|
||||
if (row.returns_at <= now) fail(409, "EXPEDITION_RETURNED", "Cette expédition est déjà rentrée.");
|
||||
this.consumeItemInTx(playerId, "anchor");
|
||||
const share = Math.max(0, Math.min(1, (now - row.departs_at) / (row.returns_at - row.departs_at)));
|
||||
const reward = JSON.parse(row.reward_json);
|
||||
const kept = { eclats: Math.floor(reward.eclats * share), stardust: Math.floor(reward.stardust * share), packs: [], items: [], recalledPct: Math.round(share * 100) };
|
||||
this.db.prepare("UPDATE expedition_members SET reward_json = ? WHERE expedition_id = ? AND player_id = ?").run(JSON.stringify(kept), row.id, playerId);
|
||||
this.db.prepare("UPDATE expeditions SET returns_at = ? WHERE id = ?").run(now, row.id);
|
||||
const setup = JSON.parse(row.setup_json);
|
||||
this.cards.audit(playerId, "item_used", "anchor", { item: "anchor", destinationId: setup.destination.id, destinationName: setup.destination.name, recalledPct: kept.recalledPct });
|
||||
});
|
||||
return { expedition: this.expeditionView(expeditionId, playerId), expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||||
},
|
||||
|
||||
engravingsOf(playerId) {
|
||||
return new Map(this.db.prepare("SELECT edition_id, tag FROM equipment_engravings WHERE player_id = ?").all(playerId).map((row) => [row.edition_id, row.tag]));
|
||||
},
|
||||
|
||||
// Burin : grave une étiquette du vocabulaire sur une commune, une seule fois, pour créer la synergie qu'on veut.
|
||||
engrave(playerId, { editionId, tag } = {}) {
|
||||
this.cards.database.transaction(() => {
|
||||
const item = this.equipmentItem(editionId);
|
||||
if (!item) fail(400, "EQUIPMENT_INVALID", "Seules les communes se gravent.");
|
||||
if (!this.cards.quantityOf(playerId, editionId)) fail(404, "CARD_NOT_OWNED", "Vous ne possédez pas cette commune.");
|
||||
if (!this.cards.catalog.expeditionTags.some((entry) => entry.id === tag) || item.tags.includes(tag)) fail(400, "ENGRAVING_INVALID", "Choisissez une étiquette que cette commune ne porte pas encore.");
|
||||
if (this.db.prepare("SELECT 1 FROM equipment_engravings WHERE player_id = ? AND edition_id = ?").get(playerId, editionId)) fail(409, "ENGRAVING_EXISTS", "Cette commune est déjà gravée.");
|
||||
this.consumeItemInTx(playerId, "engraving");
|
||||
this.db.prepare("INSERT INTO equipment_engravings(player_id, edition_id, tag, engraved_at) VALUES (?, ?, ?, ?)").run(playerId, editionId, tag, this.now());
|
||||
this.cards.audit(playerId, "item_used", "engraving", { item: "engraving", editionId, tag });
|
||||
});
|
||||
return this.cards.getState(playerId);
|
||||
},
|
||||
|
||||
forgetItemsInTx(playerId) {
|
||||
for (const table of ["player_items", "equipment_engravings", "player_bonus_destinations"]) this.db.prepare(`DELETE FROM ${table} WHERE player_id = ?`).run(playerId);
|
||||
}
|
||||
};
|
||||
|
|
@ -30,9 +30,10 @@ export const progressMethods = {
|
|||
cardProgressView(playerId, settings = this.settings) {
|
||||
const levels = this.levelsOf(playerId);
|
||||
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);
|
||||
const data = this.loadout(entry.editionId, progress.level, 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,
|
||||
|
|
|
|||
|
|
@ -187,16 +187,25 @@ export function evaluateTeam(input, settings) {
|
|||
}
|
||||
|
||||
// Butin espéré (valeurs fractionnaires) : il est proportionnel à la durée choisie, donc identique par heure.
|
||||
// Multiplicateur de butin d'une destination bonus : 5e, 6e, ou destination cachée ouverte par une carte au trésor.
|
||||
export function bonusLootPct(bonusSlot, settings) {
|
||||
if (bonusSlot === "5" || bonusSlot === 5) return settings.loot.bonusSlotPct[0];
|
||||
if (bonusSlot === "6" || bonusSlot === 6) return settings.loot.bonusSlotPct[1];
|
||||
if (bonusSlot === "hidden") return settings.items.hiddenLootPct;
|
||||
return 100;
|
||||
}
|
||||
|
||||
// `multiplierPct` : multiplicateur propre au joueur (butin de groupe selon le nombre de joueurs).
|
||||
export function expectedLoot({ hours, stars, tier, fortune, slotCount, bonusSlot = null, multiplierPct = 100 }, settings) {
|
||||
const { loot } = settings;
|
||||
const bonus = (bonusSlot ? loot.bonusSlotPct[bonusSlot - 5] / 100 : 1) * (multiplierPct / 100);
|
||||
const bonus = (bonusLootPct(bonusSlot, settings) / 100) * (multiplierPct / 100);
|
||||
const base = hours * (loot.difficultyPct[stars - 1] / 100) * (loot.tierPct[TIER_IDS.indexOf(tier)] / 100) * bonus;
|
||||
const fortuneBonusPct = Math.min(loot.fortuneCapPct, (fortune / Math.max(1, slotCount)) * loot.fortunePerPointPct);
|
||||
return {
|
||||
eclats: base * (loot.eclatsPerHourCents / 100),
|
||||
stardust: base * (loot.stardustPerHourCents / 100),
|
||||
packs: Math.min(loot.maxPacks, base * (loot.packPerHourPermille / 1000) * (1 + fortuneBonusPct / 100)),
|
||||
objects: Math.min(settings.items.maxPerExpedition, base * (settings.items.chancePerHourPermille / 1000)),
|
||||
fortuneBonusPct
|
||||
};
|
||||
}
|
||||
|
|
@ -367,3 +376,21 @@ export function teamSynergy({ destination, slots, cohesionPct: cohesion = 0 }, s
|
|||
const totalPct = (affinity ? settings.synergy.affinityPct : 0) + resonances.length * settings.synergy.resonancePct + cohesion;
|
||||
return { affinity, resonances, cohesionPct: cohesion, totalPct: Math.min(settings.score.synergyCapPct, totalPct) };
|
||||
}
|
||||
|
||||
export const ITEM_IDS = Object.freeze(["fragment", "engraving", "plan", "anchor", "guideStar", "skyChart"]);
|
||||
// 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"]);
|
||||
|
||||
// Objets rapportés : tirés selon leur poids parmi ceux permis (`excluded` : objets indisponibles, comme le plan sans atelier).
|
||||
export function pickItems(count, { orientationPerSlot, excluded = [] }, settings, random) {
|
||||
const open = orientationPerSlot >= settings.items.orientationPerSlot;
|
||||
const pool = ITEM_IDS.filter((id) => !excluded.includes(id) && (open || !HIDDEN_ITEMS.includes(id)))
|
||||
.map((id) => ({ id, weight: settings.items.weights[id] })).filter((entry) => entry.weight > 0);
|
||||
const total = pool.reduce((sum, entry) => sum + entry.weight, 0);
|
||||
const items = [];
|
||||
for (let index = 0; index < count && total > 0; index += 1) {
|
||||
let cursor = random(total);
|
||||
items.push((pool.find((entry) => (cursor -= entry.weight) < 0) || pool.at(-1)).id);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { randomInt, randomUUID } from "node:crypto";
|
|||
import { dailyDayKey, nextDailyAt, shiftDayKey } from "./daily.js";
|
||||
import {
|
||||
dangerCount, drawExpeditionDay, editionExpeditionData, evaluateTeam, expectedLoot, hasCondition, MAX_STARS, requirementsFor, resolveDayEntry,
|
||||
ROLE_BY_STAT, rollLoot, soloRoles, STAT_BY_ROLE, teamSynergy
|
||||
pickItems, ROLE_BY_STAT, rollLoot, roundStochastic, soloRoles, STAT_BY_ROLE, teamSynergy
|
||||
} from "./expedition-rules.js";
|
||||
import {
|
||||
DEFAULT_EXPEDITION_SETTINGS, diffExpeditionSettings, EXPEDITION_SETTINGS_SCHEMA, mergeExpeditionSettings, validateExpeditionSettings
|
||||
|
|
@ -13,6 +13,7 @@ import { groupMethods } from "./expedition-group.js";
|
|||
import { progressMethods } from "./expedition-progress.js";
|
||||
import { equipmentMethods } from "./expedition-equipment.js";
|
||||
import { alertMethods } from "./expedition-alerts.js";
|
||||
import { itemMethods } from "./expedition-items.js";
|
||||
|
||||
const HOUR_MS = 3_600_000;
|
||||
|
||||
|
|
@ -92,9 +93,10 @@ export class ExpeditionService {
|
|||
return JSON.parse(stored().draw_json).map((draw) => resolveDayEntry(this.destinations, draw)).filter(Boolean);
|
||||
}
|
||||
|
||||
today(settings) {
|
||||
// Destinations du jour ; avec `playerId`, ses destinations bonus en plus.
|
||||
today(settings, playerId = null) {
|
||||
const day = dailyDayKey(this.now());
|
||||
return { day, entries: this.cards.database.transaction(() => this.ensureDay(day, settings)) };
|
||||
return { day, entries: this.cards.database.transaction(() => (playerId ? this.playerEntries(playerId, day, settings) : this.ensureDay(day, settings))) };
|
||||
}
|
||||
|
||||
// Éditions occupées : celles d'un groupe en formation ou d'une expédition en route dont le butin n'a pas encore été récupéré.
|
||||
|
|
@ -112,8 +114,9 @@ export class ExpeditionService {
|
|||
const busy = this.busyEditions(playerId);
|
||||
const levels = this.levelsOf(playerId);
|
||||
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);
|
||||
const data = this.loadout(entry.editionId, levels.get(entry.editionId)?.level ?? 0, 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 };
|
||||
|
|
@ -135,11 +138,11 @@ export class ExpeditionService {
|
|||
}
|
||||
|
||||
// Destination du jour vue par le joueur : rôles et exigences chiffrées du solo, puis du groupe complet (un rôle par place).
|
||||
destinationView({ destination, entry }, settings) {
|
||||
destinationView({ destination, entry, bonusSlot = null }, settings) {
|
||||
const roles = soloRoles(destination, settings.solo.cards);
|
||||
const groupRoles = destination.stats.slice(0, settings.group.slots);
|
||||
return {
|
||||
id: destination.id, name: destination.name, description: destination.description, coverCardId: destination.coverCardId ?? null, stats: destination.stats,
|
||||
id: destination.id, name: destination.name, description: destination.description, coverCardId: destination.coverCardId ?? null, stats: destination.stats, bonusSlot,
|
||||
roles, stars: this.starOptions(destination, entry, roles, settings.solo.minStars, settings.solo.maxStars, settings),
|
||||
groupRoles, groupStars: this.starOptions(destination, entry, groupRoles, settings.group.minStars, settings.group.maxStars, settings)
|
||||
};
|
||||
|
|
@ -168,15 +171,22 @@ export class ExpeditionService {
|
|||
return card;
|
||||
}
|
||||
|
||||
// Butin tiré au départ : arrondi au hasard, puis collection de chaque paquet.
|
||||
rollReward(expected, settings) {
|
||||
const loot = rollLoot(expected, settings, (max) => this.random(max));
|
||||
// Butin tiré au départ : arrondi au hasard, collection de chaque paquet, puis objets (la partie cachée demande de l'Orientation).
|
||||
rollReward(expected, settings, orientationPerSlot = 0) {
|
||||
const random = (max) => this.random(max);
|
||||
const loot = rollLoot(expected, settings, random);
|
||||
const packs = [];
|
||||
for (let index = 0; index < loot.packs; index += 1) {
|
||||
const collectionId = this.packCollection();
|
||||
if (collectionId) packs.push(collectionId);
|
||||
}
|
||||
return { eclats: loot.eclats, stardust: loot.stardust, packs };
|
||||
const items = pickItems(roundStochastic(expected.objects, random), { orientationPerSlot, excluded: this.excludedItems() }, settings, random);
|
||||
return { eclats: loot.eclats, stardust: loot.stardust, packs, items };
|
||||
}
|
||||
|
||||
// Objets qui ne peuvent pas encore être rapportés : le plan d'atelier attend des communes de pouvoir illustrées.
|
||||
excludedItems() {
|
||||
return this.atelierAvailable?.() ? [] : ["plan"];
|
||||
}
|
||||
|
||||
// Valide une équipe solo et calcule son résultat (sans écriture) : base commune de l'aperçu et du départ.
|
||||
|
|
@ -194,7 +204,7 @@ export class ExpeditionService {
|
|||
if (new Set(slots.map((slot) => slot.cardId)).size !== slots.length) fail(400, "EXPEDITION_CARD_INVALID", "Une même carte ne peut occuper qu’une place.");
|
||||
const synergy = teamSynergy({ destination: resolved.destination, slots }, settings);
|
||||
const evaluation = evaluateTeam({ destination: resolved.destination, entry: resolved.entry, stars, durationIndex, slots, synergyPct: synergy.totalPct }, settings);
|
||||
const expected = expectedLoot({ hours, stars, tier: evaluation.tier, fortune: evaluation.stats.fortune, slotCount: slots.length }, settings);
|
||||
const expected = expectedLoot({ hours, stars, tier: evaluation.tier, fortune: evaluation.stats.fortune, slotCount: slots.length, bonusSlot: resolved.bonusSlot ?? null }, settings);
|
||||
return { day, resolved, stars, durationIndex, hours, slots, synergy, evaluation, expected };
|
||||
}
|
||||
|
||||
|
|
@ -224,7 +234,8 @@ export class ExpeditionService {
|
|||
preview(playerId, body) {
|
||||
const settings = this.settings;
|
||||
if (!settings.enabled) fail(409, "EXPEDITIONS_CLOSED", "Les Expéditions sont fermées pour le moment.");
|
||||
const plan = body?.mode === "group" ? this.prepareGroup(playerId, body, settings, this.today(settings)) : this.prepareSolo(playerId, body, settings, this.today(settings));
|
||||
const today = this.today(settings, playerId);
|
||||
const plan = body?.mode === "group" ? this.prepareGroup(playerId, body, settings, today) : this.prepareSolo(playerId, body, settings, today);
|
||||
return { preview: { ...this.resultView(plan.evaluation, plan.cohesion != null ? { cohesionPct: plan.cohesion } : {}, plan.synergy), expected: this.expectedView(plan.expected) } };
|
||||
}
|
||||
|
||||
|
|
@ -246,19 +257,19 @@ export class ExpeditionService {
|
|||
}
|
||||
if (!settings.enabled) fail(409, "EXPEDITIONS_CLOSED", "Les Expéditions sont fermées pour le moment.");
|
||||
const day = dailyDayKey(this.now());
|
||||
const plan = this.prepareSolo(playerId, body, settings, { day, entries: this.ensureDay(day, settings) });
|
||||
const plan = this.prepareSolo(playerId, body, settings, { day, entries: this.playerEntries(playerId, day, settings) });
|
||||
const busy = plan.slots.find((slot) => slot.busy);
|
||||
if (busy) fail(409, "EXPEDITION_CARD_BUSY", "Cette carte est déjà en expédition.");
|
||||
if (this.activeCount(playerId, "solo") >= settings.solo.maxConcurrent) fail(409, "EXPEDITION_LIMIT", "Récupérez d’abord le butin de votre expédition en cours.");
|
||||
const now = this.now();
|
||||
const reward = this.rollReward(plan.expected, settings);
|
||||
const reward = this.rollReward(plan.expected, settings, plan.evaluation.stats.orientation / plan.slots.length);
|
||||
const { destination } = plan.resolved;
|
||||
const setup = {
|
||||
destination: { id: destination.id, name: destination.name, description: destination.description, coverCardId: destination.coverCardId ?? null, stats: destination.stats },
|
||||
condition: plan.evaluation.condition,
|
||||
stars: plan.stars,
|
||||
hours: plan.hours,
|
||||
bonusSlot: null,
|
||||
bonusSlot: plan.resolved.bonusSlot ?? null,
|
||||
roles: plan.slots.map((slot) => slot.role)
|
||||
};
|
||||
expeditionId = randomUUID();
|
||||
|
|
@ -326,11 +337,13 @@ export class ExpeditionService {
|
|||
},
|
||||
expeditions: this.playerExpeditionIds(playerId).map((id) => this.expeditionView(id, playerId)),
|
||||
groups: this.boardView(playerId, settings),
|
||||
grimoire: this.grimoireOf(playerId)
|
||||
grimoire: this.grimoireOf(playerId),
|
||||
items: this.itemsOf(playerId),
|
||||
fragmentsForMap: settings.items.fragmentsForMap
|
||||
};
|
||||
// Fermées : le joueur peut encore récupérer le butin de ses expéditions, mais aucune destination n'est tirée.
|
||||
if (!settings.enabled) return { ...base, day: dailyDayKey(now), destinations: [], cards: [] };
|
||||
const { day, entries } = this.today(settings);
|
||||
const { day, entries } = this.today(settings, playerId);
|
||||
return { ...base, day, destinations: entries.map((entry) => this.destinationView(entry, settings)), cards: this.eligibleCards(playerId, settings) };
|
||||
}
|
||||
|
||||
|
|
@ -349,6 +362,7 @@ export class ExpeditionService {
|
|||
this.db.prepare("UPDATE players SET eclats = eclats + ?, stardust = stardust + ? WHERE id = ?").run(reward.eclats, reward.stardust, playerId);
|
||||
const insertPack = this.db.prepare("INSERT INTO gift_packs(id, player_id, source, expedition_id, collection_id, options_json, created_at) VALUES (?, ?, 'expedition', ?, ?, ?, ?)");
|
||||
for (const collectionId of reward.packs) insertPack.run(randomUUID(), playerId, row.id, collectionId, JSON.stringify({ rarityWeights: null, guarantee: null }), now);
|
||||
this.addItemsInTx(playerId, reward.items || []);
|
||||
this.db.prepare("UPDATE expedition_members SET claimed_at = ? WHERE expedition_id = ? AND player_id = ?").run(now, row.id, playerId);
|
||||
const waiting = this.db.prepare("SELECT COUNT(*) AS count FROM expedition_members WHERE expedition_id = ? AND claimed_at IS NULL").get(row.id).count;
|
||||
if (!waiting) this.db.prepare("UPDATE expeditions SET status = 'completed', completed_at = ? WHERE id = ?").run(now, row.id);
|
||||
|
|
@ -356,7 +370,7 @@ export class ExpeditionService {
|
|||
this.gainFieldXpInTx(playerId, editionIds, this.settings);
|
||||
this.cards.audit(playerId, "expedition_completed", row.id, {
|
||||
destinationId: setup.destination.id, destinationName: setup.destination.name, difficulty: row.difficulty, hours: setup.hours,
|
||||
mode: row.mode, players: result.players ?? 1, tier: result.tier, scorePct: result.scorePct, eclats: reward.eclats, stardust: reward.stardust, packs: reward.packs.length, editionIds
|
||||
mode: row.mode, players: result.players ?? 1, tier: result.tier, scorePct: result.scorePct, eclats: reward.eclats, stardust: reward.stardust, packs: reward.packs.length, items: reward.items || [], editionIds
|
||||
});
|
||||
});
|
||||
return { expedition: this.expeditionView(expeditionId, playerId), expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||||
|
|
@ -445,4 +459,5 @@ export class ExpeditionService {
|
|||
// Améliorations : niveaux, expérience de terrain et pont depuis la poussière (expedition-progress.js).
|
||||
// Équipements et Grimoire (expedition-equipment.js).
|
||||
// Alertes Discord (expedition-alerts.js).
|
||||
Object.assign(ExpeditionService.prototype, groupMethods, progressMethods, equipmentMethods, alertMethods);
|
||||
// Objets (expedition-items.js).
|
||||
Object.assign(ExpeditionService.prototype, groupMethods, progressMethods, equipmentMethods, alertMethods, itemMethods);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ export const DEFAULT_EXPEDITION_SETTINGS = Object.freeze({
|
|||
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.
|
||||
synergy: { affinityPct: 10, resonancePct: 10, maxResonances: 2, sistersCount: 2 },
|
||||
// Objets : chance par heure d'en rapporter un (‰, multipliée comme le butin), au plus par expédition, Orientation moyenne par place
|
||||
// qui ouvre la partie cachée (fragments, burins, plans), fragments pour une carte au trésor, butin des destinations cachées et poids de tirage.
|
||||
items: {
|
||||
chancePerHourPermille: 50, maxPerExpedition: 2, orientationPerSlot: 15, fragmentsForMap: 4, hiddenLootPct: 150,
|
||||
weights: { fragment: 30, engraving: 10, plan: 10, anchor: 15, guideStar: 20, skyChart: 5 }
|
||||
},
|
||||
// Exigence d'une stat, par place, pour chaque nombre d'étoiles : stat principale, puis seconde, troisième et quatrième.
|
||||
requirements: { star1: [9], star2: [11, 10], star3: [15, 14, 11], star4: [19, 18, 14], star5: [22, 21, 17, 14], conditionMissPct: 25 },
|
||||
danger: { malusPct: 20, shieldMaxPct: 50, endurancePerSlot: 14 },
|
||||
|
|
@ -88,6 +94,17 @@ export const EXPEDITION_SETTINGS_SCHEMA = Object.freeze([
|
|||
int("synergy.resonancePct", 0, 100),
|
||||
int("synergy.maxResonances", 0, 3),
|
||||
int("synergy.sistersCount", 2, 4),
|
||||
int("items.chancePerHourPermille", 0, 1000),
|
||||
int("items.maxPerExpedition", 0, 5),
|
||||
int("items.orientationPerSlot", 0, 1000),
|
||||
int("items.fragmentsForMap", 1, 20),
|
||||
int("items.hiddenLootPct", 0, 1000),
|
||||
int("items.weights.fragment", 0, 100),
|
||||
int("items.weights.engraving", 0, 100),
|
||||
int("items.weights.plan", 0, 100),
|
||||
int("items.weights.anchor", 0, 100),
|
||||
int("items.weights.guideStar", 0, 100),
|
||||
int("items.weights.skyChart", 0, 100),
|
||||
ints("requirements.star1", 1, 1, 1000),
|
||||
ints("requirements.star2", 2, 1, 1000),
|
||||
ints("requirements.star3", 3, 1, 1000),
|
||||
|
|
|
|||
|
|
@ -37,7 +37,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"
|
||||
"gift_created", "gift_joined", "gift_completed", "gift_cancelled", "daily_won", "expedition_completed", "expedition_cancelled_by_guild", "expedition_dissolved", "card_upgraded", "eclats_converted", "item_used"
|
||||
]);
|
||||
const DEV_STARDUST = 1000;
|
||||
const DELETED_PLAYER_NAME = "Joueur supprimé";
|
||||
|
|
@ -479,6 +479,7 @@ export class CardsService {
|
|||
cardProgress: this.expeditions.cardProgressView(playerId),
|
||||
equipment: this.expeditions.equipmentChoices(playerId),
|
||||
alerts: this.expeditions.alertPreferences(playerId),
|
||||
items: this.expeditions.itemsOf(playerId),
|
||||
recycling: { count: recycling.count, stardust: recycling.stardust },
|
||||
pendingOpening: pending ? this.openingById(pending.id, playerId) : null,
|
||||
rarestPull: this.rarestPull(playerId), stats: { openingsCount },
|
||||
|
|
@ -881,6 +882,7 @@ export class CardsService {
|
|||
this.db.prepare("UPDATE openings SET status = 'completed', completed_at = ? WHERE player_id = ? AND status = 'pending'").run(this.now(), playerId);
|
||||
this.expeditions.forgetPlayer(playerId);
|
||||
this.expeditions.forgetAlertsInTx(playerId);
|
||||
this.expeditions.forgetItemsInTx(playerId);
|
||||
for (const table of ["sessions", "collection_cards", "favorites", "idempotency", "daily_attempts", "card_progress", "card_equipment", "grimoire_entries"]) this.db.prepare(`DELETE FROM ${table} WHERE player_id = ?`).run(playerId);
|
||||
this.db.prepare("DELETE FROM gift_packs WHERE player_id = ? AND opening_id IS NULL").run(playerId);
|
||||
this.db.prepare(`UPDATE players SET discord_id = ?, display_name = ?, avatar_url = '', is_admin = 0, openings_balance = 0, recharge_anchor = NULL, stardust = 0, purchased_openings = 0, eclats = 0, deleted_at = ? WHERE id = ?`)
|
||||
|
|
|
|||
|
|
@ -255,6 +255,30 @@ export function validateSiteContent(site) {
|
|||
"cards.guild.expeditionsClaim",
|
||||
"cards.guild.expeditionsOpen",
|
||||
"cards.packs.giftFromExpedition",
|
||||
"cards.expeditions.bagTitle",
|
||||
"cards.expeditions.bagEmpty",
|
||||
"cards.expeditions.items.fragment",
|
||||
"cards.expeditions.items.engraving",
|
||||
"cards.expeditions.items.plan",
|
||||
"cards.expeditions.items.anchor",
|
||||
"cards.expeditions.items.guideStar",
|
||||
"cards.expeditions.items.skyChart",
|
||||
"cards.expeditions.itemHelp.fragment",
|
||||
"cards.expeditions.itemHelp.engraving",
|
||||
"cards.expeditions.itemHelp.plan",
|
||||
"cards.expeditions.itemHelp.anchor",
|
||||
"cards.expeditions.itemHelp.guideStar",
|
||||
"cards.expeditions.itemHelp.skyChart",
|
||||
"cards.expeditions.useGuideStar",
|
||||
"cards.expeditions.useSkyChart",
|
||||
"cards.expeditions.useFragments",
|
||||
"cards.expeditions.bonusAdded",
|
||||
"cards.expeditions.bonusSlots.5",
|
||||
"cards.expeditions.bonusSlots.6",
|
||||
"cards.expeditions.bonusSlots.hidden",
|
||||
"cards.expeditions.recall",
|
||||
"cards.expeditions.recalled",
|
||||
"cards.expeditions.recalledShare",
|
||||
"cards.account.alertsTitle",
|
||||
"cards.account.alertsText",
|
||||
"cards.account.alertsGroupOpened",
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ test("administrators tune settings with bounds and history, and can cancel an ex
|
|||
assert.ok(service.getAdminHistory(admin.id).entries.some((entry) => entry.type === "expedition_settings_updated"));
|
||||
const dashboard = service.getAdminDashboard(admin.id);
|
||||
assert.equal(dashboard.expeditionSettings.settings.enabled, true);
|
||||
assert.equal(dashboard.expeditionSettings.destinations.length, 12);
|
||||
assert.equal(dashboard.expeditionSettings.destinations.length, 14);
|
||||
assert.ok(dashboard.expeditionSettings.schema.some((field) => field.path === "loot.eclatsPerHourCents"));
|
||||
|
||||
const view = service.expeditions.getExpeditions(player.id);
|
||||
|
|
@ -624,3 +624,65 @@ test("the alerts API saves a player's choices, and the server dispatches queued
|
|||
await handler.runAlerts();
|
||||
assert.deepEqual(delivered, [{ discordId: "123456789012345678", content: "Un groupe vous attend." }]);
|
||||
});
|
||||
|
||||
test("objects add bonus destinations, recall an expedition with an anchor and engrave equipment", () => {
|
||||
const { clock, service, player, open, rares, database } = expeditionService();
|
||||
open();
|
||||
const give = (items) => database.transaction(() => service.expeditions.addItemsInTx(player.id, items));
|
||||
// Étoile guide : une 5e destination, pour ce joueur seulement ; une seule par jour.
|
||||
give(["guideStar", "guideStar", "anchor", "engraving", "fragment", "fragment", "fragment", "fragment"]);
|
||||
const before = service.expeditions.getExpeditions(player.id);
|
||||
assert.equal(before.items.guideStar, 2);
|
||||
const added = service.expeditions.addBonusDestination(player.id, { item: "guideStar" }).expeditions;
|
||||
assert.equal(added.destinations.length, 5);
|
||||
const bonus = added.destinations.find((destination) => destination.bonusSlot === "5");
|
||||
assert.ok(!before.destinations.some((destination) => destination.id === bonus.id));
|
||||
assert.throws(() => service.expeditions.addBonusDestination(player.id, { item: "guideStar" }), (error) => error.code === "BONUS_ALREADY_USED");
|
||||
assert.throws(() => service.expeditions.addBonusDestination(player.id, { item: "skyChart" }), (error) => error.code === "NOT_ENOUGH_ITEMS");
|
||||
assert.throws(() => service.expeditions.addBonusDestination(player.id, { item: "anchor" }), (error) => error.code === "ITEM_INVALID");
|
||||
// Carte au trésor : 4 fragments ouvrent une destination cachée, au butin multiplié.
|
||||
const hidden = service.expeditions.addBonusDestination(player.id, { item: "fragment" }).expeditions.destinations.find((destination) => destination.bonusSlot === "hidden");
|
||||
assert.ok(["crimson-passage", "lost-observatory"].includes(hidden.id));
|
||||
assert.equal(service.expeditions.getExpeditions(player.id).items.fragment, 0);
|
||||
assert.deepEqual(service.expeditions.getExpeditions(service.upsertPlayer({ discordId: "other", displayName: "Other" }).id).destinations.map((destination) => destination.id), before.destinations.map((destination) => destination.id));
|
||||
|
||||
// Ancre : rappel à mi-chemin, la moitié des Éclats et de la poussière, sans paquet ni objet.
|
||||
const view = service.expeditions.getExpeditions(player.id);
|
||||
const started = service.expeditions.startSolo(player.id, soloBody(view, rares.slice(0, 2), { destinationId: hidden.id, durationHours: 12 }), "hidden-trip");
|
||||
assert.equal(started.expedition.destination.id, hidden.id);
|
||||
clock.now += 6 * HOUR;
|
||||
const recalled = service.expeditions.recallExpedition(player.id, started.expedition.id);
|
||||
assert.equal(recalled.expedition.status, "returned");
|
||||
assert.equal(recalled.expedition.reward.recalledPct, 50);
|
||||
assert.deepEqual([recalled.expedition.reward.packs, recalled.expedition.reward.items], [[], []]);
|
||||
assert.throws(() => service.expeditions.recallExpedition(player.id, started.expedition.id), (error) => error.code === "EXPEDITION_RETURNED");
|
||||
service.expeditions.claim(player.id, started.expedition.id);
|
||||
|
||||
// Burin : une étiquette gravée crée la synergie avec la carte équipée.
|
||||
const tagsOf = (editionId) => service.catalog.cards.find((item) => item.id === service.index.editions.get(editionId).cardId).expedition.tags;
|
||||
const stranger = editionsOf("common").find((editionId) => !tagsOf(editionId).some((tag) => tagsOf(rares[0]).includes(tag)));
|
||||
database.transaction(() => service.addCard(player.id, stranger));
|
||||
service.expeditions.equip(player.id, { editionId: rares[0], slot: 0, equipmentEditionId: stranger });
|
||||
assert.equal(service.getState(player.id).cardProgress.find((item) => item.editionId === rares[0]).equipment[0].synergyTag, null);
|
||||
assert.throws(() => service.expeditions.engrave(player.id, { editionId: stranger, tag: tagsOf(stranger)[0] }), (error) => error.code === "ENGRAVING_INVALID");
|
||||
const engraved = service.expeditions.engrave(player.id, { editionId: stranger, tag: tagsOf(rares[0])[0] });
|
||||
assert.equal(engraved.cardProgress.find((item) => item.editionId === rares[0]).equipment[0].synergyTag, tagsOf(rares[0])[0]);
|
||||
assert.throws(() => service.expeditions.engrave(player.id, { editionId: stranger, tag: "theme:voyage" }), (error) => error.code === "ENGRAVING_EXISTS");
|
||||
assert.ok(service.getState(player.id).history.filter((entry) => entry.type === "item_used").length >= 4);
|
||||
service.deleteAccount(player.id);
|
||||
for (const table of ["player_items", "equipment_engravings", "player_bonus_destinations"]) assert.equal(database.db.prepare(`SELECT COUNT(*) AS count FROM ${table} WHERE player_id = ?`).get(player.id).count, 0);
|
||||
});
|
||||
|
||||
test("returned expeditions credit the objects they bring back", () => {
|
||||
const { clock, service, player, open, rares } = expeditionService();
|
||||
open({ items: { ...DEFAULT_EXPEDITION_SETTINGS.items, chancePerHourPermille: 1000, maxPerExpedition: 2, orientationPerSlot: 0 } });
|
||||
const view = service.expeditions.getExpeditions(player.id);
|
||||
const started = service.expeditions.startSolo(player.id, soloBody(view, rares.slice(0, 2)), "objects");
|
||||
clock.now += 2 * HOUR;
|
||||
const claimed = service.expeditions.claim(player.id, started.expedition.id);
|
||||
assert.equal(claimed.expedition.reward.items.length, 2);
|
||||
// Le plan d'atelier n'est pas rapporté tant que l'atelier n'a pas de commune de pouvoir illustrée.
|
||||
assert.ok(!claimed.expedition.reward.items.includes("plan"));
|
||||
const items = service.expeditions.getExpeditions(player.id).items;
|
||||
assert.equal(Object.values(items).reduce((sum, count) => sum + count, 0), 2);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { loadExpeditionDestinations, validateExpeditionDestinations } from "../s
|
|||
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
|
||||
equipmentBonus, LINEAGES, resonancesOf, teamSynergy, unlockedSlots, bonusLootPct, pickItems, HIDDEN_ITEMS
|
||||
} from "../services/cards/expedition-rules.js";
|
||||
import {
|
||||
DEFAULT_EXPEDITION_SETTINGS, diffExpeditionSettings, EXPEDITION_SETTINGS_SCHEMA, mergeExpeditionSettings, readPath, validateExpeditionSettings
|
||||
|
|
@ -54,9 +54,11 @@ test("catalog validation refuses broken expedition data", () => {
|
|||
});
|
||||
|
||||
test("destinations order the four stats and stay satisfiable by rare or better cards", () => {
|
||||
assert.equal(destinations.length, 12);
|
||||
// Une destination par couple (stat principale, seconde stat) : chaque paire de rôles du solo existe.
|
||||
assert.equal(new Set(destinations.map((destination) => destination.stats.slice(0, 2).join("+"))).size, 12);
|
||||
const visible = destinations.filter((destination) => !destination.hidden);
|
||||
assert.equal(visible.length, 12);
|
||||
assert.deepEqual(destinations.filter((destination) => destination.hidden).map((destination) => destination.id), ["crimson-passage", "lost-observatory"]);
|
||||
// Une destination visible par couple (stat principale, seconde stat) : chaque paire de rôles du solo existe.
|
||||
assert.equal(new Set(visible.map((destination) => destination.stats.slice(0, 2).join("+"))).size, 12);
|
||||
const broken = (change) => {
|
||||
const copy = structuredClone(destinations);
|
||||
change(copy[0]);
|
||||
|
|
@ -288,3 +290,21 @@ test("equipment opens with power, shared tags add synergy points, and teams earn
|
|||
assert.equal(synergy.totalPct, 25);
|
||||
assert.equal(teamSynergy({ destination: { themeTags: ["lieu:vide"] }, slots: [card("a", "x", ["theme:nuit"])] }, settings).totalPct, 0);
|
||||
});
|
||||
|
||||
test("objects come by weight, hidden ones only with enough Orientation, and bonus destinations multiply the loot", () => {
|
||||
const counts = (orientationPerSlot, excluded = []) => {
|
||||
const seen = new Set();
|
||||
let step = 0;
|
||||
// Hasard parcourant tout l'intervalle : chaque objet permis finit par sortir.
|
||||
for (let index = 0; index < 200; index += 1) pickItems(1, { orientationPerSlot, excluded }, settings, (max) => (step++ * 7) % max).forEach((id) => seen.add(id));
|
||||
return seen;
|
||||
};
|
||||
const closed = counts(0);
|
||||
assert.ok(HIDDEN_ITEMS.every((id) => !closed.has(id)));
|
||||
assert.ok(["anchor", "guideStar", "skyChart"].every((id) => closed.has(id)));
|
||||
const open = counts(15, ["plan"]);
|
||||
assert.ok(open.has("fragment") && open.has("engraving") && !open.has("plan"));
|
||||
assert.deepEqual([null, "5", "6", "hidden"].map((slot) => bonusLootPct(slot, settings)), [100, 100, 125, 150]);
|
||||
assert.equal(expectedLoot({ hours: 4, stars: 1, tier: "success", fortune: 0, slotCount: 2, bonusSlot: "hidden" }, settings).eclats, 12);
|
||||
assert.equal(expectedLoot({ hours: 10, stars: 1, tier: "success", fortune: 0, slotCount: 2 }, settings).objects, 0.5);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -294,6 +294,18 @@
|
|||
"durationMalus": "Expédition longue : l’Endurance de l’équipe ne suffit pas, toutes les stats baissent.",
|
||||
"expected": "Butin attendu : environ {eclats} Éclats, {stardust} d’étoiles et {pack} % de chance de rapporter un paquet.",
|
||||
"start": "Partir en expédition",
|
||||
"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." },
|
||||
"useGuideStar": "Ajouter une 5e destination",
|
||||
"useSkyChart": "Ajouter une 6e destination",
|
||||
"useFragments": "Ouvrir une destination cachée",
|
||||
"bonusAdded": "Une nouvelle destination s’ajoute à votre journée.",
|
||||
"bonusSlots": { "5": "5e destination", "6": "6e destination", "hidden": "Destination cachée" },
|
||||
"recall": "Rappeler avec l’ancre ({count})",
|
||||
"recalled": "L’expédition est rappelée : récupérez la part de butin déjà gagnée.",
|
||||
"recalledShare": "Rappelée à {pct} %",
|
||||
"affinity": "Affinité · {tag}",
|
||||
"resonance": "{type} · {tag}",
|
||||
"resonanceTypes": { "echo": "Écho", "lineage": "Lignée", "sisters": "Étoiles sœurs" },
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Rôle : équipe une carte rare ou mieux depuis sa fiche : emplacements ouverts par la Puissance, communes à poser et leurs synergies.
|
||||
import { useState } from "react";
|
||||
import { equipCard } from "./cardsApi.js";
|
||||
import { engraveEquipment, equipCard } from "./cardsApi.js";
|
||||
import { tagLabel } from "./expeditionFormat.js";
|
||||
|
||||
const STAT_SHORT = { bravoure: "Bravoure", endurance: "Endurance", fortune: "Fortune", orientation: "Orientation" };
|
||||
|
|
@ -8,6 +8,8 @@ const statsText = (stats) => Object.entries(stats).map(([stat, value]) => `${val
|
|||
|
||||
export function CardEquipment({ catalog, state, progress, busy, runMutation }) {
|
||||
const [choosing, setChoosing] = useState(null);
|
||||
const [engraving, setEngraving] = useState(null);
|
||||
const burins = state.items?.engraving ?? 0;
|
||||
const nameOf = (cardId) => catalog.cards.find((card) => card.id === cardId)?.name || cardId;
|
||||
const sharedTag = (item) => item.tags.find((tag) => progress.tags.includes(tag)) ?? null;
|
||||
// Communes en synergie d'abord, puis les plus fortes sur leur meilleure stat.
|
||||
|
|
@ -22,8 +24,13 @@ export function CardEquipment({ catalog, state, progress, busy, runMutation }) {
|
|||
const open = slot < progress.slots;
|
||||
return <li key={slot} className="nds-list-row" data-locked={!open || undefined}>
|
||||
{!open ? <span>Emplacement ouvert à Puissance {power}</span> : item ? <>
|
||||
<span><strong>{item.name}</strong> {statsText(item.stats)}{item.synergyTag && <span className="nds-badge" data-variant="success">Synergie · {tagLabel(catalog, item.synergyTag)}</span>}</span>
|
||||
<span><strong>{item.name}</strong> {statsText(item.stats)}{item.synergyTag && <span className="nds-badge" data-variant="success">Synergie · {tagLabel(catalog, item.synergyTag)}</span>}{item.engraved && <span className="nds-badge" data-variant="gold">Gravée · {tagLabel(catalog, item.engraved)}</span>}</span>
|
||||
{!item.engraved && !item.synergyTag && burins > 0 && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} aria-pressed={engraving === item.editionId} onClick={() => setEngraving(engraving === item.editionId ? null : item.editionId)}>Graver</button>}
|
||||
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => equip(slot, null)}>Retirer</button>
|
||||
{engraving === item.editionId && <div className="nebula-card-equipment-engrave" role="group" aria-label={`Étiquette à graver sur ${item.name}`}>
|
||||
<span className="nebula-form-help">Un burin grave une étiquette de cette carte sur la commune, pour toujours ({burins} burin{burins > 1 ? "s" : ""}) :</span>
|
||||
{progress.tags.map((tag) => <button key={tag} className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={async () => { if (await runMutation(() => engraveEquipment(item.editionId, tag))) setEngraving(null); }}>{tagLabel(catalog, tag)}</button>)}
|
||||
</div>}
|
||||
</> : <>
|
||||
<span>Emplacement libre</span>
|
||||
<button className="nds-button" data-size="sm" data-variant={choosing === slot ? "primary" : "secondary"} type="button" disabled={busy || !choices.length} aria-pressed={choosing === slot} onClick={() => setChoosing(choosing === slot ? null : slot)}>Équiper</button>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ export function ExpeditionPlanner({ catalog, view, mode = "solo", content, busy,
|
|||
return <button key={item.id} type="button" className="nebula-expedition-destination" aria-pressed={item.id === destination.id} onClick={() => setDestinationId(item.id)}>
|
||||
{cover && <img src={cover.card.image} alt="" />}
|
||||
<span className="nebula-expedition-destination-copy">
|
||||
<strong>{item.name}</strong>
|
||||
<strong>{item.name}{item.bonusSlot && <span className="nds-badge" data-variant="gold">{content.bonusSlots[item.bonusSlot]}</span>}</strong>
|
||||
<span>{item.description}</span>
|
||||
<span className="nebula-expedition-destination-roles">{(group ? item.groupRoles : item.roles).map((stat) => <span key={stat} className="nds-badge" data-variant="neutral">{fillTemplate(content.roleBadge, { role: content.roles[stat], stat: content.stats[stat] })}</span>)}</span>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -11,10 +11,12 @@ function RewardBadges({ reward, content }) {
|
|||
<span className="nds-badge" data-variant="gold">{fillTemplate(content.rewardEclats, { value: formatEclats(reward.eclats) })}</span>
|
||||
{reward.stardust > 0 && <span className="nds-badge" data-variant="neutral">{fillTemplate(content.rewardStardust, { value: formatStardust(reward.stardust) })}</span>}
|
||||
{reward.packs.length > 0 && <span className="nds-badge" data-variant="success">{fillTemplate(content.rewardPacks, { count: reward.packs.length, s: reward.packs.length > 1 ? "s" : "" })}</span>}
|
||||
{(reward.items || []).map((item, index) => <span key={`${item}-${index}`} className="nds-badge" data-variant="success">{content.items[item]}</span>)}
|
||||
{reward.recalledPct != null && <span className="nds-badge" data-variant="warning">{fillTemplate(content.recalledShare, { pct: reward.recalledPct })}</span>}
|
||||
</div>;
|
||||
}
|
||||
|
||||
export function ExpeditionReport({ catalog, expedition, content, now, busy, onClaim }) {
|
||||
export function ExpeditionReport({ catalog, expedition, content, now, busy, onClaim, anchors = 0, onRecall = null }) {
|
||||
// Le serveur dit « en route » au chargement ; passé l'heure du retour, la page propose déjà de récupérer le butin.
|
||||
// En groupe, un joueur qui a récupéré sa part voit l'expédition terminée, même si les autres n'ont pas encore récupéré la leur.
|
||||
const status = expedition.claimedAt ? "completed" : expedition.status === "running" && expedition.returnsAt <= now ? "returned" : expedition.status;
|
||||
|
|
@ -43,6 +45,9 @@ export function ExpeditionReport({ catalog, expedition, content, now, busy, onCl
|
|||
const who = expedition.mode === "group" ? ` · ${slot.own ? content.you : slot.playerName}` : "";
|
||||
return <li key={slot.position}><NebulaCard catalog={catalog} entry={entry} size="sm" /><span>{slot.role ? content.roles[slot.role] : content.noRole}{who}</span></li>;
|
||||
})}</ul>
|
||||
{status === "running" && expedition.mode === "solo" && anchors > 0 && onRecall && <div className="nds-card-actions">
|
||||
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => onRecall(expedition.id)}>{fillTemplate(content.recall, { count: anchors })}</button>
|
||||
</div>}
|
||||
{status === "returned" && !expedition.claimedAt && <div className="nds-card-actions">
|
||||
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy} onClick={() => onClaim(expedition.id)}>{content.claim}</button>
|
||||
</div>}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Rôle : présente les Expéditions, quête de la Guilde : expéditions du joueur (retour, butin) et préparation d'une expédition solo.
|
||||
import { useEffect, useState } from "react";
|
||||
import { claimExpedition, convertStardust, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, startExpedition } from "./cardsApi.js";
|
||||
import { addBonusDestination, claimExpedition, convertStardust, recallExpedition, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, startExpedition } from "./cardsApi.js";
|
||||
import { fillTemplate, formatCountdown } from "./dailyShare.js";
|
||||
import { ExpeditionGroupCard } from "./ExpeditionGroupCard.jsx";
|
||||
import { ExpeditionPlanner } from "./ExpeditionPlanner.jsx";
|
||||
|
|
@ -20,6 +20,24 @@ const expeditionCall = (call) => async () => {
|
|||
}
|
||||
};
|
||||
|
||||
// Sac du Veilleur : objets rapportés ; les destinations bonus s'ouvrent ici, l'ancre et le burin depuis l'expédition et la fiche de carte.
|
||||
function ItemBag({ view, content, busy, onBonus }) {
|
||||
const { items } = view;
|
||||
const used = new Set(view.destinations.map((destination) => destination.bonusSlot).filter(Boolean));
|
||||
const actions = { guideStar: ["5", content.useGuideStar, 1], skyChart: ["6", content.useSkyChart, 1], fragment: ["hidden", content.useFragments, view.fragmentsForMap] };
|
||||
const owned = Object.entries(items).filter(([, count]) => count > 0);
|
||||
return <section className="nds-panel nebula-expedition-bag" aria-labelledby="nebula-expedition-bag-title">
|
||||
<h3 id="nebula-expedition-bag-title">{content.bagTitle}</h3>
|
||||
{owned.length ? <ul>{owned.map(([id, count]) => {
|
||||
const action = actions[id];
|
||||
return <li key={id} className="nds-list-row">
|
||||
<span><strong>{content.items[id]}</strong> ×{count}<span className="nebula-form-help">{content.itemHelp[id]}</span></span>
|
||||
{action && view.enabled && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy || count < action[2] || used.has(action[0])} onClick={() => onBonus(id)}>{action[1]}</button>}
|
||||
</li>;
|
||||
})}</ul> : <p className="nebula-form-help">{content.bagEmpty}</p>}
|
||||
</section>;
|
||||
}
|
||||
|
||||
// Pont des Veilleurs : de la poussière vers les Éclats, au taux réglé ; la conversion inverse n'existe pas.
|
||||
function BridgeForm({ rate, stardust, busy, content, onConvert }) {
|
||||
const [amount, setAmount] = useState("1");
|
||||
|
|
@ -81,6 +99,8 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
|
|||
if (result) setNotice({ variant: "success", text: fillTemplate(content.bridged, { eclats: formatEclats(eclats) }) });
|
||||
return Boolean(result);
|
||||
};
|
||||
const bonus = async (item) => handle(await runMutation(expeditionCall(() => addBonusDestination(item))), content.bonusAdded);
|
||||
const recall = async (id) => handle(await runMutation(expeditionCall(() => recallExpedition(id))), content.recalled);
|
||||
const depart = async (id) => handle(await runMutation(expeditionCall(() => departExpedition(id))), content.departed);
|
||||
|
||||
const expired = view.enabled && now >= view.nextDayAt;
|
||||
|
|
@ -97,13 +117,14 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
|
|||
</div>
|
||||
</div>
|
||||
<p className="nebula-form-help">{content.eclatsHelp}</p>
|
||||
<ItemBag view={view} content={content} busy={busy} onBonus={bonus} />
|
||||
<BridgeForm rate={view.progression.stardustPerEclat} stardust={state.wallet.stardust} busy={busy} content={content} onConvert={convert} />
|
||||
{notice && <p className="nds-inline-notice" data-variant={notice.variant} role="status">{notice.text}</p>}
|
||||
{expired && <div className="nds-inline-notice nebula-daily-expired" data-variant="warning" role="status"><span>{content.expired}</span><button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={reload}>{content.reload}</button></div>}
|
||||
|
||||
{view.expeditions.length > 0 && <section className="nebula-expedition-active" aria-labelledby="nebula-expedition-active-title">
|
||||
<h3 id="nebula-expedition-active-title">{content.activeTitle}</h3>
|
||||
<div className="nebula-expedition-reports">{view.expeditions.map((expedition) => <ExpeditionReport key={expedition.id} catalog={catalog} expedition={expedition} content={content} now={now} busy={busy} onClaim={claim} />)}</div>
|
||||
<div className="nebula-expedition-reports">{view.expeditions.map((expedition) => <ExpeditionReport key={expedition.id} catalog={catalog} expedition={expedition} content={content} now={now} busy={busy} onClaim={claim} anchors={view.items.anchor} onRecall={recall} />)}</div>
|
||||
</section>}
|
||||
|
||||
{(view.enabled || view.groups.length > 0) && <section className="nebula-expedition-active" aria-labelledby="nebula-expedition-groups-title">
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ const EVENT_LABELS = {
|
|||
expedition_cancelled_by_guild: "Expédition annulée par la Guilde",
|
||||
expedition_dissolved: "Groupe d’expédition dissous",
|
||||
card_upgraded: "Carte améliorée",
|
||||
eclats_converted: "Éclats d’étoile obtenus"
|
||||
eclats_converted: "Éclats d’étoile obtenus",
|
||||
item_used: "Objet utilisé"
|
||||
};
|
||||
|
||||
// Le journal garde la quantité réellement offerte : les comptes plus anciens n'ont reçu qu'une ouverture.
|
||||
|
|
@ -65,6 +66,11 @@ function HistoryDetail({ entry, catalog }) {
|
|||
if (entry.type === "expedition_cancelled_by_guild") return <span>{details.destinationName} · cartes libérées, sans butin</span>;
|
||||
if (entry.type === "expedition_dissolved") return <span>{details.destinationName} · {details.reason === "creator_left" ? "dissous par son créateur" : "pas assez de joueurs"} · cartes libérées</span>;
|
||||
if (entry.type === "card_upgraded") return <span>{[cardReference(entry.entityId, catalog), `niveau ${details.level}`, `Puissance ${details.power}`, details.method === "duplicate" ? "un doublon utilisé" : `−${details.eclats} Éclats`].join(" · ")}</span>;
|
||||
if (entry.type === "item_used") {
|
||||
const name = { anchor: "Ancre des Veilleurs", guideStar: "Étoile guide", skyChart: "Carte céleste", fragment: "Carte au trésor", engraving: "Burin de graveur" }[details.item] || details.item;
|
||||
const detail = details.destinationName ? `${details.destinationName}${details.recalledPct != null ? ` · rappel à ${details.recalledPct} %` : ""}` : details.tag ? `${cardReference(details.editionId, catalog)} · étiquette gravée` : "";
|
||||
return <span>{[name, detail].filter(Boolean).join(" · ")}</span>;
|
||||
}
|
||||
if (entry.type === "eclats_converted") return <span>+{details.eclats} Éclats · −{formatStardust(details.stardust)} d’étoiles</span>;
|
||||
if (entry.type === "opening_purchased") return <span>−{formatStardust(details.price)} d’étoiles</span>;
|
||||
if (!details.collectionId) return null;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,24 @@ export const EXPEDITION_SETTING_GROUPS = [
|
|||
{ path: "synergy.sistersCount", label: "Cartes d’un même thème pour les Étoiles sœurs" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "items",
|
||||
title: "Objets",
|
||||
help: "Chance de rapporter un objet (proportionnelle au butin), poids de chaque objet, Orientation qui ouvre la partie cachée (fragments, burins, plans) et butin des destinations cachées.",
|
||||
fields: [
|
||||
{ path: "items.chancePerHourPermille", label: "Chance d’objet par heure (‰)" },
|
||||
{ path: "items.maxPerExpedition", label: "Objets au plus par expédition" },
|
||||
{ path: "items.orientationPerSlot", label: "Orientation par place pour la partie cachée" },
|
||||
{ path: "items.fragmentsForMap", label: "Fragments pour une carte au trésor" },
|
||||
{ path: "items.hiddenLootPct", label: "Multiplicateur de butin des destinations cachées (%)" },
|
||||
{ path: "items.weights.fragment", label: "Poids : fragment de carte au trésor" },
|
||||
{ path: "items.weights.engraving", label: "Poids : burin de graveur" },
|
||||
{ path: "items.weights.plan", label: "Poids : plan d’atelier" },
|
||||
{ path: "items.weights.anchor", label: "Poids : ancre des Veilleurs" },
|
||||
{ path: "items.weights.guideStar", label: "Poids : étoile guide (5e destination)" },
|
||||
{ path: "items.weights.skyChart", label: "Poids : carte céleste (6e destination)" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "requirements",
|
||||
title: "Exigences",
|
||||
|
|
|
|||
|
|
@ -223,3 +223,16 @@ export function convertStardust(eclats) {
|
|||
export function equipCard(editionId, slot, equipmentEditionId) {
|
||||
return request("/equipment", { method: "PUT", body: JSON.stringify({ editionId, slot, equipmentEditionId }) });
|
||||
}
|
||||
|
||||
// Objets des Expéditions : destination bonus (« guideStar », « skyChart », « fragment »), rappel avec l'ancre, gravure d'une commune.
|
||||
export function addBonusDestination(item) {
|
||||
return request("/expeditions/bonus", { method: "POST", body: JSON.stringify({ item }) });
|
||||
}
|
||||
|
||||
export function recallExpedition(expeditionId) {
|
||||
return request(`/expeditions/${encodeURIComponent(expeditionId)}/recall`, { method: "POST" });
|
||||
}
|
||||
|
||||
export function engraveEquipment(editionId, tag) {
|
||||
return request("/equipment/engrave", { method: "POST", body: JSON.stringify({ editionId, tag }) });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,3 +118,12 @@
|
|||
.nebula-account-alerts ul { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
|
||||
.nebula-account-alerts .nds-list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding: var(--space-3); }
|
||||
.nebula-account-alerts .nds-list-row > .nds-button { flex: 0 0 auto; width: auto; }
|
||||
|
||||
// Sac du Veilleur et gravure d'un équipement.
|
||||
.nds-panel.nebula-expedition-bag { display: grid; gap: var(--space-2); padding: var(--space-4); }
|
||||
.nebula-expedition-bag ul { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
|
||||
.nebula-expedition-bag .nds-list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding: var(--space-3); }
|
||||
.nebula-expedition-bag .nds-list-row > span { display: grid; flex: 1 1 240px; gap: 2px; }
|
||||
.nebula-expedition-bag .nds-list-row > .nds-button { flex: 0 0 auto; width: auto; }
|
||||
.nebula-expedition-destination strong { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
|
||||
.nebula-card-equipment-engrave { display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue