feat: Cards writings and balancing (M8)

This commit is contained in:
gauvainboiche
2026-10-25 18:30:43 +01:00
parent 04193e2013
commit c2103c32e7
43 changed files with 25930 additions and 397 deletions
+15
View File
@@ -0,0 +1,15 @@
// Edits balance.json from the command line and keeps its compact layout.
// node tools/bal-edit.mjs path=value [path=value ...] e.g. gain=2.8 debt.premiumCoef=0.0008
import fs from "node:fs";
import { format } from "./cardfmt.mjs";
const p = new URL("../web/data/balance.json", import.meta.url);
const j = JSON.parse(fs.readFileSync(p, "utf8"));
for (const a of process.argv.slice(2)) {
const [path, val] = a.split("=");
const keys = path.split(".");
let o = j;
for (const k of keys.slice(0, -1)) o = o[k] ??= {};
o[keys.at(-1)] = JSON.parse(val);
}
fs.writeFileSync(p, `${format(j)}\n`);