0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-08 03:12:40 +00:00

Shrink tables width

This commit is contained in:
Trevor Buckner
2021-08-31 16:39:13 -04:00
parent e5cfa98bbd
commit f5057119da

View File

@@ -2,7 +2,6 @@ const _ = require('lodash');
const features = [ const features = [
'Astrological Botany', 'Astrological Botany',
'Astrological Chemistry',
'Biochemical Sorcery', 'Biochemical Sorcery',
'Civil Divination', 'Civil Divination',
'Consecrated Augury', 'Consecrated Augury',
@@ -31,23 +30,16 @@ const features = [
'Torque Interfacer' 'Torque Interfacer'
]; ];
const classnames = ['Archivist', 'Fancyman', 'Linguist', 'Fletcher', const classnames = ['Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger',
'Notary', 'Berserker-Typist', 'Fishmongerer', 'Manicurist', 'Haberdasher', 'Concierge']; 'Haberdasher', 'Manicurist', 'Netrunner', 'Weirkeeper'];
const levels = ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th', '11th', '12th', '13th', '14th', '15th', '16th', '17th', '18th', '19th', '20th']; const levels = ['1st', '2nd', '3rd', '4th', '5th',
'6th', '7th', '8th', '9th', '10th',
'11th', '12th', '13th', '14th', '15th',
'16th', '17th', '18th', '19th', '20th'];
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 getFeature = (level)=>{
let res = [];
if(_.includes([4, 6, 8, 12, 14, 16, 19], level+1)){
res = ['Ability Score Improvement'];
}
res = _.union(res, _.sampleSize(features, _.sample([0, 1, 1, 1, 1, 1])));
if(!res.length) return '─';
return res.join(', ');
};
const maxes = [4, 3, 3, 3, 3, 2, 2, 1, 1]; const maxes = [4, 3, 3, 3, 3, 2, 2, 1, 1];
const drawSlots = function(Slots, rows, padding){ const drawSlots = function(Slots, rows, padding){
@@ -70,17 +62,17 @@ module.exports = {
let spells = 1; let spells = 1;
let slots = 2; 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 | Cantrips | Spells | --- Spell Slots Per Spell Level ---|||||||||\n`+
`| ^| Bonus ^| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n`+ `| ^| Bonus ^| ^| Known ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th |\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]}`, 11), _.pad(`+${profBonus[level]}`, 2),
_.padEnd(getFeature(level), 48), _.padEnd(_.sample(features), 21),
_.pad(cantrips.toString(), 8), _.pad(cantrips.toString(), 8),
_.pad(spells.toString(), 6), _.pad(spells.toString(), 6),
drawSlots(slots, 9, 3), drawSlots(slots, 9, 2),
].join(' | '); ].join(' | ');
cantrips += _.random(0, 1); cantrips += _.random(0, 1);
@@ -96,14 +88,14 @@ module.exports = {
let featureScore = 1; let featureScore = 1;
return `{{${classes}\n##### The ${classname}\n` + return `{{${classes}\n##### The ${classname}\n` +
`| Level | Proficiency Bonus | Features | ${_.pad(_.sample(features), 26)} |\n` + `| Level | Proficiency Bonus | Features | ${_.pad(_.sample(features), 21)} |\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]}`, 17), _.pad(`+${profBonus[level]}`, 2),
_.padEnd(getFeature(level), 48), _.padEnd(_.sample(features), 23),
_.pad(`+${featureScore}`, 26), _.pad(`+${featureScore}`, 21),
].join(' | '); ].join(' | ');
featureScore += _.random(0, 1); featureScore += _.random(0, 1);
@@ -119,15 +111,15 @@ module.exports = {
let spells = 1; let spells = 1;
let slots = 2; let slots = 2;
return `{{${classes}\n##### ${classname} Spellcasting\n` + return `{{${classes}\n##### ${classname} Spellcasting\n` +
`| Class | Cantrips | Spells | --- Spells Slots per Spell Level --- ||||\n` + `| Class | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` +
`| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` + `| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` +
`|:------:|:--------:|:-------:|:--------:|:--------:|:--------:|:--------:|\n${ `|:------:|:--------:|:-------:|:-------:|:-------:|:-------:|:-------:|\n${
_.map(levels, function(levelName, level){ _.map(levels, function(levelName, level){
const res = [ const res = [
_.pad(levelName, 6), _.pad(levelName, 6),
_.pad(cantrips.toString(), 8), _.pad(cantrips.toString(), 8),
_.pad(spells.toString(), 7), _.pad(spells.toString(), 7),
drawSlots(slots, 4, 8), drawSlots(slots, 4, 7),
].join(' | '); ].join(' | ');
cantrips += _.random(0, 1); cantrips += _.random(0, 1);