This commit is contained in:
33333-33333 2026-06-22 02:03:19 +09:00
commit e8f1d1db1e
60 changed files with 2417 additions and 612 deletions

View file

@ -45,14 +45,16 @@
}
};
class DiseaseRegistry {
constructor(defs) { this.defs = new Map(Object.entries(defs || {})); }
get(id = "") { return this.defs.get(String(id || "")) || null; }
class DiseaseRegistry extends global.TarinaiRegistryBase {
byFlag(flag = "") { return [...this.defs.values()].find(def => def.flag === flag) || null; }
label(id = "") { return this.get(id)?.label || id || ""; }
color(id = "") { return this.get(id)?.color || "rgba(255,242,160,0.85)"; }
label(id = "") { return super.label(id, id || ""); }
color(id = "") { return super.color(id, "rgba(255,242,160,0.85)"); }
infectionChance(id = "", fallback = 0) {
const value = this.get(id)?.baseInfectionChance;
return Number.isFinite(value) ? value : fallback;
}
mysteryPool() { return [...this.defs.values()].filter(def => def.mysteryEligible).map(def => def.id); }
debugSnapshot() { return [...this.defs.values()].map(def => ({ id: def.id, label: def.label, flag: def.flag, cures: def.cureRules || [] })); }
debugSnapshot() { return super.debugSnapshot((id, def) => ({ id: def.id || id, label: def.label, flag: def.flag, cures: def.cureRules || [] })); }
}
const registry = new DiseaseRegistry(rawDefinitions);