Add Aniimo guides and link game cards to toolbox checklists
Some checks failed
Deploy Sokko G / deploy (push) Failing after 3s

This commit is contained in:
Shinuwa 2026-09-23 20:05:19 +02:00
parent f0797ccf14
commit 13434f72f6
278 changed files with 10025 additions and 57 deletions

View file

@ -5,6 +5,48 @@ const SNAKE_CASE_RE = /^[a-z0-9]+(?:_[a-z0-9]+)*$/;
const PHYSICAL_HITZONE_KEYS = ["cut", "blunt", "ammo"];
const ELEMENTAL_HITZONE_KEYS = ["fire", "water", "thunder", "ice", "dragon"];
export function validateAniimoData(aniimos, dictionaries) {
assert.ok(Array.isArray(aniimos) && aniimos.length > 0, "Aniimo data must contain entries");
const ids = new Set();
const names = new Set();
function translated(key) {
assert.match(key, SNAKE_CASE_RE);
for (const dictionary of dictionaries) assertNonEmptyString(dictionary, key);
}
for (const aniimo of aniimos) {
assert.match(aniimo.id, /^\d+$/);
assert.ok(!ids.has(aniimo.id), `Duplicate Aniimo id: ${aniimo.id}`);
assert.ok(!names.has(aniimo.name), `Duplicate Aniimo name: ${aniimo.name}`);
ids.add(aniimo.id);
names.add(aniimo.name);
translated(aniimo.name);
assert.ok(Array.isArray(aniimo.variations) && aniimo.variations.length > 0);
const forms = new Set();
for (const variation of aniimo.variations) {
const stats = variation.attributes?.stats;
assert.deepEqual(Object.keys(stats || {}).sort(), ["atk", "break", "hp", "m_def", "p_def", "regen"], "Aniimo must have six stats");
assert.ok(Object.values(stats).every((value) => Number.isInteger(value) && value >= 0), "Stats must be nonnegative integers");
assert.equal(variation.attributes.total, Object.values(stats).reduce((sum, value) => sum + value, 0), "Stats total must equal their sum");
assert.ok(!forms.has(variation.form), `Duplicate form: ${aniimo.name}/${variation.form}`);
forms.add(variation.form);
translated(variation.form);
translated(variation.role);
assertStringArray(variation, "elements");
assert.equal(new Set(variation.elements).size, variation.elements.length);
variation.elements.forEach(translated);
assert.ok(Array.isArray(variation.homeland_abilities));
const types = new Set();
for (const ability of variation.homeland_abilities) {
translated(ability.type);
assert.ok(!types.has(ability.type), `Duplicate ability: ${ability.type}`);
types.add(ability.type);
assert.ok(Number.isInteger(ability.level) && ability.level >= 1 && ability.level <= 4, "Ability level must be an integer between 1 and 4");
}
}
if (forms.has("prismana_form")) assert.equal(aniimo.variations.at(-1).form, "prismana_form", `Prismana must be last: ${aniimo.name}`);
}
}
function valueAt(object, path) {
return path.split(".").reduce((value, key) => value?.[key], object);
}
@ -47,6 +89,53 @@ export function validateSiteContent(site) {
"gamesPage.description",
"gamesPage.emptyTitle",
"gamesPage.emptyText",
"guideChecklist.label",
"guideChecklist.untitled",
"guideChecklist.none",
"guideChecklist.linkToolbox",
"guideChecklist.noCompatible",
"guideChecklist.noMatches",
"guideChecklist.matches",
"guideChecklist.unlink",
"guideChecklist.hideCompleted",
"guideChecklist.completed",
"aniimo.copyChecklist",
"aniimo.copyVariantsChecklist",
"aniimo.statsTitle",
"aniimo.statsTotal",
"aniimo.stats.hp",
"aniimo.stats.atk",
"aniimo.stats.p_def",
"aniimo.stats.m_def",
"aniimo.stats.break",
"aniimo.stats.regen",
"aniimo.title",
"aniimo.description",
"aniimo.homeDescription",
"aniimo.filters",
"aniimo.name",
"aniimo.searchPlaceholder",
"aniimo.elements",
"aniimo.roles",
"aniimo.role",
"aniimo.abilities",
"aniimo.minimum",
"aniimo.abilityLevelsHint",
"aniimo.abilityDisabled",
"aniimo.level",
"aniimo.match",
"aniimo.and",
"aniimo.or",
"aniimo.reset",
"aniimo.groupVariants",
"aniimo.variants",
"aniimo.results",
"aniimo.emptyTitle",
"aniimo.emptyText",
"aniimo.loading",
"aniimo.error",
"aniimo.showFront",
"aniimo.showBack",
"library.eyebrow",
"library.title",
"library.description",