Balance the remaining powers per real hour, scale loot caps and field experience with duration, and count each resonance once

- The spyglass trades a quarter more travel for more cards and one more at the cap, rations are neutral per hour, the shooting-star net scales with the chosen hours and costs Fortune per place, the storm lantern adds 10 % of travel instead of a fixed hour, and the fog bell's group bonus sits outside the synergy cap.
- Card and object caps grow with each 6 hours chosen, and field experience with each 2 hours, so long expeditions are no longer held back by the caps of short ones.
- Each resonance needs its own pair of cards, "Étoiles sœurs" becomes "Thème partagé", and the bonuses say when the cap absorbs part of them.
- Every stat is a secondary stat for two vocations, and the simulator's reflected builds can pick Adaptation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-18 22:59:30 +01:00
parent 5a9cc42073
commit fb951e4510
15 changed files with 176 additions and 88 deletions

View file

@ -5,7 +5,7 @@ import { test } from "node:test";
import { loadCardsCatalog } from "../services/cards/catalog.js";
import { loadExpeditionDestinations } from "../services/cards/expedition-content.js";
import { DEFAULT_EXPEDITION_SETTINGS, mergeExpeditionSettings } from "../services/cards/expedition-settings.js";
import { simulate, simulationCards, soloBuildShares, statCommons } from "../services/cards/expedition-simulation.js";
import { buildCommons, simulate, simulationCards, soloBuildShares } from "../services/cards/expedition-simulation.js";
const catalog = loadCardsCatalog("website/public/data/cards/catalog.json");
const destinations = loadExpeditionDestinations("services/cards/content/expedition-destinations.json", catalog);
@ -43,7 +43,7 @@ test("4 stars stay out of reach for level 0 rares", () => {
// Builds réfléchis : une carte sur deux, pour garder le test rapide (les raretés restent toutes représentées).
const cards = simulationCards(catalog).filter((_, index) => index % 2 === 0);
const commons = statCommons(catalog);
const commons = buildCommons(catalog);
const share = (value) => `${(value * 100).toFixed(0)} %`;
test("the highest difficulties need equipment, and a reflected build clears them at the cap", () => {

View file

@ -706,7 +706,7 @@ test("progression plans spread level points by vocation or by hand, and a Parche
// Tant que la carte suit sa collection, choisir une vocation est gratuit et s'applique aux points déjà gagnés.
const guardian = service.expeditions.setCardPlan(player.id, { editionId: card, plan: "guardian" }).progress;
const base = before.plan.levelBase;
assert.deepEqual(guardian.stats, { bravoure: base.bravoure + 4, endurance: base.endurance + 12, fortune: base.fortune, orientation: base.orientation + 4 });
assert.deepEqual(guardian.stats, { bravoure: base.bravoure + 4, endurance: base.endurance + 12, fortune: base.fortune + 4, orientation: base.orientation });
assert.deepEqual(guardian.stats, before.plan.previews.guardian);
assert.equal(guardian.plan.paid, true);
assert.deepEqual(service.expeditions.getExpeditions(player.id).cards.find((item) => item.editionId === card).stats, guardian.stats);
@ -1160,9 +1160,9 @@ test("power commons equip one per card, change travel time and hide requirements
const view = service.expeditions.getExpeditions(player.id);
assert.deepEqual(view.cards.find((card) => card.editionId === rares[0]).powers, ["longsight"]);
const body = soloBody(view, rares[0], { durationHours: 6 });
assert.equal(service.expeditions.preview(player.id, body).preview.travelHours, 8);
assert.equal(service.expeditions.preview(player.id, body).preview.travelHours, 7.5);
const started = goSolo(service, player.id, body, "longsight");
assert.equal(started.expedition.returnsAt - started.expedition.departsAt, 8 * HOUR);
assert.equal(started.expedition.returnsAt - started.expedition.departsAt, 7.5 * HOUR);
service.expeditions.cancel(service.upsertPlayer({ discordId: "expedition-admin", displayName: "Admin", isAdmin: true }).id, started.expedition.id);
// Coup de folie : l'aperçu ne montre ni exigences ni résultat, mais la fourchette des exigences réelles.
service.expeditions.equip(player.id, { editionId: rares[0], slot: 0, equipmentEditionId: compass });

View file

@ -446,20 +446,25 @@ test("equipment opens with power, shared tags add synergy points, and teams earn
assert.deepEqual(declared.synergies.map((item) => item.stat), ["orientation", "endurance"]);
const card = (cardId, collectionId, tags) => ({ cardId, collectionId, tags });
// Écho : le même personnage dans deux collections ; Lignée : un Primordial et une carte de son thème ; Étoiles sœurs : deux cartes d'un thème.
// Écho : le même personnage dans deux collections ; Lignée : un Primordial et une carte de son thème ; Thème partagé : deux cartes d'un thème.
assert.deepEqual(resonancesOf([card("a", "primordial-nebula", ["personnage:hamster"]), card("b", "dream-arcade", ["personnage:hamster"])], settings), [{ type: "echo", key: "personnage:hamster" }]);
assert.deepEqual(resonancesOf([card("a", "primordial-nebula", ["personnage:loup"]), card("b", "primordial-nebula", ["theme:aurores"])], settings), [{ type: "lineage", key: "personnage:loup" }]);
assert.deepEqual(resonancesOf([card("a", "x", ["theme:hiver"]), card("b", "x", ["theme:hiver"])], settings), [{ type: "sisters", key: "theme:hiver" }]);
// Une même carte ne forme pas seule une Lignée ; deux Résonances au plus.
assert.deepEqual(resonancesOf([card("a", "x", ["personnage:loup", "theme:aurores"]), card("b", "y", ["theme:nuit"])], settings), []);
const all = [card("a", "primordial-nebula", ["personnage:loup", "theme:hiver"]), card("b", "dream-arcade", ["personnage:loup", "theme:aurores", "theme:hiver"])];
// Une même paire de cartes ne forme qu'une Résonance, même si elle est liée de plusieurs façons.
const pair = [card("a", "primordial-nebula", ["personnage:loup", "theme:hiver"]), card("b", "dream-arcade", ["personnage:loup", "theme:aurores", "theme:hiver"])];
assert.deepEqual(resonancesOf(pair, settings).map((item) => item.type), ["echo"]);
// Avec une troisième carte, une autre paire peut former une seconde Résonance.
const all = [...pair, card("c", "long-night", ["theme:aurores"])];
assert.deepEqual(resonancesOf(all, settings).map((item) => item.type), ["echo", "lineage"]);
const destination = { themeTags: ["theme:hiver"] };
const synergy = teamSynergy({ destination, slots: all, cohesionPct: 10 }, settings);
assert.equal(synergy.affinity, "theme:hiver");
// Affinité 10 + deux Résonances 20 + cohésion 10 = 40, plafonné à 25.
// Affinité 10 + deux Résonances 20 + cohésion 10 = 40, plafonné à 25 ; la somme avant plafond reste visible.
assert.equal(synergy.totalPct, 25);
assert.equal(synergy.rawPct, 40);
assert.equal(teamSynergy({ destination: { themeTags: ["lieu:vide"] }, slots: [card("a", "x", ["theme:nuit"])] }, settings).totalPct, 0);
});
@ -503,7 +508,8 @@ test("powers trade an advantage for a cost and count once per team", () => {
// 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);
// Filet : chaque place perd 2 de Fortune (deux places ici).
assert.equal(evaluate(["starNet"], { bravoure: 10, endurance: 10, fortune: 10, orientation: 10 }).stats.fortune, plain.stats.fortune - 4);
// 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);
@ -515,10 +521,17 @@ test("powers trade an advantage for a cost and count once per team", () => {
const shown = requirementsFor(destination, 2, 1, settings).map((item) => item.value);
assert.deepEqual(scaled(100), shown);
assert.deepEqual(scaled(130), shown.map((value) => Math.round(value * 1.3)));
assert.equal(loot(["rations"]).eclats, loot([]).eclats * 0.85);
assert.equal(loot(["longsight"]).cards, loot([]).cards * 1.25);
assert.deepEqual([travelHours(6, [], settings), travelHours(6, ["longsight"], settings), travelHours(8, ["rations"], settings)], [6, 8, 6]);
// Lanterne de tempête : un danger subi pèse moitié moins, mais le trajet dure une heure de plus.
// Provisions : un quart du trajet et un quart du butin en moins, donc le même butin par heure réelle.
assert.equal(loot(["rations"]).eclats, loot([]).eclats * 0.75);
// Longue-vue : +40 % de chance de carte et une carte de plus au plafond, pour un trajet un quart plus long.
assert.ok(Math.abs(loot(["longsight"]).cards - loot([]).cards * 1.4) < 1e-9);
assert.equal(loot(["longsight"]).cardCap, loot([]).cardCap + 1);
assert.deepEqual([travelHours(6, [], settings), travelHours(6, ["longsight"], settings), travelHours(8, ["rations"], settings), travelHours(10, ["stormLantern"], settings)], [6, 7.5, 6, 11]);
// Plafonds de butin : une tranche par 6 h choisies, au moins une.
const capped = (hours) => expectedLoot({ hours, stars: 5, tier: "triumph", fortune: 100, slotCount: 1, multiplierPct: 1000 }, settings);
assert.deepEqual([2, 6, 12].map((hours) => capped(hours).cards), [1, 1, 2]);
assert.deepEqual([2, 6, 12].map((hours) => capped(hours).objects), [2, 2, 4]);
// Lanterne de tempête : un danger subi pèse moitié moins, mais le trajet dure 10 % de plus.
const exposed = { bravoure: 10, endurance: 0, fortune: 10, orientation: 10 };
const danger = { id: "storm", stat: "bravoure", countered: false };
const struck = applyHazards(exposed, { slotCount: 2, durationIndex: 0, dangers: [danger] }, settings).dangers[0];
@ -527,12 +540,14 @@ test("powers trade an advantage for a cost and count once per team", () => {
assert.ok(Math.abs((1 - sheltered.factor) - (1 - struck.factor) * 0.5) < 1e-9);
const stars5 = (powers) => evaluateTeam({ destination, entry, stars: 5, durationIndex: 0, slots: [{ ...slot(), stats: exposed }, { ...slot(), stats: exposed }], powers }, settings);
assert.ok(stars5(["stormLantern"]).scorePct >= stars5([]).scorePct);
assert.equal(travelHours(6, ["stormLantern"], settings), 7);
assert.ok(Math.abs(travelHours(6, ["stormLantern"], settings) - 6.6) < 1e-9);
// Cloche de brume : du butin en moins en solo, rien en groupe ; en groupe, un bonus de synergie.
assert.ok(Math.abs(loot(["fogBell"]).eclats - loot([]).eclats * 0.8) < 1e-9);
const groupLoot = (powers) => expectedLoot({ hours: 10, stars: 1, tier: "success", fortune: 0, slotCount: 2, powers, group: true }, settings);
assert.equal(groupLoot(["fogBell"]).eclats, groupLoot([]).eclats);
assert.equal(teamSynergy({ destination, slots: [], bellPct: settings.powers.fogBellSynergyPct }, settings).totalPct, 10);
// En groupe, son bonus s'ajoute hors du plafond des synergies, comme l'Expertise.
const rally = (rallyPct) => evaluateTeam({ destination, entry, stars: 2, durationIndex: 0, slots: [{ ...slot(), stats: tenStats }, { ...slot(), stats: tenStats }], synergyPct: settings.score.synergyCapPct, rallyPct }, settings).scorePct;
assert.ok(Math.abs(rally(settings.powers.fogBellSynergyPct) / rally(0) - 1.1) < 1e-9);
});
test("progression plans: the default keeps today's stats, vocations reach the cap and free points stay within the rules", () => {
@ -541,8 +556,8 @@ test("progression plans: the default keeps today's stats, vocations reach the ca
assert.deepEqual([levelPoints("rare", 4, settings), levelPoints("legendary", 6, settings), levelPoints("legendary", 9, settings), maxStatPoints(25, settings)], [20, 30, 30, 15]);
assert.deepEqual(vocationProfile("navigator", settings), { bravoure: 0, endurance: 20, fortune: 20, orientation: 60 });
assert.deepEqual(vocationProfile("leader", { ...settings, plans: { maxStatPct: 45 } }), { bravoure: 45, endurance: 28, fortune: 0, orientation: 27 });
// Rare de niveau 4 : base 40 selon le profil, puis 20 points en vocation de Gardien (12 / 4 / 4).
assert.deepEqual(planStats("rare", 4, profile, { plan: "guardian" }, settings), { bravoure: 14, endurance: 22, fortune: 8, orientation: 16 });
// Rare de niveau 4 : base 40 selon le profil, puis 20 points en vocation de Gardien (12 en Endurance, 4 en Bravoure et en Fortune).
assert.deepEqual(planStats("rare", 4, profile, { plan: "guardian" }, settings), { bravoure: 14, endurance: 22, fortune: 12, orientation: 12 });
assert.deepEqual(planStats("rare", 4, profile, { plan: "free", allocation: { fortune: 7 } }, settings), { bravoure: 10, endurance: 10, fortune: 15, orientation: 12 });
// Une répartition qui ne respecte plus les règles (réglage abaissé) est ramenée dedans, sans erreur.
assert.deepEqual(clampAllocation({ bravoure: 20, endurance: 9 }, 20, settings), { bravoure: 11, endurance: 9, fortune: 0, orientation: 0 });