38 lines
1 KiB
JavaScript
38 lines
1 KiB
JavaScript
"use strict";
|
|
|
|
(function (global) {
|
|
const rawDefinitions = {
|
|
disease_zunchi: {
|
|
id: "disease_zunchi",
|
|
flag: "zunchiDisease",
|
|
mysteryEligible: true,
|
|
},
|
|
disease_sleep: {
|
|
id: "disease_sleep",
|
|
flag: "sleepDisease",
|
|
mysteryEligible: true,
|
|
},
|
|
disease_explosion: {
|
|
id: "disease_explosion",
|
|
flag: "explosionDisease",
|
|
baseInfectionChance: 0.15,
|
|
mysteryEligible: true,
|
|
},
|
|
disease_fight: {
|
|
id: "disease_fight",
|
|
flag: "fightDisease",
|
|
mysteryEligible: true,
|
|
}
|
|
};
|
|
|
|
class DiseaseRegistry extends global.TarinaiRegistryBase {
|
|
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); }
|
|
}
|
|
|
|
const registry = new DiseaseRegistry(rawDefinitions);
|
|
global.TarinaiDiseaseRegistry = registry;
|
|
})(typeof window !== "undefined" ? window : globalThis);
|