Add the Carnets des Veilleurs, the expedition-only Sokko TCG collection with power commons

- A new watchers-logbooks collection of category expedition never comes from packs, the shop or codes, and administrators cannot open it as a pack.
- Its six commons carry powers instead of stats (Longue-vue, Provisions, Carte au trésor, Talisman, Boussole folle, Filet à étoiles filantes); a card holds one power and each counts once per team.
- Powers change travel time, loot, score or tier, hide requirements, or catch a logbook card; each destination lists the logbook cards it can bring back.
- A workshop turns a plan and three duplicate commons into a power common.
- The fifteen cards ship without images with ready ChatGPT prompts; a card only drops or gets crafted once illustrated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-15 17:40:51 +01:00
parent ae23adfdd9
commit 21827a252b
38 changed files with 939 additions and 76 deletions

View file

@ -255,6 +255,21 @@ export function validateSiteContent(site) {
"cards.guild.expeditionsClaim",
"cards.guild.expeditionsOpen",
"cards.packs.giftFromExpedition",
"cards.expeditions.powers.longsight",
"cards.expeditions.powers.rations",
"cards.expeditions.powers.treasureMap",
"cards.expeditions.powers.talisman",
"cards.expeditions.powers.madCompass",
"cards.expeditions.powers.starNet",
"cards.expeditions.hiddenRequirements",
"cards.expeditions.hiddenResult",
"cards.expeditions.travelTime",
"cards.expeditions.rewardCard",
"cards.expeditions.atelierOpen",
"cards.expeditions.atelierHelp",
"cards.expeditions.atelierNoCommons",
"cards.expeditions.atelierAction",
"cards.expeditions.crafted",
"cards.expeditions.bagTitle",
"cards.expeditions.bagEmpty",
"cards.expeditions.items.fragment",

View file

@ -122,7 +122,7 @@ test("cards API authenticates dev sessions and protects mutations", async (t) =>
const config = await call(handler, { path: "/api/cards/config" });
assert.equal(config.status, 200);
assert.equal(config.json.enabled, true);
assert.equal(config.json.catalog.collections.length, 5);
assert.equal(config.json.catalog.collections.length, 6);
const login = await call(handler, { method: "POST", path: "/api/cards/auth/dev", body: {} });
assert.equal(login.status, 200);

View file

@ -686,3 +686,69 @@ test("returned expeditions credit the objects they bring back", () => {
const items = service.expeditions.getExpeditions(player.id).items;
assert.equal(Object.values(items).reduce((sum, count) => sum + count, 0), 2);
});
// Les cartes des Carnets attendent leurs illustrations : les tests leur en donnent une, en mémoire, pour ce service seulement.
function illustrateLogbooks(service) {
for (const card of service.catalog.cards.filter((item) => item.collectionId === "watchers-logbooks")) card.image = `/static/img/cards/watchers-logbooks/${card.id}.webp`;
}
test("the Carnets des Veilleurs never come from packs, and their cards only drop once illustrated", () => {
const { clock, service, admin, player, open, rares } = expeditionService();
assert.throws(() => service.setCollectionActive(admin.id, "watchers-logbooks", true), (error) => error.code === "EXPEDITION_COLLECTION");
assert.throws(() => service.openPack(player.id, "watchers-logbooks", "logbook-pack"), (error) => error.code === "EXPEDITION_COLLECTION");
assert.throws(() => service.createCampaign(admin.id, { name: "Carnets", code: "CARNETS", reward: { items: [{ type: "pack", collectionId: "watchers-logbooks" }] } }), /expédition/);
open({ carnets: { cardPerHourPermille: 1000, maxCards: 1 } });
const view = service.expeditions.getExpeditions(player.id);
// Sans illustration, aucune carte des Carnets n'est rapportée, même avec une chance pleine.
const first = service.expeditions.startSolo(player.id, soloBody(view, rares.slice(0, 2)), "no-art");
clock.now += 2 * HOUR;
assert.deepEqual(service.expeditions.claim(player.id, first.expedition.id).expedition.reward.cards, []);
illustrateLogbooks(service);
const second = service.expeditions.startSolo(player.id, soloBody(view, rares.slice(0, 2)), "with-art");
clock.now += 2 * HOUR;
const reward = service.expeditions.claim(player.id, second.expedition.id).expedition.reward;
assert.equal(reward.cards.length, 1);
const logbook = service.catalog.cards.find((card) => card.id === service.index.editions.get(reward.cards[0]).cardId);
assert.equal(logbook.collectionId, "watchers-logbooks");
assert.ok(service.quantityOf(player.id, reward.cards[0]) >= 1);
});
test("power commons equip one per card, change travel time and hide requirements, and the workshop crafts them", () => {
const { service, player, open, rares, database } = expeditionService();
open();
illustrateLogbooks(service);
const [longsight, compass] = ["watchers-longsight-standard", "mad-compass-standard"];
database.transaction(() => {
[longsight, compass].forEach((editionId) => service.addCard(player.id, editionId));
service.expeditions.writeProgress(player.id, rares[0], { level: 6, fieldXp: 0 });
});
// Puissance 70 : deux emplacements ; un seul pouvoir par carte.
service.expeditions.equip(player.id, { editionId: rares[0], slot: 0, equipmentEditionId: longsight });
assert.throws(() => service.expeditions.equip(player.id, { editionId: rares[0], slot: 1, equipmentEditionId: compass }), (error) => error.code === "POWER_LIMIT");
const view = service.expeditions.getExpeditions(player.id);
assert.deepEqual(view.cards.find((card) => card.editionId === rares[0]).powers, ["longsight"]);
const body = soloBody(view, rares.slice(0, 2), { durationHours: 6 });
assert.equal(service.expeditions.preview(player.id, body).preview.travelHours, 8);
const started = service.expeditions.startSolo(player.id, body, "longsight");
assert.equal(started.expedition.returnsAt - started.expedition.departsAt, 8 * HOUR);
service.expeditions.cancel(service.upsertPlayer({ discordId: "expedition-admin", displayName: "Admin", isAdmin: true }).id, started.expedition.id);
// Boussole folle : l'aperçu ne montre ni exigences ni résultat.
service.expeditions.equip(player.id, { editionId: rares[0], slot: 0, equipmentEditionId: compass });
const hidden = service.expeditions.preview(player.id, body).preview;
assert.equal(hidden.hiddenRequirements, true);
assert.equal(hidden.requirements, undefined);
// Atelier : un plan et 3 doublons de communes donnent une commune de pouvoir illustrée.
const commons = editionsOf("common").slice(0, 2);
database.transaction(() => {
commons.forEach((editionId) => { service.addCard(player.id, editionId); service.addCard(player.id, editionId); });
service.addCard(player.id, commons[1]);
service.expeditions.addItemsInTx(player.id, ["plan"]);
});
assert.throws(() => service.expeditions.craft(player.id, { editionIds: [commons[0], commons[0], commons[1]] }), (error) => error.code === "NOT_A_DUPLICATE");
assert.throws(() => service.expeditions.craft(player.id, { editionIds: [rares[0], commons[1], commons[1]] }), (error) => error.code === "ATELIER_INVALID");
const crafted = service.expeditions.craft(player.id, { editionIds: [commons[0], commons[1], commons[1]] });
assert.ok(service.index.cards.get(service.index.editions.get(crafted.crafted).cardId).expedition.equipment.power);
assert.equal(crafted.state.items.plan, 0);
assert.equal(service.quantityOf(player.id, commons[1]), 1);
});

View file

@ -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, bonusLootPct, pickItems, HIDDEN_ITEMS
equipmentBonus, LINEAGES, resonancesOf, teamSynergy, unlockedSlots, bonusLootPct, pickItems, HIDDEN_ITEMS, teamPowers, travelHours
} from "../services/cards/expedition-rules.js";
import {
DEFAULT_EXPEDITION_SETTINGS, diffExpeditionSettings, EXPEDITION_SETTINGS_SCHEMA, mergeExpeditionSettings, readPath, validateExpeditionSettings
@ -244,9 +244,12 @@ test("a level costs Éclats by current power, so a rare pays the longer road to
});
test("commons carry equipment spread over a fixed budget, and every card has synergy partners", () => {
const commons = rawCatalog.cards.filter((card) => card.expedition.equipment);
const commons = rawCatalog.cards.filter((card) => card.expedition.equipment?.stats);
assert.equal(commons.length, 68);
for (const card of commons) assert.equal(Object.values(card.expedition.equipment.stats).reduce((sum, value) => sum + value, 0), 6, card.id);
// Les communes des Carnets des Veilleurs portent chacune un pouvoir, et aucune stat.
assert.deepEqual(rawCatalog.cards.filter((card) => card.expedition.equipment?.power).map((card) => card.expedition.equipment.power).sort(), ["longsight", "madCompass", "rations", "starNet", "talisman", "treasureMap"]);
assert.throws(() => prepareVersionedCatalog({ ...structuredClone(rawCatalog), cards: rawCatalog.cards.map((card) => (card.id === "mad-compass" ? { ...card, expedition: { ...card.expedition, equipment: { power: "flying" } } } : card)) }), /known power/);
const broken = (change) => {
const copy = structuredClone(rawCatalog);
change(copy);
@ -308,3 +311,27 @@ test("objects come by weight, hidden ones only with enough Orientation, and bonu
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);
});
test("powers trade an advantage for a cost and count once per team", () => {
const destination = destinations[0];
const entry = { condition: destination.conditions[0], dangers: destination.dangers };
const slot = (powers = []) => ({ stats: { bravoure: 30, endurance: 30, fortune: 30, orientation: 30 }, role: null, tags: [], collectionId: "x", cardId: `c${powers.join()}`, powers });
assert.deepEqual(teamPowers([slot(["talisman"]), slot(["talisman", "starNet"])]), ["talisman", "starNet"]);
const evaluate = (powers, stats) => evaluateTeam({ destination, entry, stars: 2, durationIndex: 0, slots: [{ ...slot(), stats, role: destination.stats[0] }, { ...slot(), stats, role: destination.stats[1] }], powers }, settings);
const weak = { bravoure: 1, endurance: 1, fortune: 1, orientation: 1 };
const strong = { bravoure: 90, endurance: 90, fortune: 90, orientation: 90 };
// Talisman : ni échec ni triomphe.
assert.equal(evaluate([], weak).tier, "struggle");
assert.equal(evaluate(["talisman"], weak).tier, "success");
assert.equal(evaluate(["talisman"], strong).tier, "success");
// Carte au trésor : une part du score en moins ; Filet : un peu de Fortune en moins.
const plain = evaluate([], { bravoure: 10, endurance: 10, fortune: 10, orientation: 10 });
assert.ok(Math.abs(evaluate(["treasureMap"], { bravoure: 10, endurance: 10, fortune: 10, orientation: 10 }).scorePct - plain.scorePct * 0.9) < 1e-9);
assert.equal(evaluate(["starNet"], { bravoure: 10, endurance: 10, fortune: 10, orientation: 10 }).stats.fortune, plain.stats.fortune - 2);
// Butin et trajet : la Boussole folle et les Provisions changent le butin, la Longue-vue et les Provisions le temps de trajet.
const loot = (powers) => expectedLoot({ hours: 10, stars: 1, tier: "success", fortune: 0, slotCount: 2, powers }, settings);
assert.equal(loot(["madCompass"]).eclats, loot([]).eclats * 1.3);
assert.equal(loot(["rations"]).eclats, loot([]).eclats * 0.85);
assert.equal(loot(["longsight"]).packs, loot([]).packs * 1.25);
assert.deepEqual([travelHours(6, [], settings), travelHours(6, ["longsight"], settings), travelHours(8, ["rations"], settings)], [6, 8, 6]);
});

View file

@ -123,7 +123,9 @@ test("the shop pack is bought with stardust, opens at once and cannot be obtaine
});
test("full-art mythics need a full image and declare one per legendary card", async (t) => {
const legendaryIds = baseCatalog.editions.filter((edition) => edition.rarity === "legendary").map((edition) => edition.cardId);
// Une carte encore sans illustration (les Carnets des Veilleurs attendent les leurs) n'a pas non plus de pleine illustration.
const legendaryIds = baseCatalog.editions.filter((edition) => edition.rarity === "legendary").map((edition) => edition.cardId)
.filter((cardId) => baseCatalog.cards.find((item) => item.id === cardId).image);
for (const cardId of legendaryIds) {
const card = baseCatalog.cards.find((item) => item.id === cardId);
assert.ok(card.fullImage, `${cardId} needs a full image`);
@ -235,7 +237,7 @@ test("card catalog keeps mythic editions attached to legendary cards", async ()
assert.deepEqual(drawPack(catalog, launchCollection.id, () => 0), Array(3).fill("astral-booster-standard"));
assert.deepEqual(drawPack(catalog, launchCollection.id, (maximum) => maximum - 1), Array(3).fill("mythic-card-pull-spectral-prism-solar"));
await Promise.all(astralCards.map((card) => access(`website/public${card.image}`)));
assert.deepEqual(new Set(catalog.collections.map((collection) => collection.packCategory)), new Set(["permanent", "event", "shop"]));
assert.deepEqual(new Set(catalog.collections.map((collection) => collection.packCategory)), new Set(["permanent", "event", "shop", "expedition"]));
assert.ok(catalog.collections.every((collection) => collection.systemName && /^#[0-9a-f]{6}$/i.test(collection.back.primary) && collection.back.symbol && /^\/static\/img\/cards\/[a-z0-9-]+\/back\.webp$/.test(collection.back.image)));
});