Let players compare card stats in the collection, rebalance card profiles with a full refunded reset of upgrades, and fix best boosts that sometimes fired in the previous zone
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4a44306e30
commit
3590df5e1e
31 changed files with 1515 additions and 211 deletions
37
scripts/reset-card-progress.mjs
Normal file
37
scripts/reset-card-progress.mjs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* @file Reset complet des améliorations des cartes des Expéditions, avec remboursement (Éclats, doublons, Parchemins d'oubli,
|
||||
* expérience de terrain convertie en Éclats) : simulation par défaut, application avec une sauvegarde préalable.
|
||||
*
|
||||
* Usage : node scripts/reset-card-progress.mjs <base> | <base> --apply --backup <copie>. Sans --apply, affiche ce que
|
||||
* chaque joueur récupérerait sans rien écrire. Avec --apply, sauvegarde d'abord la base vers <copie>, puis applique.
|
||||
* @see services/cards/progress-reset.js
|
||||
*/
|
||||
|
||||
import { join, resolve } from "node:path";
|
||||
import { backupCardsDatabase } from "../services/cards/backup.js";
|
||||
import { loadCardsCatalog } from "../services/cards/catalog.js";
|
||||
import { CardsDatabase } from "../services/cards/database.js";
|
||||
import { applyProgressReset } from "../services/cards/progress-reset.js";
|
||||
import { CardsService } from "../services/cards/service.js";
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const database = args[0];
|
||||
const apply = args.includes("--apply");
|
||||
const backupIndex = args.indexOf("--backup");
|
||||
const backup = backupIndex > 0 ? args[backupIndex + 1] : null;
|
||||
if (!database || database.startsWith("--") || (apply && !backup)) {
|
||||
console.error("Usage: node scripts/reset-card-progress.mjs <database> [--apply --backup <backup path>]");
|
||||
process.exit(1);
|
||||
}
|
||||
if (apply) {
|
||||
await backupCardsDatabase(resolve(database), resolve(backup));
|
||||
console.log(`Backup written to ${resolve(backup)}`);
|
||||
}
|
||||
const service = new CardsService({ database: new CardsDatabase(resolve(database)), catalog: loadCardsCatalog(join(import.meta.dirname, "..", "website", "public", "data", "cards", "catalog.json")) });
|
||||
const report = applyProgressReset(service, { apply });
|
||||
for (const entry of report) {
|
||||
const copies = entry.duplicates.reduce((sum, item) => sum + item.count, 0);
|
||||
console.log(`${entry.name}: ${entry.cards} carte(s) remise(s) à zéro · ${entry.eclats} Éclats payés + ${entry.xpEclats} Éclats d'expérience · ${copies} doublon(s) · ${entry.oblivion} Parchemin(s) d'oubli · ${entry.unequipped} équipement(s) retiré(s)`);
|
||||
for (const item of entry.duplicates) console.log(` ${item.count} × ${item.editionId}`);
|
||||
}
|
||||
console.log(report.length ? (apply ? "Reset applied." : "Dry run: nothing written. Add --apply --backup <path> to apply.") : "No card progress to reset.");
|
||||
Loading…
Add table
Add a link
Reference in a new issue