183 lines
4.4 KiB
JavaScript
183 lines
4.4 KiB
JavaScript
import spellsFile from "./homebrew/SCGtD/spells.json" assert { type: "json" };
|
|
import fs from "fs";
|
|
|
|
const spells = spellsFile.spell;
|
|
|
|
const spellsByClass = new Map(Object.entries({
|
|
Bard: [
|
|
"Toxic Shield",
|
|
"Grasping Ghost",
|
|
"Purge Contamination",
|
|
"Blood Worm",
|
|
"Neutralizing Field",
|
|
"Contamination Immunity",
|
|
"Breath of Nightshade"
|
|
],
|
|
Cleric: [
|
|
"Stream of consumption",
|
|
"Grasping ghost",
|
|
"Invigorate",
|
|
"Purge contamination",
|
|
"Last Rites",
|
|
"Neutralizing Field",
|
|
"Contamination Immunity",
|
|
"Grievous Wounds",
|
|
"Touch of death",
|
|
],
|
|
Druid: [
|
|
"Poison Needle",
|
|
"Bacterial Barrage",
|
|
"Envenom",
|
|
"Infect",
|
|
"Biohazard",
|
|
"Invigorate",
|
|
"Pestilence",
|
|
"Purge Contamination",
|
|
"Venomous aura",
|
|
"Blood worm",
|
|
"Corrupting spores",
|
|
"Poison wave",
|
|
"Summon the thing with the writhing tail",
|
|
"Acid rain",
|
|
"Neutralizing Field",
|
|
"Mephitic vapors",
|
|
"Contamination Immunity",
|
|
"Plague wind",
|
|
"Pandemic",
|
|
],
|
|
Paladin: [
|
|
"Toxic shield",
|
|
"Invigorate",
|
|
"Purge Contamination",
|
|
"Last Rites",
|
|
"Neutralizing Field",
|
|
],
|
|
Ranger: [
|
|
"Acrid Orb",
|
|
"Biohazard",
|
|
"Fetid blade",
|
|
"Purge Contamination",
|
|
"Corrupting spores",
|
|
"Toxic barrage",
|
|
"Neutralizing Field",
|
|
],
|
|
Sorcerer: [
|
|
"Acid burn",
|
|
"Bacterial barrage",
|
|
"Poison needle",
|
|
"Acrid orb",
|
|
"Envenom",
|
|
"Infect",
|
|
"Biohazard",
|
|
"Caustic grip",
|
|
"Ocular necrosis",
|
|
"Corrosive blast",
|
|
"Pestilence",
|
|
"Purge Contamination",
|
|
"Vitriolic ichor",
|
|
"Poison wave",
|
|
"Nerve gas",
|
|
"Neutralizing Field",
|
|
"Toxic barrage",
|
|
"Septic shock",
|
|
"Mephitic vapors",
|
|
"Vile necrosis",
|
|
"Miasma",
|
|
"Contamination Immunity",
|
|
"Plague wind",
|
|
"Touch of death",
|
|
],
|
|
Warlock: [
|
|
"Poison needle",
|
|
"Acrid orb",
|
|
"Stream of consumption",
|
|
"Toxic shield",
|
|
"Caustic grip",
|
|
"Grasping ghost",
|
|
"Fetid blade",
|
|
"Pestilence",
|
|
"Purge Contamination",
|
|
"Blood worm",
|
|
"Corpse explosion",
|
|
"Summon the thing with the writhing tail",
|
|
"Nerve gas",
|
|
"Neutralizing Field",
|
|
"Septic shock",
|
|
"Mephitic vapors",
|
|
"Vile necrosis",
|
|
"Contamination Immunity",
|
|
"Grievous Wounds",
|
|
"Breath of nightshade",
|
|
"Touch of death",
|
|
],
|
|
Wizard: [
|
|
"Acid burn",
|
|
"Bacterial barrage",
|
|
"Poison needle",
|
|
"Acrid orb",
|
|
"Envenom",
|
|
"Infect",
|
|
"Stream of consumption",
|
|
"Biohazard",
|
|
"Caustic grip",
|
|
"Invigorate",
|
|
"Ocular necrosis",
|
|
"Corrosive blast",
|
|
"Pestilence",
|
|
"Purge Contamination",
|
|
"Tranquilizing toxin",
|
|
"Corpse explosion",
|
|
"Poison wave",
|
|
"Summon the thing with the writhing tail",
|
|
"Vitriolic ichor",
|
|
"Acid rain",
|
|
"Neutralizing Field",
|
|
"Nerve gas",
|
|
"Septic shock",
|
|
"Toxic barrage",
|
|
"Mephitic vapours",
|
|
"Vile necrosis",
|
|
"Contamination Immunity",
|
|
"Grievous wounds",
|
|
"Miasma",
|
|
"Breath of nightshade",
|
|
"Plague wind",
|
|
"Pandemic",
|
|
"Touch of death",
|
|
],
|
|
}));
|
|
|
|
const classesPerSpell = new Map();
|
|
|
|
// console.log({ spellsByClass, spells });
|
|
spellsByClass.forEach((spells, cl) => {
|
|
spells.forEach((spell) => {
|
|
let clList = [];
|
|
if (classesPerSpell.has(spell.toLowerCase())) {
|
|
clList = classesPerSpell.get(spell.toLowerCase());
|
|
}
|
|
clList.push({ name: cl, source: "PHB" });
|
|
classesPerSpell.set(spell.toLowerCase(), clList);
|
|
})
|
|
});
|
|
|
|
const spellsWithClassList = spells.map((spell) => {
|
|
// console.log(spell.name);
|
|
// spellsByClass.forEach((a,b) => console.log(a,b));
|
|
|
|
const classes = classesPerSpell.get(spell.name.toLowerCase());
|
|
console.log(spell.name, classes);
|
|
|
|
return {
|
|
...spell,
|
|
classes: {
|
|
"fromClassList": classes
|
|
},
|
|
};
|
|
});
|
|
|
|
|
|
|
|
fs.writeFileSync("spells.generated.json", JSON.stringify(spellsWithClassList, null, 4), {
|
|
encoding: "utf8",
|
|
}); |