mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 03:22:38 +00:00
Update class table generators
This commit is contained in:
@@ -220,34 +220,51 @@ module.exports = [
|
|||||||
view : 'text',
|
view : 'text',
|
||||||
snippets : [
|
snippets : [
|
||||||
{
|
{
|
||||||
name : 'Class Table',
|
name : 'Class Tables',
|
||||||
icon : 'fas fa-table',
|
icon : 'fas fa-table',
|
||||||
gen : ClassTableGen.full('classTable,frame,decoration,wide'),
|
gen : ClassTableGen.full('classTable,frame,decoration,wide'),
|
||||||
},
|
subsnippets : [
|
||||||
{
|
{
|
||||||
name : 'Class Table (unframed)',
|
name : 'Martial Class Table',
|
||||||
icon : 'fas fa-border-none',
|
icon : 'fas fa-table',
|
||||||
gen : ClassTableGen.full('classTable,wide'),
|
gen : ClassTableGen.non('classTable,frame,decoration,wide'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : '1/2 Class Table',
|
name : 'Martial Class Table (unframed)',
|
||||||
icon : 'fas fa-list-alt',
|
icon : 'fas fa-border-none',
|
||||||
gen : ClassTableGen.half('classTable,decoration,frame'),
|
gen : ClassTableGen.non('classTable,wide'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : '1/2 Class Table (unframed)',
|
name : 'Full Caster Class Table',
|
||||||
icon : 'fas fa-border-none',
|
icon : 'fas fa-table',
|
||||||
gen : ClassTableGen.half('classTable'),
|
gen : ClassTableGen.full('classTable,frame,decoration,wide'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : '1/3 Class Table',
|
name : 'Full Caster Class Table (unframed)',
|
||||||
icon : 'fas fa-border-all',
|
icon : 'fas fa-border-none',
|
||||||
gen : ClassTableGen.third('classTable,frame'),
|
gen : ClassTableGen.full('classTable,wide'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : '1/3 Class Table (unframed)',
|
name : 'Half Caster Class Table',
|
||||||
icon : 'fas fa-border-none',
|
icon : 'fas fa-list-alt',
|
||||||
gen : ClassTableGen.third('classTable'),
|
gen : ClassTableGen.half('classTable,decoration,frame,wide'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'Half Caster Class Table (unframed)',
|
||||||
|
icon : 'fas fa-border-none',
|
||||||
|
gen : ClassTableGen.half('classTable,wide'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'Third Caster Spell Table',
|
||||||
|
icon : 'fas fa-border-all',
|
||||||
|
gen : ClassTableGen.third('classTable,frame'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'Third Caster Spell Table (unframed)',
|
||||||
|
icon : 'fas fa-border-none',
|
||||||
|
gen : ClassTableGen.third('classTable'),
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'Rune Table',
|
name : 'Rune Table',
|
||||||
|
|||||||
@@ -40,66 +40,84 @@ const levels = ['1st', '2nd', '3rd', '4th', '5th',
|
|||||||
|
|
||||||
const profBonus = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6];
|
const profBonus = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6];
|
||||||
|
|
||||||
const maxes = [4, 3, 3, 3, 3, 2, 2, 1, 1];
|
|
||||||
|
|
||||||
const drawSlots = function(Slots, rows, padding){
|
|
||||||
let slots = Number(Slots);
|
|
||||||
return _.times(rows, function(i){
|
|
||||||
const max = maxes[i];
|
|
||||||
if(slots < 1) return _.pad('—', padding);
|
|
||||||
const res = _.min([max, slots]);
|
|
||||||
slots -= res;
|
|
||||||
return _.pad(res.toString(), padding);
|
|
||||||
}).join(' | ');
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
full : function(classes){
|
non : function(classes){
|
||||||
const classname = _.sample(classnames);
|
const classname = _.sample(classnames);
|
||||||
|
|
||||||
|
|
||||||
let cantrips = 3;
|
|
||||||
let spells = 1;
|
|
||||||
let slots = 2;
|
|
||||||
return `{{${classes}\n##### The ${classname}\n` +
|
return `{{${classes}\n##### The ${classname}\n` +
|
||||||
`| Level | Proficiency | Features | Cantrips | Spells | --- Spell Slots Per Spell Level ---|||||||||\n`+
|
`| Level | Proficiency | Features |\n`+
|
||||||
`| ^| Bonus ^| ^| Known ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th |\n`+
|
`| ^| Bonus ^| ^|\n`+
|
||||||
`|:-----:|:-----------:|:-------------|:--------:|:------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|\n${
|
`|:-----:|:-----------:|:-------------|\n${
|
||||||
_.map(levels, function(levelName, level){
|
_.map(levels, function(levelName, level){
|
||||||
const res = [
|
const res = [
|
||||||
_.pad(levelName, 5),
|
_.pad(levelName, 5),
|
||||||
_.pad(`+${profBonus[level]}`, 2),
|
_.pad(`+${profBonus[level]}`, 2),
|
||||||
_.padEnd(_.sample(features), 21),
|
_.padEnd(_.sample(features), 21),
|
||||||
_.pad(cantrips.toString(), 8),
|
|
||||||
_.pad(spells.toString(), 6),
|
|
||||||
drawSlots(slots, 9, 2),
|
|
||||||
].join(' | ');
|
].join(' | ');
|
||||||
|
return `| ${res} |`;
|
||||||
|
}).join('\n')}\n}}\n\n`;
|
||||||
|
},
|
||||||
|
|
||||||
cantrips += _.random(0, 1);
|
full : function(classes){
|
||||||
spells += _.random(0, 1);
|
const classname = _.sample(classnames);
|
||||||
slots += _.random(0, 2);
|
|
||||||
|
|
||||||
|
const cantripsKnown = [2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4];
|
||||||
|
const spells = [
|
||||||
|
[2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||||
|
['—', '—', 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', '—', '—', 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 1, 1, 1, 1, 1, 1, 2, 2],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 1, 1, 1, 1, 1, 2],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 1, 1, 1, 1],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 1, 1],
|
||||||
|
];
|
||||||
|
|
||||||
|
return `{{${classes}\n##### The ${classname}\n` +
|
||||||
|
`| Level | Proficiency | Features | Cantrips | --- Spell Slots Per Spell Level ---|||||||||\n`+
|
||||||
|
`| ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th |\n`+
|
||||||
|
`|:-----:|:-----------:|:-------------|:--------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|\n${
|
||||||
|
_.map(levels, function(levelName, level){
|
||||||
|
const res = [
|
||||||
|
_.pad(levelName, 5),
|
||||||
|
_.pad(`+${profBonus[level]}`, 2),
|
||||||
|
_.padEnd(_.sample(features), 21),
|
||||||
|
_.pad(cantripsKnown[level].toString(), 8),
|
||||||
|
spells.map((spellList)=>{
|
||||||
|
return _.pad(spellList[level].toString(), 2);
|
||||||
|
}).join(' | '),
|
||||||
|
].join(' | ');
|
||||||
return `| ${res} |`;
|
return `| ${res} |`;
|
||||||
}).join('\n')}\n}}\n\n`;
|
}).join('\n')}\n}}\n\n`;
|
||||||
},
|
},
|
||||||
|
|
||||||
half : function(classes){
|
half : function(classes){
|
||||||
const classname = _.sample(classnames);
|
const classname = _.sample(classnames);
|
||||||
|
|
||||||
|
const spellsKnown = ['—', 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11];
|
||||||
|
const spells = [
|
||||||
|
['—', 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||||
|
['—', '—', '—', '—', 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 2, 2, 3, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 2, 2],
|
||||||
|
];
|
||||||
|
|
||||||
let featureScore = 1;
|
|
||||||
return `{{${classes}\n##### The ${classname}\n` +
|
return `{{${classes}\n##### The ${classname}\n` +
|
||||||
`| Level | Proficiency Bonus | Features | ${_.pad(_.sample(features), 21)} |\n` +
|
`| Level | Proficiency | Features | Spells | --- Spell Slots Per Spell Level ---|||||\n`+
|
||||||
`|:-----:|:-----------------:|:---------|:---------------------:|\n${
|
`| ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |\n`+
|
||||||
|
`|:-----:|:-----------:|:-------------|:------:|:--:|:--:|:--:|:--:|:--:|\n${
|
||||||
_.map(levels, function(levelName, level){
|
_.map(levels, function(levelName, level){
|
||||||
const res = [
|
const res = [
|
||||||
_.pad(levelName, 5),
|
_.pad(levelName, 5),
|
||||||
_.pad(`+${profBonus[level]}`, 2),
|
_.pad(`+${profBonus[level]}`, 2),
|
||||||
_.padEnd(_.sample(features), 23),
|
_.padEnd(_.sample(features), 21),
|
||||||
_.pad(`+${featureScore}`, 21),
|
_.pad(spellsKnown[level].toString(), 6),
|
||||||
|
spells.map((spellList)=>{
|
||||||
|
return _.pad(spellList[level].toString(), 2);
|
||||||
|
}).join(' | '),
|
||||||
].join(' | ');
|
].join(' | ');
|
||||||
|
|
||||||
featureScore += _.random(0, 1);
|
|
||||||
|
|
||||||
return `| ${res} |`;
|
return `| ${res} |`;
|
||||||
}).join('\n')}\n}}\n\n`;
|
}).join('\n')}\n}}\n\n`;
|
||||||
},
|
},
|
||||||
@@ -107,25 +125,29 @@ module.exports = {
|
|||||||
third : function(classes){
|
third : function(classes){
|
||||||
const classname = _.sample(classnames);
|
const classname = _.sample(classnames);
|
||||||
|
|
||||||
let cantrips = 3;
|
const thirdLevels = levels.slice(2);
|
||||||
let spells = 1;
|
const cantripsKnown = [2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3];
|
||||||
let slots = 2;
|
const spellsKnown = [3, 4, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 11, 12, 13];
|
||||||
|
const spells = [
|
||||||
|
[2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||||
|
['—', '—', '—', '—', 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 2, 2, 2, 3, 3, 3, 3, 3],
|
||||||
|
['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1],
|
||||||
|
];
|
||||||
|
|
||||||
return `{{${classes}\n##### ${classname} Spellcasting\n` +
|
return `{{${classes}\n##### ${classname} Spellcasting\n` +
|
||||||
`| Class | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` +
|
`| Level | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` +
|
||||||
`| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` +
|
`| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` +
|
||||||
`|:------:|:--------:|:-------:|:-------:|:-------:|:-------:|:-------:|\n${
|
`|:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:|\n${
|
||||||
_.map(levels, function(levelName, level){
|
_.map(thirdLevels, function(levelName, level){
|
||||||
const res = [
|
const res = [
|
||||||
_.pad(levelName, 6),
|
_.pad(levelName, 5),
|
||||||
_.pad(cantrips.toString(), 8),
|
_.pad(cantripsKnown[level].toString(), 8),
|
||||||
_.pad(spells.toString(), 7),
|
_.pad(spellsKnown[level].toString(), 6),
|
||||||
drawSlots(slots, 4, 7),
|
spells.map((spellList)=>{
|
||||||
|
return _.pad(spellList[level].toString(), 7);
|
||||||
|
}).join(' | '),
|
||||||
].join(' | ');
|
].join(' | ');
|
||||||
|
|
||||||
cantrips += _.random(0, 1);
|
|
||||||
spells += _.random(0, 1);
|
|
||||||
slots += _.random(0, 1);
|
|
||||||
|
|
||||||
return `| ${res} |`;
|
return `| ${res} |`;
|
||||||
}).join('\n')}\n}}\n\n`;
|
}).join('\n')}\n}}\n\n`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user