Give each pack collection its own power common, fix redundant commons and spell out powers in the interface
The Nebula, the Long Night, the Dream Arcade and the Crimson Procession now each have two power commons: Adaptation and one of their own (Étude, Givre d'étoiles, Trouvaille, Chance de l'aube). Eight other commons change stats and four gain a tag, so that no common is dominated by another with the same effect and Bravoure can be equipped like the other stats. Commons that became power commons are taken off the cards that carried them. Card sheets, the equipment window, placed commons and the departure preview show every power's gains and costs with their figures, and the preview says when a power has no effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f949801c62
commit
9739189f0c
31 changed files with 422 additions and 145 deletions
|
|
@ -284,6 +284,10 @@ export function validateSiteContent(site) {
|
|||
"cards.expeditions.powers.stormLantern",
|
||||
"cards.expeditions.powers.fogBell",
|
||||
"cards.expeditions.powers.attunement",
|
||||
"cards.expeditions.powers.study",
|
||||
"cards.expeditions.powers.starFrost",
|
||||
"cards.expeditions.powers.findings",
|
||||
"cards.expeditions.powers.dawnLuck",
|
||||
"cards.cardSheet.tabs.card",
|
||||
"cards.cardSheet.tabs.improve",
|
||||
"cards.cardSheet.owned",
|
||||
|
|
@ -381,6 +385,23 @@ export function validateSiteContent(site) {
|
|||
"cards.expeditions.powerText.stormLantern",
|
||||
"cards.expeditions.powerText.fogBell",
|
||||
"cards.expeditions.powerText.attunement",
|
||||
"cards.expeditions.powerText.study",
|
||||
"cards.expeditions.powerText.starFrost",
|
||||
"cards.expeditions.powerText.findings",
|
||||
"cards.expeditions.powerText.dawnLuck",
|
||||
"cards.expeditions.powerNotes.dawnLuck",
|
||||
"cards.expeditions.powerNotes.studyCap",
|
||||
"cards.expeditions.powerNotes.studyAwakening",
|
||||
"cards.expeditions.powerNotes.stormLantern",
|
||||
"cards.expeditions.powerNotes.fogBell",
|
||||
"cards.expeditions.powerGain",
|
||||
"cards.expeditions.powerCost",
|
||||
"cards.expeditions.expectedObjects",
|
||||
"cards.expeditions.expectedXp",
|
||||
"cards.cardSheet.equipmentTitle",
|
||||
"cards.cardSheet.equipmentPower",
|
||||
"cards.cardSheet.equipmentSynergy",
|
||||
"cards.cardSheet.equipmentTags",
|
||||
"cards.expeditions.hiddenRequirements",
|
||||
"cards.expeditions.requirementFactor",
|
||||
"cards.expeditions.requirementsUncertain",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { test } from "node:test";
|
|||
import { createCardsApiHandler } from "../services/cards/api.js";
|
||||
import { buildPublishedCatalog, mythicEditionId, prepareVersionedCatalog } from "../services/cards/catalog.js";
|
||||
import { INITIAL_COLLECTION_STATES, INITIAL_DROP_RATES } from "../services/cards/admin-seed.js";
|
||||
import { CardsDatabase } from "../services/cards/database.js";
|
||||
import { CardsDatabase, MIGRATIONS } from "../services/cards/database.js";
|
||||
import { CardsService } from "../services/cards/service.js";
|
||||
import { DEFAULT_EXPEDITION_SETTINGS } from "../services/cards/expedition-settings.js";
|
||||
import { createDiscordAlertSender, dispatchAlerts } from "../services/cards/discord-alerts.js";
|
||||
|
|
@ -1347,6 +1347,47 @@ test("a treasure map brings its rare object back only from a successful expediti
|
|||
assert.deepEqual(service.expeditions.rollReward(expected, settings, { powers: ["treasureMap"], tier: "struggle" }).items, []);
|
||||
});
|
||||
|
||||
test("a collection's own power shows its effect before departure, and Étude counts when the loot is claimed", () => {
|
||||
const { service, player, open, rares, clock, database } = expeditionService();
|
||||
open();
|
||||
const notebook = "astronomers-notebook-standard";
|
||||
const [mask, comb] = ["first-visitor-mask-standard", "red-moon-comb-standard"];
|
||||
database.transaction(() => [notebook, mask, comb].forEach((editionId) => service.addCard(player.id, editionId)));
|
||||
// La fiche d'une commune lit les valeurs des pouvoirs dans l'état du joueur.
|
||||
const { powers, equipment } = service.expeditions.settings;
|
||||
assert.deepEqual(service.getState(player.id).equipmentValues, { ...powers, synergyBonus: equipment.synergyBonus });
|
||||
const preview = (editionId) => {
|
||||
if (editionId) service.expeditions.equip(player.id, { editionId: rares[0], slot: 0, equipmentEditionId: editionId });
|
||||
return service.expeditions.preview(player.id, soloBody(service.expeditions.getExpeditions(player.id), rares[0], { durationHours: 2 })).preview;
|
||||
};
|
||||
const plain = preview(null);
|
||||
assert.equal(plain.expected.xpPct, 10);
|
||||
assert.ok(plain.expected.objects >= 0);
|
||||
assert.equal(plain.tierLootPct, service.expeditions.settings.loot.tierPct[["struggle", "success", "triumph"].indexOf(plain.tier)]);
|
||||
assert.equal(preview(notebook).expected.xpPct, 15);
|
||||
assert.equal(preview(mask).attunement.length, 1);
|
||||
// Aux étoiles faciles, la Chance de l'aube ne change rien.
|
||||
assert.equal(preview(comb).expected.xpPct, 10);
|
||||
service.expeditions.equip(player.id, { editionId: rares[0], slot: 0, equipmentEditionId: notebook });
|
||||
const started = goSolo(service, player.id, soloBody(service.expeditions.getExpeditions(player.id), rares[0], { durationHours: 2 }), "study");
|
||||
clock.now += 2 * HOUR;
|
||||
service.expeditions.claim(player.id, started.expedition.id);
|
||||
assert.equal(service.expeditions.progressOf(player.id, rares[0]).fieldXp, 15);
|
||||
});
|
||||
|
||||
test("commons that became power commons are taken off the cards that carried them", () => {
|
||||
const { service, player, open, rares, database } = expeditionService();
|
||||
open();
|
||||
database.transaction(() => ["astronomers-notebook-standard", "star-compass-standard"].forEach((editionId) => service.addCard(player.id, editionId)));
|
||||
service.expeditions.writeProgress(player.id, rares[0], { level: 6, fieldXp: 0 });
|
||||
["astronomers-notebook-standard", "star-compass-standard"].forEach((equipmentEditionId, slot) => service.expeditions.equip(player.id, { editionId: rares[0], slot, equipmentEditionId }));
|
||||
const version = MIGRATIONS.findIndex((migration) => typeof migration === "string" && migration.includes("DELETE FROM card_equipment WHERE equipment_edition_id IN")) + 1;
|
||||
assert.ok(version > 0);
|
||||
database.db.prepare("DELETE FROM schema_migrations WHERE version = ?").run(version);
|
||||
database.migrate();
|
||||
assert.deepEqual(database.db.prepare("SELECT equipment_edition_id FROM card_equipment WHERE player_id = ?").all(player.id).map((row) => row.equipment_edition_id), ["star-compass-standard"]);
|
||||
});
|
||||
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
applyHazards, cardPower, drawExpeditionDay, editionExpeditionData, efficiency, evaluateTeam, expectedLoot, maxLevel,
|
||||
requirementsFor, resolveDayEntry, rollLoot, roundStochastic, scoreExpedition, splitPower, STAT_IDS, teamStats, upgradeCost, gainProgress, awakeningPower, awakeningsAhead,
|
||||
equipmentBonus, LINEAGES, resonancesOf, teamSynergy, unlockedSlots, bonusLootPct, pickItems, HIDDEN_ITEMS, teamPowers, travelHours, rollRequirementFactor,
|
||||
bonusSlotLevel, levelCount, starsForLevel, planStats, vocationProfile, clampAllocation, allocationError, levelPoints, maxStatPoints, expertiseOf
|
||||
bonusSlotLevel, levelCount, starsForLevel, planStats, vocationProfile, clampAllocation, allocationError, levelPoints, maxStatPoints, expertiseOf, fieldXpPct, tierLootPct, isExpeditionCard
|
||||
} from "../services/cards/expedition-rules.js";
|
||||
import { drawCollectionCard } from "../services/cards/game-rules.js";
|
||||
import {
|
||||
|
|
@ -19,6 +19,7 @@ import { expeditionsPending, guildQuests } from "../website/src/features/cards/g
|
|||
|
||||
const rawCatalog = JSON.parse(await readFile("website/public/data/cards/catalog.json", "utf8"));
|
||||
const catalog = prepareVersionedCatalog(rawCatalog);
|
||||
const siteContent = JSON.parse(await readFile("website/public/data/site.json", "utf8"));
|
||||
const destinationsPath = "services/cards/content/expedition-destinations.json";
|
||||
const destinations = loadExpeditionDestinations(destinationsPath, catalog);
|
||||
const destinationIds = destinations.map((destination) => destination.id);
|
||||
|
|
@ -459,13 +460,29 @@ test("awakening tiers stop levels, duplicates and experience until the card awak
|
|||
|
||||
test("commons carry equipment spread over a fixed budget, and every card has synergy partners", () => {
|
||||
const commons = rawCatalog.cards.filter((card) => card.expedition?.equipment?.stats);
|
||||
assert.equal(commons.length, 75);
|
||||
assert.equal(commons.length, 70);
|
||||
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 ; l'Adaptation est portée par une commune de
|
||||
// trois autres collections.
|
||||
// Les communes des Carnets des Veilleurs portent chacune un pouvoir, et aucune stat. La Nébuleuse, la Longue Nuit, l'Arcade et le
|
||||
// Cortège ont chacun l'Adaptation et un pouvoir à eux ; la Genèse, collection d'événement de quatre communes, n'en a pas.
|
||||
const powered = rawCatalog.cards.filter((card) => card.expedition?.equipment?.power);
|
||||
assert.deepEqual(powered.filter((card) => card.collectionId === "watchers-logbooks").map((card) => card.expedition.equipment.power).sort(), ["fogBell", "longsight", "madCompass", "rations", "starNet", "stormLantern", "talisman", "treasureMap"]);
|
||||
assert.deepEqual(powered.filter((card) => card.expedition.equipment.power === "attunement").map((card) => card.collectionId).sort(), ["dream-arcade", "long-night", "primordial-nebula"]);
|
||||
assert.deepEqual(powered.filter((card) => card.expedition.equipment.power === "attunement").map((card) => card.collectionId).sort(), ["crimson-procession", "dream-arcade", "long-night", "primordial-nebula"]);
|
||||
const own = powered.filter((card) => card.collectionId !== "watchers-logbooks" && card.expedition.equipment.power !== "attunement");
|
||||
assert.deepEqual(Object.fromEntries(own.map((card) => [card.collectionId, card.expedition.equipment.power])), { "primordial-nebula": "study", "long-night": "starFrost", "dream-arcade": "findings", "crimson-procession": "dawnLuck" });
|
||||
assert.equal(own.length, 4);
|
||||
// Chaque pouvoir porté par une commune dit ce qu'il fait, et au moins un gain chiffré.
|
||||
for (const { expedition: { equipment: { power } } } of powered) {
|
||||
const texts = siteContent.cards.expeditions;
|
||||
assert.ok(texts.powers[power] && texts.powerText[power] && texts.powerEffects[power]?.up?.length, power);
|
||||
// Chaque valeur citée existe dans les réglages.
|
||||
for (const line of [...texts.powerEffects[power].up, ...(texts.powerEffects[power].down ?? [])]) for (const [, key] of line.matchAll(/\{(\w+)\}/g)) assert.ok(key in settings.powers, `${power} : ${key}`);
|
||||
}
|
||||
// Deux communes au même effet ne couvrent jamais exactement les mêmes cartes, ou moins : aucune n'est de trop.
|
||||
const team = rawCatalog.cards.filter((card) => isExpeditionCard(catalog, card.id));
|
||||
const reach = (card) => new Set(team.filter((item) => item.expedition.tags.some((tag) => card.expedition.tags.includes(tag))).map((item) => item.id));
|
||||
const effect = ({ stats, synergyStat }) => JSON.stringify([STAT_IDS.map((stat) => stats[stat] ?? 0), synergyStat ?? STAT_IDS.reduce((top, stat) => ((stats[stat] ?? 0) > (stats[top] ?? 0) ? stat : top))]);
|
||||
const dominated = commons.filter((card) => commons.some((other) => other !== card && effect(other.expedition.equipment) === effect(card.expedition.equipment) && reach(card).isSubsetOf(reach(other))));
|
||||
assert.deepEqual(dominated.map((card) => card.id), []);
|
||||
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);
|
||||
|
|
@ -600,6 +617,21 @@ test("powers trade an advantage for a cost and count once per team", () => {
|
|||
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);
|
||||
// Étude : la moitié d'expérience en plus, le butin un peu moins bon.
|
||||
assert.deepEqual([fieldXpPct(6, [], settings), fieldXpPct(6, ["study"], settings)], [30, 45]);
|
||||
assert.equal(loot(["study"]).xpPct, 75);
|
||||
assert.ok(Math.abs(loot(["study"]).eclats - loot([]).eclats * 0.85) < 1e-9 && Math.abs(loot(["study"]).cards - loot([]).cards * 0.85) < 1e-9);
|
||||
// Givre d'étoiles : 2,5 fois la poussière, moins d'Éclats, le reste inchangé.
|
||||
assert.ok(Math.abs(loot(["starFrost"]).stardust - loot([]).stardust * 2.5) < 1e-9 && Math.abs(loot(["starFrost"]).eclats - loot([]).eclats * 0.85) < 1e-9);
|
||||
assert.equal(loot(["starFrost"]).cards, loot([]).cards);
|
||||
// Trouvaille : moitié plus d'objets et un de plus au plafond, moins d'Éclats.
|
||||
assert.ok(Math.abs(loot(["findings"]).objects - loot([]).objects * 1.5) < 1e-9 && Math.abs(loot(["findings"]).eclats - loot([]).eclats * 0.85) < 1e-9);
|
||||
assert.equal(expectedLoot({ hours: 6, stars: 5, tier: "triumph", fortune: 0, slotCount: 1, multiplierPct: 1000, powers: ["findings"] }, settings).objects, 3);
|
||||
// Chance de l'aube : dès 4 ★, un Triomphe rapporte plus et une Réussite moins ; rien ne change en dessous, ni un Retour difficile.
|
||||
assert.deepEqual(["struggle", "success", "triumph"].map((tier) => tierLootPct(tier, 4, ["dawnLuck"], settings)), [40, 85, 202.5]);
|
||||
assert.deepEqual(["struggle", "success", "triumph"].map((tier) => tierLootPct(tier, 3, ["dawnLuck"], settings)), [40, 100, 150]);
|
||||
const dawn = (powers) => expectedLoot({ hours: 6, stars: 4, tier: "triumph", fortune: 0, slotCount: 1, powers }, settings).eclats;
|
||||
assert.ok(Math.abs(dawn(["dawnLuck"]) - dawn([]) * 1.35) < 1e-9);
|
||||
// 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue