Update class mechanics, stat rulesets, and CoA reference catalogs
This commit is contained in:
1 parent
b16821e92e
commit
39458d5de6
221 files changed
+2584962
-568
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { CLASSES, type CoaClassId } from "../src/app/characterCatalog";
|
||||
import {
|
||||
@@ -40,7 +40,7 @@ const coaBudgetsByClass = Object.fromEntries(CLASSES
|
||||
}];
|
||||
}));
|
||||
|
||||
writeJson("src/game/generated/talentRuntimeCatalog.json", {
|
||||
const talentSnapshot = {
|
||||
schemaVersion: 1,
|
||||
maximumCoaLevel: COA_LIVE_SOURCE.maximumLevel,
|
||||
coaBudgetsByClass,
|
||||
@@ -62,4 +62,27 @@ writeJson("src/game/generated/talentRuntimeCatalog.json", {
|
||||
requiredLevel: node.requiredLevel,
|
||||
isPassive: node.isPassive,
|
||||
})),
|
||||
});
|
||||
};
|
||||
|
||||
if (process.argv.includes("--coa-only")) {
|
||||
const previous = JSON.parse(readFileSync("src/game/generated/talentRuntimeCatalog.json", "utf8"));
|
||||
const coaClasses = new Set(CLASSES.filter((definition) => definition.mode === "conquest").map((definition) => definition.id));
|
||||
const coaTrees = new Set(talentSnapshot.trees.filter((tree) => coaClasses.has(tree.classId)).map((tree) => tree.id));
|
||||
function replaceCoa<T>(oldRecords: T[], newRecords: T[], isCoa: (record: T) => boolean): T[] {
|
||||
const result: T[] = [];
|
||||
let inserted = false;
|
||||
for (const record of oldRecords) {
|
||||
if (!isCoa(record)) result.push(record);
|
||||
else if (!inserted) {
|
||||
result.push(...newRecords.filter(isCoa));
|
||||
inserted = true;
|
||||
}
|
||||
}
|
||||
if (!inserted) result.push(...newRecords.filter(isCoa));
|
||||
return result;
|
||||
}
|
||||
talentSnapshot.trees = replaceCoa(previous.trees, talentSnapshot.trees, (tree) => coaClasses.has(tree.classId));
|
||||
talentSnapshot.nodes = replaceCoa(previous.nodes, talentSnapshot.nodes, (node) => coaTrees.has(node.treeId));
|
||||
}
|
||||
|
||||
writeJson("src/game/generated/talentRuntimeCatalog.json", talentSnapshot);
|
||||
Reference in new issue
Block a user