0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 20:52:40 +00:00

Monster snippet added

This commit is contained in:
Trevor Buckner
2021-04-02 11:02:19 -04:00
parent b0185a9ae4
commit 7ae419716a
3 changed files with 39 additions and 34 deletions

View File

@@ -1,4 +1,5 @@
const _ = require('lodash'); const _ = require('lodash');
const dedent = require('dedent-tabs').default;
const genList = function(list, max){ const genList = function(list, max){
return _.sampleSize(list, _.random(0, max)).join(', ') || 'None'; return _.sampleSize(list, _.random(0, max)).join(', ') || 'None';
@@ -86,7 +87,7 @@ const getAlignment = function(){
}; };
const getStats = function(){ const getStats = function(){
return `>|${_.times(6, function(){ return `|${_.times(6, function(){
const num = _.random(1, 20); const num = _.random(1, 20);
const mod = Math.ceil(num/2 - 5); const mod = Math.ceil(num/2 - 5);
return `${num} (${mod >= 0 ? `+${mod}` : mod})`; return `${num} (${mod >= 0 ? `+${mod}` : mod})`;
@@ -95,12 +96,12 @@ const getStats = function(){
const genAbilities = function(){ const genAbilities = function(){
return _.sample([ return _.sample([
'> ***Pack Tactics.*** These guys work together. Like super well, you don\'t even know.', '***Pack Tactics.*** These guys work together. Like super well, you don\'t even know.',
'> ***Fowl Appearance.*** While the creature remains motionless, it is indistinguishable from a normal chicken.', '***Fowl Appearance.*** While the creature remains motionless, it is indistinguishable from a normal chicken.',
'> ***Onion Stench.*** Any creatures within 5 feet of this thing develops an irrational craving for onion rings.', '***Onion Stench.*** Any creatures within 5 feet of this thing develops an irrational craving for onion rings.',
'> ***Enormous Nose.*** This creature gains advantage on any check involving putting things in its nose.', '***Enormous Nose.*** This creature gains advantage on any check involving putting things in its nose.',
'> ***Sassiness.*** When questioned, this creature will talk back instead of answering.', '***Sassiness.*** When questioned, this creature will talk back instead of answering.',
'> ***Big Jerk.*** Thinks he is just *waaaay* better than you.', '***Big Jerk.*** Thinks he is just *waaaay* better than you.',
]); ]);
}; };
@@ -133,7 +134,7 @@ const genAction = function(){
'Turnbuckle Roll' 'Turnbuckle Roll'
]); ]);
return `> ***${name}.*** *Melee Weapon Attack:* +4 to hit, reach 5ft., one target. *Hit* 5 (1d6 + 2) `; return `***${name}.*** *Melee Weapon Attack:* +4 to hit, reach 5ft., one target. *Hit* 5 (1d6 + 2) `;
}; };
@@ -170,31 +171,29 @@ module.exports = {
}, },
half : function(){ half : function(){
return `${[ return dedent`
'___', {{monster,frame
`> ## ${getMonsterName()}`, ## ${getMonsterName()}
`>*${getType()}, ${getAlignment()}*`, *${getType()}, ${getAlignment()}*
'> ___', ___
`> - **Armor Class** ${_.random(10, 20)}`, : **Armor Class** : ${_.random(10, 20)} (chain mail, shield)
`> - **Hit Points** ${_.random(1, 150)}(1d4 + 5)`, : **Hit Points** : ${_.random(1, 150)}(1d4 + 5)
`> - **Speed** ${_.random(0, 50)}ft.`, : **Speed** : ${_.random(0, 50)}ft.
'>___', ___
'>|STR|DEX|CON|INT|WIS|CHA|', | STR | DEX | CON | INT | WIS | CHA |
'>|:---:|:---:|:---:|:---:|:---:|:---:|', |:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
getStats(), ${getStats()}
'>___', ___
`> - **Condition Immunities** ${genList(['groggy', 'swagged', 'weak-kneed', 'buzzed', 'groovy', 'melancholy', 'drunk'], 3)}`, : **Condition Immunities** : ${genList(['groggy', 'swagged', 'weak-kneed', 'buzzed', 'groovy', 'melancholy', 'drunk'], 3)}
`> - **Senses** passive Perception ${_.random(3, 20)}`, : **Senses** : darkvision 60 ft., passive Perception ${_.random(3, 20)}
`> - **Languages** ${genList(['Common', 'Pottymouth', 'Gibberish', 'Latin', 'Jive'], 2)}`, : **Languages** : ${genList(['Common', 'Pottymouth', 'Gibberish', 'Latin', 'Jive'], 2)}
`> - **Challenge** ${_.random(0, 15)} (${_.random(10, 10000)} XP)`, : **Challenge** : ${_.random(0, 15)} (${_.random(10, 10000)} XP)
'> ___', ___
_.times(_.random(2, 3), function(){ :
return genAbilities(); ${_.times(_.random(2, 3), function(){return genAbilities();}).join('\n\t\t\t\n\t\t\t')}
}).join('\n>\n'), :
'> ### Actions', ### Actions
_.times(_.random(1, 2), function(){ ${_.times(_.random(2, 3), function(){return genAction();}).join('\n\t\t\t\n\t\t\t')}
return genAction(); }}`;
}).join('\n>\n'),
].join('\n')}\n\n\n`;
} }
}; };

5
package-lock.json generated
View File

@@ -3187,6 +3187,11 @@
"mimic-response": "^1.0.0" "mimic-response": "^1.0.0"
} }
}, },
"dedent-tabs": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/dedent-tabs/-/dedent-tabs-0.9.0.tgz",
"integrity": "sha512-XpJr3b3pX6XHK0MDE9/hF2AxAIqzeBhBWqQ22PlzEZFqR31N8x44+e/iML76cwVvhjVqk1BqZeTBS9BrccMJlA=="
},
"deep-extend": { "deep-extend": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",

View File

@@ -48,6 +48,7 @@
"codemirror": "^5.59.4", "codemirror": "^5.59.4",
"cookie-parser": "^1.4.5", "cookie-parser": "^1.4.5",
"create-react-class": "^15.7.0", "create-react-class": "^15.7.0",
"dedent-tabs": "^0.9.0",
"express": "^4.17.1", "express": "^4.17.1",
"express-async-handler": "^1.1.4", "express-async-handler": "^1.1.4",
"express-static-gzip": "2.1.1", "express-static-gzip": "2.1.1",