Added spellcasting to the stats page, click the icon next to a spell slot to cast

This commit is contained in:
Stefan Zermatten
2021-01-19 16:10:34 +02:00
parent 1b3b6362f7
commit a4e6dd1d66
11 changed files with 445 additions and 117 deletions

View File

@@ -0,0 +1,17 @@
export default function spellsWithSubheaders(spells = []){
let result = [];
let lastSpell = undefined;
let sortedSpells = [...spells].sort((a, b) => a.level - b.level)
sortedSpells.forEach(spell => {
if (spell.isSubheader) return;
if (!lastSpell || spell.level > lastSpell.level){
result.push({
isSubheader: true,
level: spell.level,
});
}
result.push(spell);
lastSpell = spell;
});
return result;
}