From 4cf54d6ae8aa09067a4b0dab959ed6a185a9617b Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 2 Aug 2023 21:23:11 +1200 Subject: [PATCH 01/10] Update class table generators --- themes/V3/5ePHB/snippets.js | 73 +++++++----- themes/V3/5ePHB/snippets/classtable.gen.js | 126 ++++++++++++--------- 2 files changed, 119 insertions(+), 80 deletions(-) diff --git a/themes/V3/5ePHB/snippets.js b/themes/V3/5ePHB/snippets.js index 53bb6d3da..ab225ebc7 100644 --- a/themes/V3/5ePHB/snippets.js +++ b/themes/V3/5ePHB/snippets.js @@ -220,34 +220,51 @@ module.exports = [ view : 'text', snippets : [ { - name : 'Class Table', - icon : 'fas fa-table', - gen : ClassTableGen.full('classTable,frame,decoration,wide'), - }, - { - name : 'Class Table (unframed)', - icon : 'fas fa-border-none', - gen : ClassTableGen.full('classTable,wide'), - }, - { - name : '1/2 Class Table', - icon : 'fas fa-list-alt', - gen : ClassTableGen.half('classTable,decoration,frame'), - }, - { - name : '1/2 Class Table (unframed)', - icon : 'fas fa-border-none', - gen : ClassTableGen.half('classTable'), - }, - { - name : '1/3 Class Table', - icon : 'fas fa-border-all', - gen : ClassTableGen.third('classTable,frame'), - }, - { - name : '1/3 Class Table (unframed)', - icon : 'fas fa-border-none', - gen : ClassTableGen.third('classTable'), + name : 'Class Tables', + icon : 'fas fa-table', + gen : ClassTableGen.full('classTable,frame,decoration,wide'), + subsnippets : [ + { + name : 'Martial Class Table', + icon : 'fas fa-table', + gen : ClassTableGen.non('classTable,frame,decoration,wide'), + }, + { + name : 'Martial Class Table (unframed)', + icon : 'fas fa-border-none', + gen : ClassTableGen.non('classTable,wide'), + }, + { + name : 'Full Caster Class Table', + icon : 'fas fa-table', + gen : ClassTableGen.full('classTable,frame,decoration,wide'), + }, + { + name : 'Full Caster Class Table (unframed)', + icon : 'fas fa-border-none', + gen : ClassTableGen.full('classTable,wide'), + }, + { + name : 'Half Caster Class Table', + icon : 'fas fa-list-alt', + 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', diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index c1f6254f9..91cfaaf03 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -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 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 = { - full : function(classes){ + non : function(classes){ const classname = _.sample(classnames); - - let cantrips = 3; - let spells = 1; - let slots = 2; return `{{${classes}\n##### The ${classname}\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`+ - `|:-----:|:-----------:|:-------------|:--------:|:------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|\n${ + `| Level | Proficiency | Features |\n`+ + `| ^| Bonus ^| ^|\n`+ + `|:-----:|:-----------:|:-------------|\n${ _.map(levels, function(levelName, level){ const res = [ _.pad(levelName, 5), _.pad(`+${profBonus[level]}`, 2), _.padEnd(_.sample(features), 21), - _.pad(cantrips.toString(), 8), - _.pad(spells.toString(), 6), - drawSlots(slots, 9, 2), ].join(' | '); + return `| ${res} |`; + }).join('\n')}\n}}\n\n`; + }, - cantrips += _.random(0, 1); - spells += _.random(0, 1); - slots += _.random(0, 2); + full : function(classes){ + const classname = _.sample(classnames); + 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} |`; }).join('\n')}\n}}\n\n`; }, 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` + - `| Level | Proficiency Bonus | Features | ${_.pad(_.sample(features), 21)} |\n` + - `|:-----:|:-----------------:|:---------|:---------------------:|\n${ + `| Level | Proficiency | Features | Spells | --- Spell Slots Per Spell Level ---|||||\n`+ + `| ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |\n`+ + `|:-----:|:-----------:|:-------------|:------:|:--:|:--:|:--:|:--:|:--:|\n${ _.map(levels, function(levelName, level){ const res = [ _.pad(levelName, 5), _.pad(`+${profBonus[level]}`, 2), - _.padEnd(_.sample(features), 23), - _.pad(`+${featureScore}`, 21), + _.padEnd(_.sample(features), 21), + _.pad(spellsKnown[level].toString(), 6), + spells.map((spellList)=>{ + return _.pad(spellList[level].toString(), 2); + }).join(' | '), ].join(' | '); - - featureScore += _.random(0, 1); - return `| ${res} |`; }).join('\n')}\n}}\n\n`; }, @@ -107,25 +125,29 @@ module.exports = { third : function(classes){ const classname = _.sample(classnames); - let cantrips = 3; - let spells = 1; - let slots = 2; + const thirdLevels = levels.slice(2); + const cantripsKnown = [2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]; + 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` + - `| Class | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` + - `| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` + - `|:------:|:--------:|:-------:|:-------:|:-------:|:-------:|:-------:|\n${ - _.map(levels, function(levelName, level){ + `| Level | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` + + `| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` + + `|:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:|\n${ + _.map(thirdLevels, function(levelName, level){ const res = [ - _.pad(levelName, 6), - _.pad(cantrips.toString(), 8), - _.pad(spells.toString(), 7), - drawSlots(slots, 4, 7), + _.pad(levelName, 5), + _.pad(cantripsKnown[level].toString(), 8), + _.pad(spellsKnown[level].toString(), 6), + spells.map((spellList)=>{ + return _.pad(spellList[level].toString(), 7); + }).join(' | '), ].join(' | '); - - cantrips += _.random(0, 1); - spells += _.random(0, 1); - slots += _.random(0, 1); - return `| ${res} |`; }).join('\n')}\n}}\n\n`; } From 4d4371f48c9c6a6781f86eab1a45f5031f5a6a2f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 3 Aug 2023 17:15:14 -0400 Subject: [PATCH 02/10] Compact `features` array --- themes/V3/5ePHB/snippets/classtable.gen.js | 36 ++++++---------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 91cfaaf03..0a1aaf696 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -1,33 +1,15 @@ const _ = require('lodash'); const features = [ - 'Astrological Botany', - 'Biochemical Sorcery', - 'Civil Divination', - 'Consecrated Augury', - 'Demonic Anthropology', - 'Divinatory Mineralogy', - 'Exo Interfacer', - 'Genetic Banishing', - 'Gunpowder Torturer', - 'Gunslinger Corruptor', - 'Hermetic Geography', - 'Immunological Cultist', - 'Malefic Chemist', - 'Mathematical Pharmacy', - 'Nuclear Biochemistry', - 'Orbital Gravedigger', - 'Pharmaceutical Outlaw', - 'Phased Linguist', - 'Plasma Gunslinger', - 'Police Necromancer', - 'Ritual Astronomy', - 'Sixgun Poisoner', - 'Seismological Alchemy', - 'Spiritual Illusionism', - 'Statistical Occultism', - 'Spell Analyst', - 'Torque Interfacer' + 'Astrological Botany', 'Biochemical Sorcery', 'Civil Divination', + 'Consecrated Augury', 'Demonic Anthropology', 'Divinatory Mineralogy', + 'Exo Interfacer', 'Genetic Banishing', 'Gunpowder Torturer', + 'Gunslinger Corruptor', 'Hermetic Geography', 'Immunological Cultist', + 'Malefic Chemist', 'Mathematical Pharmacy', 'Nuclear Biochemistry', + 'Orbital Gravedigger', 'Pharmaceutical Outlaw', 'Phased Linguist', + 'Plasma Gunslinger', 'Police Necromancer', 'Ritual Astronomy', + 'Sixgun Poisoner', 'Seismological Alchemy', 'Spiritual Illusionism', + 'Statistical Occultism', 'Spell Analyst', 'Torque Interfacer' ]; const classnames = ['Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger', From 3eb7ce2775002ac328b7ce6bb7aef3a7c6c53333 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 3 Aug 2023 17:16:26 -0400 Subject: [PATCH 03/10] Clean up indentation --- themes/V3/5ePHB/snippets/classtable.gen.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 0a1aaf696..0dba86b64 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -1,4 +1,5 @@ const _ = require('lodash'); +const dedent = require('dedent-tabs').default; const features = [ 'Astrological Botany', 'Biochemical Sorcery', 'Civil Divination', @@ -13,12 +14,12 @@ const features = [ ]; const classnames = ['Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger', - 'Haberdasher', 'Manicurist', 'Netrunner', 'Weirkeeper']; + '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]; From ee4b2d549ba3c35533c06d02a8ac5c3167dd06ca Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 3 Aug 2023 17:20:38 -0400 Subject: [PATCH 04/10] Make CSS class order consistent on snippets --- themes/V3/5ePHB/snippets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/V3/5ePHB/snippets.js b/themes/V3/5ePHB/snippets.js index ab225ebc7..506bc0edd 100644 --- a/themes/V3/5ePHB/snippets.js +++ b/themes/V3/5ePHB/snippets.js @@ -227,12 +227,12 @@ module.exports = [ { name : 'Martial Class Table', icon : 'fas fa-table', - gen : ClassTableGen.non('classTable,frame,decoration,wide'), + gen : ClassTableGen.non('classTable,frame,decoration'), }, { name : 'Martial Class Table (unframed)', icon : 'fas fa-border-none', - gen : ClassTableGen.non('classTable,wide'), + gen : ClassTableGen.non('classTable'), }, { name : 'Full Caster Class Table', @@ -247,7 +247,7 @@ module.exports = [ { name : 'Half Caster Class Table', icon : 'fas fa-list-alt', - gen : ClassTableGen.half('classTable,decoration,frame,wide'), + gen : ClassTableGen.half('classTable,frame,decoration,wide'), }, { name : 'Half Caster Class Table (unframed)', @@ -257,7 +257,7 @@ module.exports = [ { name : 'Third Caster Spell Table', icon : 'fas fa-border-all', - gen : ClassTableGen.third('classTable,frame'), + gen : ClassTableGen.third('classTable,frame,decoration'), }, { name : 'Third Caster Spell Table (unframed)', From 999f9c8f25363f0b8f8823dd06688f16bb140eec Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 3 Aug 2023 17:22:30 -0400 Subject: [PATCH 05/10] Rename passed in "classes" to "snippetClasses" for clarity --- themes/V3/5ePHB/snippets/classtable.gen.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 0dba86b64..269fc0a12 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -24,10 +24,10 @@ 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]; module.exports = { - non : function(classes){ + non : function(snippetClasses){ const classname = _.sample(classnames); - return `{{${classes}\n##### The ${classname}\n` + + return `{{${snippetClasses}\n##### The ${classname}\n` + `| Level | Proficiency | Features |\n`+ `| ^| Bonus ^| ^|\n`+ `|:-----:|:-----------:|:-------------|\n${ @@ -41,7 +41,7 @@ module.exports = { }).join('\n')}\n}}\n\n`; }, - full : function(classes){ + full : function(snippetClasses){ const classname = _.sample(classnames); const cantripsKnown = [2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]; @@ -57,7 +57,7 @@ module.exports = { ['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 1, 1], ]; - return `{{${classes}\n##### The ${classname}\n` + + return `{{${snippetClasses}\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${ @@ -75,7 +75,7 @@ module.exports = { }).join('\n')}\n}}\n\n`; }, - half : function(classes){ + half : function(snippetClasses){ 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]; @@ -87,7 +87,7 @@ module.exports = { ['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 2, 2], ]; - return `{{${classes}\n##### The ${classname}\n` + + return `{{${snippetClasses}\n##### The ${classname}\n` + `| Level | Proficiency | Features | Spells | --- Spell Slots Per Spell Level ---|||||\n`+ `| ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |\n`+ `|:-----:|:-----------:|:-------------|:------:|:--:|:--:|:--:|:--:|:--:|\n${ @@ -105,7 +105,7 @@ module.exports = { }).join('\n')}\n}}\n\n`; }, - third : function(classes){ + third : function(snippetClasses){ const classname = _.sample(classnames); const thirdLevels = levels.slice(2); @@ -118,7 +118,7 @@ module.exports = { ['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1], ]; - return `{{${classes}\n##### ${classname} Spellcasting\n` + + return `{{${snippetClasses}\n##### ${classname} Spellcasting\n` + `| Level | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` + `| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` + `|:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:|\n${ From 7aca0f2f1058b62f561c7b61603f4604964f71a0 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 3 Aug 2023 19:23:40 -0400 Subject: [PATCH 06/10] Use dedent-tabs --- themes/V3/5ePHB/snippets/classtable.gen.js | 60 ++++++++++++++-------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 269fc0a12..27d1e9153 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -27,10 +27,13 @@ module.exports = { non : function(snippetClasses){ const classname = _.sample(classnames); - return `{{${snippetClasses}\n##### The ${classname}\n` + - `| Level | Proficiency | Features |\n`+ - `| ^| Bonus ^| ^|\n`+ - `|:-----:|:-----------:|:-------------|\n${ + return dedent` + {{${snippetClasses} + ##### The ${classname} + | Level | Proficiency | Features | + | ^| Bonus ^| ^| + |:-----:|:-----------:|:-------------| + ${ _.map(levels, function(levelName, level){ const res = [ _.pad(levelName, 5), @@ -38,7 +41,9 @@ module.exports = { _.padEnd(_.sample(features), 21), ].join(' | '); return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + }).join('\n') + } + }}\n\n`; }, full : function(snippetClasses){ @@ -57,10 +62,13 @@ module.exports = { ['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 1, 1], ]; - return `{{${snippetClasses}\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${ + return dedent` + {{${snippetClasses} + ##### The ${classname} + | Level | Proficiency | Features | Cantrips | --- Spell Slots Per Spell Level ---||||||||| + | ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th | + |:-----:|:-----------:|:-------------|:--------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:| + ${ _.map(levels, function(levelName, level){ const res = [ _.pad(levelName, 5), @@ -72,7 +80,9 @@ module.exports = { }).join(' | '), ].join(' | '); return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + }).join('\n') + } + }}\n\n`; }, half : function(snippetClasses){ @@ -87,10 +97,13 @@ module.exports = { ['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1, 2, 2], ]; - return `{{${snippetClasses}\n##### The ${classname}\n` + - `| Level | Proficiency | Features | Spells | --- Spell Slots Per Spell Level ---|||||\n`+ - `| ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |\n`+ - `|:-----:|:-----------:|:-------------|:------:|:--:|:--:|:--:|:--:|:--:|\n${ + return dedent` + {{${snippetClasses} + ##### The ${classname} + | Level | Proficiency | Features | Spells | --- Spell Slots Per Spell Level ---||||| + | ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th | + |:-----:|:-----------:|:-------------|:------:|:--:|:--:|:--:|:--:|:--:| + ${ _.map(levels, function(levelName, level){ const res = [ _.pad(levelName, 5), @@ -102,7 +115,9 @@ module.exports = { }).join(' | '), ].join(' | '); return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + }).join('\n') + } + }}\n\n`; }, third : function(snippetClasses){ @@ -118,10 +133,13 @@ module.exports = { ['—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', '—', 1, 1], ]; - return `{{${snippetClasses}\n##### ${classname} Spellcasting\n` + - `| Level | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` + - `| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` + - `|:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:|\n${ + return dedent` + {{${snippetClasses} + ##### ${classname} Spellcasting + | Level | Cantrips | Spells |--- Spells Slots per Spell Level ---|||| + | ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | + |:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:| + ${ _.map(thirdLevels, function(levelName, level){ const res = [ _.pad(levelName, 5), @@ -132,6 +150,8 @@ module.exports = { }).join(' | '), ].join(' | '); return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + }).join('\n') + } + }}\n\n`; } }; From e3e250255ee4d63d1abf7d5b2a8d70edf9dbd448 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 3 Aug 2023 23:39:17 -0400 Subject: [PATCH 07/10] Simplify full caster gen --- themes/V3/5ePHB/snippets/classtable.gen.js | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 27d1e9153..719e3fa00 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -51,15 +51,26 @@ module.exports = { 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], + '2 | — | — | — | — | — | — | — | — ', + '3 | — | — | — | — | — | — | — | — ', + '4 | 2 | — | — | — | — | — | — | — ', + '4 | 3 | — | — | — | — | — | — | — ', + '4 | 3 | 2 | — | — | — | — | — | — ', + '4 | 3 | 3 | — | — | — | — | — | — ', + '4 | 3 | 3 | 1 | — | — | — | — | — ', + '4 | 3 | 3 | 2 | — | — | — | — | — ', + '4 | 3 | 3 | 2 | 1 | — | — | — | — ', + '4 | 3 | 3 | 2 | 1 | — | — | — | — ', + '4 | 3 | 3 | 2 | 1 | 1 | — | — | — ', + '4 | 3 | 3 | 2 | 1 | 1 | — | — | — ', + '4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — ', + '4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — ', + '4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — ', + '4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — ', + '4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | 1 ', + '4 | 3 | 3 | 3 | 1 | 1 | 1 | 1 | 1 ', + '4 | 3 | 3 | 3 | 2 | 2 | 1 | 1 | 1 ', + '4 | 3 | 3 | 3 | 2 | 2 | 2 | 1 | 1 ' ]; return dedent` @@ -69,17 +80,8 @@ module.exports = { | ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th | |:-----:|:-----------:|:-------------|:--------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:| ${ - _.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} |`; + _.map(levels, function(level, idx){ + return `| ${_.pad(level, 5)} | +${profBonus[idx]} | ${_.padEnd(_.sample(features), 21)} | ${_.pad(cantripsKnown[idx], 8)} | ${spells[idx]} |`; }).join('\n') } }}\n\n`; From bc9dc8dee9795f03edc85257674a81e7c7e7aba6 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 4 Aug 2023 00:04:17 -0400 Subject: [PATCH 08/10] Clean up half caster gen. --- themes/V3/5ePHB/snippets/classtable.gen.js | 44 ++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 719e3fa00..90363929c 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -92,31 +92,37 @@ module.exports = { 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], + ' — | — | — | — | — ', + ' 2 | — | — | — | — ', + ' 3 | — | — | — | — ', + ' 3 | — | — | — | — ', + ' 4 | 2 | — | — | — ', + ' 4 | 2 | — | — | — ', + ' 4 | 3 | — | — | — ', + ' 4 | 3 | — | — | — ', + ' 4 | 3 | 2 | — | — ', + ' 4 | 3 | 2 | — | — ', + ' 4 | 3 | 3 | — | — ', + ' 4 | 3 | 3 | — | — ', + ' 4 | 3 | 3 | 1 | — ', + ' 4 | 3 | 3 | 1 | — ', + ' 4 | 3 | 3 | 2 | — ', + ' 4 | 3 | 3 | 2 | — ', + ' 4 | 3 | 3 | 3 | 1 ', + ' 4 | 3 | 3 | 3 | 1 ', + ' 4 | 3 | 3 | 3 | 2 ', + ' 4 | 3 | 3 | 3 | 2 ' ]; return dedent` {{${snippetClasses} ##### The ${classname} - | Level | Proficiency | Features | Spells | --- Spell Slots Per Spell Level ---||||| - | ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th | - |:-----:|:-----------:|:-------------|:------:|:--:|:--:|:--:|:--:|:--:| + | Level | Proficiency | Features | Spells |--- Spell Slots Per Spell Level ---||||| + | ^| Bonus ^| ^| Known ^| 1st | 2nd | 3rd | 4th | 5th | + |:-----:|:-----------:|:-------------|:------:|:-----:|:-----:|:-----:|:-----:|:-----:| ${ - _.map(levels, function(levelName, level){ - const res = [ - _.pad(levelName, 5), - _.pad(`+${profBonus[level]}`, 2), - _.padEnd(_.sample(features), 21), - _.pad(spellsKnown[level].toString(), 6), - spells.map((spellList)=>{ - return _.pad(spellList[level].toString(), 2); - }).join(' | '), - ].join(' | '); - return `| ${res} |`; + _.map(levels, function(level, idx){ + return `| ${_.pad(level, 5)} | +${profBonus[idx]} | ${_.padEnd(_.sample(features), 21)} | ${_.pad(spellsKnown[idx], 6)} | ${spells[idx]} |`; }).join('\n') } }}\n\n`; From 0da5de494eadfbcbe606aed45b8c14f82ecbee9e Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 4 Aug 2023 00:23:23 -0400 Subject: [PATCH 09/10] simplify third caster gen --- themes/V3/5ePHB/snippets/classtable.gen.js | 35 ++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 90363929c..8d13d13e2 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -131,14 +131,27 @@ module.exports = { third : function(snippetClasses){ const classname = _.sample(classnames); - const thirdLevels = levels.slice(2); const cantripsKnown = [2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]; 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], + ' 2 | — | — | — ', + ' 3 | — | — | — ', + ' 3 | — | — | — ', + ' 3 | — | — | — ', + ' 4 | 2 | — | — ', + ' 4 | 2 | — | — ', + ' 4 | 2 | — | — ', + ' 4 | 3 | — | — ', + ' 4 | 3 | — | — ', + ' 4 | 3 | — | — ', + ' 4 | 3 | 2 | — ', + ' 4 | 3 | 2 | — ', + ' 4 | 3 | 2 | — ', + ' 4 | 3 | 3 | — ', + ' 4 | 3 | 3 | — ', + ' 4 | 3 | 3 | — ', + ' 4 | 3 | 3 | 1 ', + ' 4 | 3 | 3 | 1 ' ]; return dedent` @@ -148,16 +161,8 @@ module.exports = { | ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | |:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:| ${ - _.map(thirdLevels, function(levelName, level){ - const res = [ - _.pad(levelName, 5), - _.pad(cantripsKnown[level].toString(), 8), - _.pad(spellsKnown[level].toString(), 6), - spells.map((spellList)=>{ - return _.pad(spellList[level].toString(), 7); - }).join(' | '), - ].join(' | '); - return `| ${res} |`; + _.map(levels.slice(2), function(level, idx){ + return `| ${_.pad(level, 5)} | ${_.pad(cantripsKnown[idx], 8)} | ${_.pad(spellsKnown[idx], 6)} | ${spells[idx]} |`; }).join('\n') } }}\n\n`; From 0869f6b29b35a03721a0f61b0ba164c89b3891a1 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 4 Aug 2023 01:19:33 -0400 Subject: [PATCH 10/10] Just... put the whole table in. --- themes/V3/5ePHB/snippets/classtable.gen.js | 210 +++++++++------------ 1 file changed, 89 insertions(+), 121 deletions(-) diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js index 8d13d13e2..1fdff036f 100644 --- a/themes/V3/5ePHB/snippets/classtable.gen.js +++ b/themes/V3/5ePHB/snippets/classtable.gen.js @@ -11,160 +11,128 @@ const features = [ 'Plasma Gunslinger', 'Police Necromancer', 'Ritual Astronomy', 'Sixgun Poisoner', 'Seismological Alchemy', 'Spiritual Illusionism', 'Statistical Occultism', 'Spell Analyst', 'Torque Interfacer' +].map((f)=>_.padEnd(f, 21)); // Pad to equal length of 21 chars long + +const classnames = [ + 'Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger', + 'Haberdasher', 'Manicurist', 'Netrunner', 'Weirkeeper' ]; -const classnames = ['Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger', - '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 profBonus = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6]; - module.exports = { non : function(snippetClasses){ - const classname = _.sample(classnames); - return dedent` {{${snippetClasses} - ##### The ${classname} - | Level | Proficiency | Features | - | ^| Bonus ^| ^| - |:-----:|:-----------:|:-------------| - ${ - _.map(levels, function(levelName, level){ - const res = [ - _.pad(levelName, 5), - _.pad(`+${profBonus[level]}`, 2), - _.padEnd(_.sample(features), 21), - ].join(' | '); - return `| ${res} |`; - }).join('\n') - } + ##### The ${_.sample(classnames)} + | Level | Proficiency Bonus | Features | ${_.sample(features)} | + |:-----:|:-----------------:|:---------|:---------------------:| + | 1st | +2 | ${_.sample(features)} | 2 | + | 2nd | +2 | ${_.sample(features)} | 2 | + | 3rd | +2 | ${_.sample(features)} | 3 | + | 4th | +2 | ${_.sample(features)} | 3 | + | 5th | +3 | ${_.sample(features)} | 3 | + | 6th | +3 | ${_.sample(features)} | 4 | + | 7th | +3 | ${_.sample(features)} | 4 | + | 8th | +3 | ${_.sample(features)} | 4 | + | 9th | +4 | ${_.sample(features)} | 4 | + | 10th | +4 | ${_.sample(features)} | 4 | + | 11th | +4 | ${_.sample(features)} | 4 | + | 12th | +4 | ${_.sample(features)} | 5 | + | 13th | +5 | ${_.sample(features)} | 5 | + | 14th | +5 | ${_.sample(features)} | 5 | + | 15th | +5 | ${_.sample(features)} | 5 | + | 16th | +5 | ${_.sample(features)} | 5 | + | 17th | +6 | ${_.sample(features)} | 6 | + | 18th | +6 | ${_.sample(features)} | 6 | + | 19th | +6 | ${_.sample(features)} | 6 | + | 20th | +6 | ${_.sample(features)} | unlimited | }}\n\n`; }, full : function(snippetClasses){ - const classname = _.sample(classnames); - - 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 | 2 | — | — | — | — | — | — | — ', - '4 | 3 | — | — | — | — | — | — | — ', - '4 | 3 | 2 | — | — | — | — | — | — ', - '4 | 3 | 3 | — | — | — | — | — | — ', - '4 | 3 | 3 | 1 | — | — | — | — | — ', - '4 | 3 | 3 | 2 | — | — | — | — | — ', - '4 | 3 | 3 | 2 | 1 | — | — | — | — ', - '4 | 3 | 3 | 2 | 1 | — | — | — | — ', - '4 | 3 | 3 | 2 | 1 | 1 | — | — | — ', - '4 | 3 | 3 | 2 | 1 | 1 | — | — | — ', - '4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — ', - '4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — ', - '4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — ', - '4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — ', - '4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | 1 ', - '4 | 3 | 3 | 3 | 1 | 1 | 1 | 1 | 1 ', - '4 | 3 | 3 | 3 | 2 | 2 | 1 | 1 | 1 ', - '4 | 3 | 3 | 3 | 2 | 2 | 2 | 1 | 1 ' - ]; - return dedent` {{${snippetClasses} - ##### The ${classname} + ##### The ${_.sample(classnames)} | Level | Proficiency | Features | Cantrips | --- Spell Slots Per Spell Level ---||||||||| | ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th | |:-----:|:-----------:|:-------------|:--------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:| - ${ - _.map(levels, function(level, idx){ - return `| ${_.pad(level, 5)} | +${profBonus[idx]} | ${_.padEnd(_.sample(features), 21)} | ${_.pad(cantripsKnown[idx], 8)} | ${spells[idx]} |`; - }).join('\n') - } + | 1st | +2 | ${_.sample(features)} | 2 | 2 | — | — | — | — | — | — | — | — | + | 2nd | +2 | ${_.sample(features)} | 2 | 3 | — | — | — | — | — | — | — | — | + | 3rd | +2 | ${_.sample(features)} | 2 | 4 | 2 | — | — | — | — | — | — | — | + | 4th | +2 | ${_.sample(features)} | 3 | 4 | 3 | — | — | — | — | — | — | — | + | 5th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 2 | — | — | — | — | — | — | + | 6th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | — | — | — | — | — | — | + | 7th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 1 | — | — | — | — | — | + | 8th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | — | — | — | — | — | + | 9th | +4 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | 1 | — | — | — | — | + | 10th | +4 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | 1 | — | — | — | — | + | 11th | +4 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | — | — | — | + | 12th | +4 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | — | — | — | + | 13th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — | + | 14th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — | + | 15th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — | + | 16th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — | + | 17th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | 1 | + | 18th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 1 | 1 | 1 | 1 | 1 | + | 19th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 2 | 2 | 1 | 1 | 1 | + | 20th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 2 | 2 | 2 | 1 | 1 | }}\n\n`; }, half : function(snippetClasses){ - 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 | 2 | — | — | — ', - ' 4 | 2 | — | — | — ', - ' 4 | 3 | — | — | — ', - ' 4 | 3 | — | — | — ', - ' 4 | 3 | 2 | — | — ', - ' 4 | 3 | 2 | — | — ', - ' 4 | 3 | 3 | — | — ', - ' 4 | 3 | 3 | — | — ', - ' 4 | 3 | 3 | 1 | — ', - ' 4 | 3 | 3 | 1 | — ', - ' 4 | 3 | 3 | 2 | — ', - ' 4 | 3 | 3 | 2 | — ', - ' 4 | 3 | 3 | 3 | 1 ', - ' 4 | 3 | 3 | 3 | 1 ', - ' 4 | 3 | 3 | 3 | 2 ', - ' 4 | 3 | 3 | 3 | 2 ' - ]; - return dedent` {{${snippetClasses} - ##### The ${classname} + ##### The ${_.sample(classnames)} | Level | Proficiency | Features | Spells |--- Spell Slots Per Spell Level ---||||| | ^| Bonus ^| ^| Known ^| 1st | 2nd | 3rd | 4th | 5th | |:-----:|:-----------:|:-------------|:------:|:-----:|:-----:|:-----:|:-----:|:-----:| - ${ - _.map(levels, function(level, idx){ - return `| ${_.pad(level, 5)} | +${profBonus[idx]} | ${_.padEnd(_.sample(features), 21)} | ${_.pad(spellsKnown[idx], 6)} | ${spells[idx]} |`; - }).join('\n') - } + | 1st | +2 | ${_.sample(features)} | — | — | — | — | — | — | + | 2nd | +2 | ${_.sample(features)} | 2 | 2 | — | — | — | — | + | 3rd | +2 | ${_.sample(features)} | 3 | 3 | — | — | — | — | + | 4th | +2 | ${_.sample(features)} | 3 | 3 | — | — | — | — | + | 5th | +3 | ${_.sample(features)} | 4 | 4 | 2 | — | — | — | + | 6th | +3 | ${_.sample(features)} | 4 | 4 | 2 | — | — | — | + | 7th | +3 | ${_.sample(features)} | 5 | 4 | 3 | — | — | — | + | 8th | +3 | ${_.sample(features)} | 5 | 4 | 3 | — | — | — | + | 9th | +4 | ${_.sample(features)} | 6 | 4 | 3 | 2 | — | — | + | 10th | +4 | ${_.sample(features)} | 6 | 4 | 3 | 2 | — | — | + | 11th | +4 | ${_.sample(features)} | 7 | 4 | 3 | 3 | — | — | + | 12th | +4 | ${_.sample(features)} | 7 | 4 | 3 | 3 | — | — | + | 13th | +5 | ${_.sample(features)} | 8 | 4 | 3 | 3 | 1 | — | + | 14th | +5 | ${_.sample(features)} | 8 | 4 | 3 | 3 | 1 | — | + | 15th | +5 | ${_.sample(features)} | 9 | 4 | 3 | 3 | 2 | — | + | 16th | +5 | ${_.sample(features)} | 9 | 4 | 3 | 3 | 2 | — | + | 17th | +6 | ${_.sample(features)} | 10 | 4 | 3 | 3 | 3 | 1 | + | 18th | +6 | ${_.sample(features)} | 10 | 4 | 3 | 3 | 3 | 1 | + | 19th | +6 | ${_.sample(features)} | 11 | 4 | 3 | 3 | 3 | 2 | + | 20th | +6 | ${_.sample(features)} | 11 | 4 | 3 | 3 | 3 | 2 | }}\n\n`; }, third : function(snippetClasses){ - const classname = _.sample(classnames); - - const cantripsKnown = [2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]; - 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 | 2 | — | — ', - ' 4 | 2 | — | — ', - ' 4 | 2 | — | — ', - ' 4 | 3 | — | — ', - ' 4 | 3 | — | — ', - ' 4 | 3 | — | — ', - ' 4 | 3 | 2 | — ', - ' 4 | 3 | 2 | — ', - ' 4 | 3 | 2 | — ', - ' 4 | 3 | 3 | — ', - ' 4 | 3 | 3 | — ', - ' 4 | 3 | 3 | — ', - ' 4 | 3 | 3 | 1 ', - ' 4 | 3 | 3 | 1 ' - ]; - return dedent` {{${snippetClasses} - ##### ${classname} Spellcasting + ##### ${_.sample(classnames)} Spellcasting | Level | Cantrips | Spells |--- Spells Slots per Spell Level ---|||| | ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | |:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:| - ${ - _.map(levels.slice(2), function(level, idx){ - return `| ${_.pad(level, 5)} | ${_.pad(cantripsKnown[idx], 8)} | ${_.pad(spellsKnown[idx], 6)} | ${spells[idx]} |`; - }).join('\n') - } + | 3rd | 2 | 3 | 2 | — | — | — | + | 4th | 2 | 4 | 3 | — | — | — | + | 5th | 2 | 4 | 3 | — | — | — | + | 6th | 2 | 4 | 3 | — | — | — | + | 7th | 2 | 5 | 4 | 2 | — | — | + | 8th | 2 | 6 | 4 | 2 | — | — | + | 9th | 2 | 6 | 4 | 2 | — | — | + | 10th | 3 | 7 | 4 | 3 | — | — | + | 11th | 3 | 8 | 4 | 3 | — | — | + | 12th | 3 | 8 | 4 | 3 | — | — | + | 13th | 3 | 9 | 4 | 3 | 2 | — | + | 14th | 3 | 10 | 4 | 3 | 2 | — | + | 15th | 3 | 10 | 4 | 3 | 2 | — | + | 16th | 3 | 11 | 4 | 3 | 3 | — | + | 17th | 3 | 11 | 4 | 3 | 3 | — | + | 18th | 3 | 11 | 4 | 3 | 3 | — | + | 19th | 3 | 12 | 4 | 3 | 3 | 1 | + | 20th | 3 | 13 | 4 | 3 | 3 | 1 | }}\n\n`; } };