Add an expedition set workshop to build sets without equipping
Some checks failed
Validate and deploy Sokko G / validate (push) Failing after 19m52s
Validate and deploy Sokko G / deploy (push) Has been skipped

- "Créer un set" opens a workshop from the explorer frame, or from the
  tab bar while preparation is hidden, even during an expedition: pick
  an explorer, draft its equipment, see the stats against its current
  gear and the tag synergies with cross-highlight, then save the set.
- The server accepts a set's equipment as a validated draft
  (SET_EQUIPMENT_INVALID for closed slots, unowned or duplicate commons).
- Tag search from the workshop opens the commons picker with that tag
  chosen; empty pickers and the empty sets window get a centered
  empty state with a clear or create action.
- Card tags read as a calm list and synergy shows inside the stats box;
  CardPicker moves to its own file.
- Tests, e2e paths and design docs cover the workshop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-12-05 15:40:19 +01:00
parent 6115a43118
commit ced3bc818d
30 changed files with 838 additions and 195 deletions

View file

@ -659,7 +659,10 @@ export function validateSiteContent(site) {
"cards.expeditions.pickerBuildHelpCards",
"cards.expeditions.pickerBuildHelpEquipment",
"cards.expeditions.pickerNoMatch",
...["button", "buttonCount", "title", "help", "nameLabel", "save", "saveHint", "listLabel", "itemsLabel", "empty", "apply", "applyLabel", "update", "updateLabel", "delete", "confirmDelete", "worn", "noEquipment", "cardBusy", "cardMissing", "itemMoves", "itemBusy", "itemMissing", "itemLocked", "reasonBusy", "applied", "appliedMoved", "appliedSkipped", "movedItem", "close"].map((key) => `cards.expeditions.sets.${key}`),
"cards.expeditions.pickerNoMatchTitle",
"cards.expeditions.pickerClearFilters",
...["button", "buttonCount", "title", "help", "nameLabel", "save", "saveHint", "listLabel", "itemsLabel", "empty", "emptyHelp", "apply", "applyLabel", "update", "updateLabel", "delete", "confirmDelete", "worn", "noEquipment", "cardBusy", "cardMissing", "itemMoves", "itemBusy", "itemMissing", "itemLocked", "reasonBusy", "applied", "appliedMoved", "appliedSkipped", "movedItem", "close",
"builderButton", "builderTitle", "builderEditTitle", "builderHelp", "builderFrom", "builderNew", "builderFromSet", "builderExplorer", "builderPickerHelp", "builderCardBusy", "builderCardMissing", "builderNoCard", "builderEquipment", "builderRemove", "builderSlotFree", "builderTagsTitle", "builderTagsHelp", "builderTagNone", "builderTagFindLabel", "builderCurrent", "builderClear", "builderDropped", "builderSummary", "builderStatsLabel", "builderDelta", "builderPickerTitle", "builderPickerSlots", "builderInDraft", "builderSave", "builderUpdate", "builderSaved", "builderSavedHere"].map((key) => `cards.expeditions.sets.${key}`),
"cards.expeditions.powerVocation",
"cards.expeditions.tagCondition",
"cards.expeditions.tagParry",

View file

@ -1158,6 +1158,37 @@ test("expedition sets save a card and its commons, then put them back, taking sh
assert.equal((await call(handler, { method: "POST", path: "/api/cards/expedition-sets", headers, body: { name: "", editionId: "nowhere" } })).json.error.code, "SET_NAME_INVALID");
});
test("the set workshop saves a composed equipment without equipping it, even for a card on an expedition, and checks it", () => {
const { service, player, open, rares, database } = expeditionService();
open();
const [card, other] = rares;
const [first, second] = editionsOf("common");
const [longsight, compass] = ["watchers-longsight-standard", "mad-compass-standard"];
database.transaction(() => {
[first, second, longsight, compass].forEach((editionId) => service.addCard(player.id, editionId));
service.expeditions.writeProgress(player.id, card, { level: 6, fieldXp: 0 });
});
const equipmentOf = (state, editionId) => state.cardProgress.find((item) => item.editionId === editionId).equipment.map((item) => item.editionId);
// La commune `first` équipe l'autre carte, partie en expédition : le set la contient quand même, et rien ne bouge.
service.expeditions.equip(player.id, { editionId: other, slot: 0, equipmentEditionId: first });
goSolo(service, player.id, soloBody(service.expeditions.getExpeditions(player.id), other), "workshop");
const saved = service.expeditions.saveSet(player.id, { name: "Atelier", editionId: card, equipment: [{ slot: 1, editionId: first }, { slot: 0, editionId: longsight }] });
assert.deepEqual(saved.state.expeditionSets[0].equipment, [{ slot: 0, editionId: longsight }, { slot: 1, editionId: first }]);
assert.deepEqual([equipmentOf(saved.state, card), equipmentOf(saved.state, other)], [[], [first]]);
// Un set se compose aussi pour la carte en expédition.
assert.deepEqual(service.expeditions.saveSet(player.id, { name: "En route", editionId: other, equipment: [{ slot: 0, editionId: second }] }).state.expeditionSets[1].equipment, [{ slot: 0, editionId: second }]);
// Refus : emplacement fermé (Puissance 70 : deux emplacements), commune absente, doublon, deux pouvoirs, liste illisible.
const refused = (equipment) => assert.throws(() => service.expeditions.saveSet(player.id, { name: "Refus", editionId: card, equipment }), (error) => error.code === "SET_EQUIPMENT_INVALID");
refused([{ slot: 2, editionId: second }]);
refused([{ slot: 0, editionId: "nowhere" }]);
refused([{ slot: 0, editionId: rares[1] }]);
refused([{ slot: 0, editionId: first }, { slot: 1, editionId: first }]);
refused([{ slot: 0, editionId: first }, { slot: 0, editionId: second }]);
refused([{ slot: 0, editionId: longsight }, { slot: 1, editionId: compass }]);
refused("first");
assert.equal(service.expeditions.setsOf(player.id).length, 2);
});
// Les Résonances lient les cartes d'une même équipe : seule, une carte n'en a pas ; en groupe, elles comptent dans le score.
test("resonances raise a group's score", () => {
const { service, player, second, open, database } = groupService();

View file

@ -21,7 +21,7 @@ import { rarityPercentages } from "../website/src/features/cards/dropRates.js";
import { visibleCollections } from "../website/src/features/cards/collectionState.js";
import { buildScore, profileShape, rankRows, statRows } from "../website/src/features/cards/cardStats.js";
import { compareBuild, equipmentGain, matchesPicker, normalizeSearch, searchOptions, tagSuggestions, usefulTags } from "../website/src/features/cards/expeditions/pickerFilters.js";
import { appliedSummary, setStatus } from "../website/src/features/cards/expeditions/expeditionSets.js";
import { appliedSummary, draftLoadout, freeName, setStatus } from "../website/src/features/cards/expeditions/expeditionSets.js";
import { matchTraders, rankMatches, summarizeMatches } from "../website/src/features/cards/transferSuggestions.js";
import { availableTips, TIP_SECTION_VARIANTS, tipOfDay } from "../website/src/features/cards/dailyTips.js";
import { backupCardsDatabase, restoreCardsDatabase, runScheduledBackup, verifyCardsDatabase } from "../services/cards/backup.js";
@ -1719,3 +1719,22 @@ test("an expedition set foresees what each common will do and sums up what the s
assert.equal(appliedSummary(catalog, set, { moved: [{ editionId: "twilight-red-panda-standard", from: "starvoid-dragon-standard" }], skipped: [{ editionId: "zzz", reason: "busy" }] }, content),
"Set « Ruines » équipé. Repris : Panda Roux du Crépuscule à Dragon du Néant Étoilé. Non posés : zzz (en expédition).");
});
test("the set workshop sums a composed equipment like the server and proposes a free set name", () => {
const progress = { editionId: "card", slots: 2, tags: ["nuit"], baseStats: { bravoure: 20, endurance: 10, fortune: 5, orientation: 0 } };
const choices = [
{ editionId: "sword", stats: { bravoure: 6, endurance: -2 }, tags: ["nuit"], synergyStat: null, equippedOn: null },
{ editionId: "clover", stats: { fortune: 4, orientation: 4 }, tags: ["jour"], synergyStat: "orientation", equippedOn: "busy-card" },
{ editionId: "luck", stats: { fortune: 4 }, tags: [], synergyStat: null, equippedOn: null },
{ editionId: "lamp", stats: {}, power: "stormLantern", tags: ["nuit"], synergyStat: "endurance", equippedOn: null }
];
// Synergie : la commune qui partage « nuit » gagne le bonus sur sa meilleure stat ; une commune à pouvoir, sur sa stat de synergie.
const loadout = draftLoadout(progress, [{ slot: 1, editionId: "lamp" }, { slot: 0, editionId: "sword" }, { slot: 2, editionId: "gone" }], choices, 2);
assert.deepEqual(loadout.stats, { bravoure: 28, endurance: 10, fortune: 5, orientation: 0 });
assert.deepEqual(loadout.equipment.map(({ slot, editionId, synergyTag, synergyStat, synergyBonus }) => [slot, editionId, synergyTag, synergyStat, synergyBonus]),
[[0, "sword", "nuit", "bravoure", 2], [1, "lamp", "nuit", "endurance", 2]]);
assert.equal(loadout.power, "stormLantern");
// Une stat ne descend pas sous zéro.
assert.equal(draftLoadout({ ...progress, baseStats: { endurance: 1 } }, [{ slot: 0, editionId: "sword" }], choices, 2).stats.endurance, 0);
assert.equal(freeName("Panda", [{ name: "panda" }, { name: "Panda 2" }]), "Panda 3");
});

View file

@ -142,7 +142,7 @@ test("Sokko TCG styles load with their route and keep the single-sheet cascade",
const main = uses(await readFile(`${root}/main.scss`, "utf8"));
const route = uses(await readFile(`${root}/cards-route.scss`, "utf8"));
const cardSheets = route.filter((name) => name.startsWith("nebula-"));
assert.deepEqual(cardSheets, ["nebula-cards", "nebula-daily", "nebula-expeditions", "nebula-expedition-destinations", "nebula-expedition-loadout", "nebula-expedition-journey", "nebula-expedition-bag", "nebula-team", "nebula-race", "nebula-mirror", "nebula-admin-guild"]);
assert.deepEqual(cardSheets, ["nebula-cards", "nebula-daily", "nebula-expeditions", "nebula-expedition-destinations", "nebula-expedition-loadout", "nebula-expedition-sets", "nebula-expedition-journey", "nebula-expedition-bag", "nebula-team", "nebula-race", "nebula-mirror", "nebula-admin-guild"]);
assert.ok(cardSheets.every((name) => !main.includes(name)), "main.scss must not load the Sokko TCG sheets");
// La feuille de route ré-émet, dans le même ordre, toutes les feuilles qui suivaient les cartes dans main.scss.
const after = main.slice(main.indexOf("nebula-cards-nav") + 1);