1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-21 22:41:28 +00:00

Adding in notes and adding more to blocks

This commit is contained in:
Scott Tolksdorf
2017-02-26 17:42:21 -05:00
parent ef0265f4fa
commit 234d216d64
11 changed files with 215 additions and 25 deletions

View File

@@ -8,11 +8,13 @@
"build": "node scripts/build.js", "build": "node scripts/build.js",
"populate": "node scripts/populate.js", "populate": "node scripts/populate.js",
"snippet" : "nodemon scripts/snippet.test.js",
"prod": "set NODE_ENV=production&& npm run build", "prod": "set NODE_ENV=production&& npm run build",
"postinstall": "npm run build", "postinstall": "npm run build",
"start": "node server.js", "start": "node server.js",
"snippet" : "nodemon scripts/snippet.test.js",
"todo" : "node_modules/.bin/notes -h true -x node_modules/ -x build/",
"test": "mocha tests", "test": "mocha tests",
"test:dev": "nodemon -x mocha tests || exit 0", "test:dev": "nodemon -x mocha tests || exit 0",
"test:markdown": "nodemon -x mocha tests/markdown.test.js || exit 0" "test:markdown": "nodemon -x mocha tests/markdown.test.js || exit 0"

View File

@@ -2,6 +2,7 @@ const snippets = require('../shared/homebrewery/snippets');
console.log(snippets); console.log(snippets);
console.log(snippets.style.print.a4PageSize()); //console.log(snippets.brew.spell());
console.log(snippets.brew.phb.spell()); //console.log(snippets.brew.table());
console.log(snippets.brew.phb.table());
console.log(snippets.brew.noncasterTable());

View File

@@ -5,7 +5,6 @@ const cx = require('classnames');
const SnippetMap = require('./snippet.map.js'); const SnippetMap = require('./snippet.map.js');
const SnippetGroup = require('./snippetGroup/snippetGroup.jsx'); const SnippetGroup = require('./snippetGroup/snippetGroup.jsx');
console.log(SnippetMap);
const Menubar = React.createClass({ const Menubar = React.createClass({
getDefaultProps: function() { getDefaultProps: function() {
return { return {

View File

@@ -11,15 +11,37 @@
} }
} }
} }
.monster{ .monster{
} }
.note{
.useSansSerif();
margin-bottom : 1em;
padding : 5px 10px;
background-color : @green;
border-style : solid;
border-width : 11px;
border-image : @noteBorder 11;
border-image-outset : 9px 0px;
box-shadow : 1px 4px 14px #888;
h2,h3,h4{
.useSansSerif();
color : black;
}
p, ul{
font-size : 0.352cm;
line-height : 1.1em;
}
&.alt{
border-style : solid;
border-width : 7px;
border-image : @descriptiveBorder 12 round;
border-image-outset : 4px;
}
}
.frame{ .frame{
box-sizing : border-box;
margin-top : 30px;
margin-bottom : 37px;
background-color : white; background-color : white;
border : initial; border : initial;
border-style : solid; border-style : solid;
@@ -28,17 +50,18 @@
border-image-slice : 150 200 150 200; border-image-slice : 150 200 150 200;
border-image-source : @frameBorder; border-image-source : @frameBorder;
border-image-width : 47px; border-image-width : 47px;
margin-top : 30px;
margin-bottom : 37px;
box-sizing: border-box;
} }
.wide{ .wide{
column-span : all; column-span : all;
-webkit-column-span : all; -webkit-column-span : all;
-moz-column-span : all; -moz-column-span : all;
} }
.2column, .2col{ .twoCol{
background-color: red;
column-count : 2;
}
.columnSplit{
//TODO: make \column trigger this
} }

View File

@@ -8,8 +8,6 @@
@monsterStatBackground : #FDF1DC; @monsterStatBackground : #FDF1DC;
@teal : blue;
.colorElements(@color){ .colorElements(@color){
table tbody{ table tbody{
@@ -17,8 +15,23 @@
background-color : @color; background-color : @color;
} }
} }
&.note{
background-color: @color;
}
} }
@red : #9c2b1b;
@gold : #c9ad6a; //brown?
@green : #e0e5c1;
@yellow : #faf7ea; //same as background?
@teal : blue;
@blue : blue;
//TODO make a color mixin generator //TODO make a color mixin generator
.teal{ .colorElements(@teal); } .teal{ .colorElements(@teal); }
.blue{ .colorElements(@blue); }
.green{ .colorElements(@green); }
.yellow{ .colorElements(@yellow); }
.gold{ .colorElements(@gold); }
.red{ .colorElements(@red); }

View File

@@ -15,7 +15,7 @@
@import './phb.blocks.less'; @import './phb.blocks.less';
@page { margin: 0; } @page { margin: 0; } //????
.useColumns(@multiplier : 1){ .useColumns(@multiplier : 1){
@@ -171,6 +171,7 @@
//***************************** //*****************************
// * NOTE // * NOTE
// *****************************/ // *****************************/
/*
blockquote{ blockquote{
.useSansSerif(); .useSansSerif();
box-sizing : border-box; box-sizing : border-box;
@@ -187,6 +188,7 @@
line-height : 1.1em; line-height : 1.1em;
} }
} }
*/
//If a note starts a column, give it space at the top to render border //If a note starts a column, give it space at the top to render border
pre+blockquote, h2+blockquote, h3+blockquote, h4+blockquote, h5+blockquote { pre+blockquote, h2+blockquote, h3+blockquote, h4+blockquote, h5+blockquote {
margin-top : 13px; margin-top : 13px;
@@ -416,6 +418,7 @@
//***************************** //*****************************
// * CLASS TABLE // * CLASS TABLE
// *****************************/ // *****************************/
/*
.descriptive{ .descriptive{
display : block-inline; display : block-inline;
margin-bottom : 1em; margin-bottom : 1em;
@@ -447,6 +450,7 @@
pre+.descriptive{ pre+.descriptive{
margin-top : 8px; margin-top : 8px;
} }
*/
//***************************** //*****************************
// * TABLE OF CONTENTS // * TABLE OF CONTENTS
// *****************************/ // *****************************/

View File

@@ -1,2 +1,82 @@
const _ = require('lodash'); const _ = require('lodash');
const Data = require('./random.data.js'); const Data = require('./random.data.js');
const getFeature = (level)=>{
let res = []
if(_.includes([4,6,8,12,14,16,19], level+1)){
res = ['Ability Score Improvement']
}
res = _.union(res, _.sampleSize(Data.abilities, _.sample([0,1,1,1,1,1])));
if(!res.length) return '─';
return res.join(', ');
};
module.exports = {
casterTable : ()=>{
let featureScore = 1
const rows = _.map(Data.levels, (lvlText, level)=>{
featureScore += _.random(0,1);
return '| ' + [
lvlText,
'+'+Math.floor(level/4 + 2),
getFeature(level),
'+'+featureScore
].join(' | ') + ' |';
}).join('\n');
return `{{frame,wide
##### ${Data.rand('classes')}
| Level | Proficiency Bonus | Features | Cantrips Known | Spells Known | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |
|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
${rows}
}}`;
},
halfcasterTable : ()=>{
let featureScore = 1
const rows = _.map(Data.levels, (lvlText, level)=>{
featureScore += _.random(0,1);
return '| ' + [
lvlText,
'+'+Math.floor(level/4 + 2),
getFeature(level),
'+'+featureScore
].join(' | ') + ' |';
}).join('\n');
return `{{frame,wide
##### ${Data.rand('classes')}
| Level | Proficiency Bonus | Features | 1st | 2nd | 3rd | 4th | 5th |
|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:|
${rows}
}}`;
},
noncasterTable : ()=>{
let featureScore = 1
const rows = _.map(Data.levels, (lvlText, level)=>{
featureScore += _.random(0,1);
return '| ' + [
lvlText,
'+'+Math.floor(level/4 + 2),
getFeature(level),
'+'+featureScore
].join(' | ') + ' |';
}).join('\n');
return `{{frame
##### ${Data.rand('classes')}
| Level | Proficiency Bonus | Features | ${Data.rand('abilities')} |
|:---:|:---:|:---|:---:|
${rows}
}}`;
}
}

View File

@@ -2,7 +2,9 @@ const _ = require('lodash');
module.exports = _.merge( module.exports = _.merge(
require('./spell.snippet.js'), require('./spell.snippet.js'),
require('./table.snippet.js') require('./table.snippet.js'),
require('./classTable.snippet.js'),
require('./note.snippet.js')
//wide //wide

View File

@@ -0,0 +1,22 @@
const _ = require('lodash');
const Data = require('./random.data.js');
module.exports = {
note : ()=>{
return `{{note
##### ${Data.rand('abilities')}
${Data.rand('sentences', 6, 4).join(' ')}
}}`
},
altnote : ()=>{
return `{{note,alt
##### ${Data.rand('abilities')}
${Data.rand('sentences', 6, 4).join(' ')}
}}`
}
}

View File

@@ -284,6 +284,39 @@ const Data = {
`Yielding Throw of the Mills`, `Yielding Throw of the Mills`,
], ],
abilities : [
"Astrological Botany",
"Astrological Chemistry",
"Biochemical Sorcery",
"Civil Alchemy",
"Consecrated Biochemistry",
"Demonic Anthropology",
"Divinatory Mineralogy",
"Genetic Banishing",
"Hermetic Geography",
"Immunological Incantations",
"Nuclear Illusionism",
"Ritual Astronomy",
"Seismological Divination",
"Spiritual Biochemistry",
"Statistical Occultism",
"Police Necromancer",
"Sixgun Poisoner",
"Pharmaceutical Gunslinger",
"Infernal Banker",
"Spell Analyst",
"Gunslinger Corruptor",
"Torque Interfacer",
"Exo Interfacer",
"Gunpowder Torturer",
"Orbital Gravedigger",
"Phased Linguist",
"Mathematical Pharmacist",
"Plasma Outlaw",
"Malefic Chemist",
"Police Cultist"
],
alignments : [ alignments : [
"Annoying Evil", "Annoying Evil",
"Chaotic Gossipy", "Chaotic Gossipy",
@@ -309,10 +342,21 @@ const Data = {
], ],
sizes : ['Microscopic', 'Tiny', 'Small', 'Medium', 'Large', 'Gargantuan', 'Stupidly vast'], sizes : ['Microscopic', 'Tiny', 'Small', 'Medium', 'Large', 'Gargantuan', 'Stupidly vast'],
levels : ["1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th", "17th", "18th", "19th", "20th"],
sentences : [
`The suspicion arises the narrator of the tale is actually a demon.`,
`There is a predicted hurricane - but it's not what was expected, and this complicates the plans of the protagonist.`,
`The antagonist's believes their life has changed for the strange - this turns out to be this is due to being lied to by others`,
`An accidental cuddle leads to complications.`,
`It's revealed that everything that is happening is all a dream.`,
`There is a sudden hurricane.`,
`The alternate protagonist is revealed to be a different race/species than thought, which suddenly makes what's going on much clearer.`,
`Thanks to alien forces, the characters end up in the earth's past.`,
`Thanks to alien forces, the secondary protagonist ends up in a world after an apocalypse.`,
`Due to a panic attack a character has to get psychological therapy.`,
]
}; };

View File

@@ -20,7 +20,7 @@ const columns = {
return _.concat([`d${rows}`, ':---:'], _.times(rows, (i)=>i+1)); return _.concat([`d${rows}`, ':---:'], _.times(rows, (i)=>i+1));
}, },
level : (rows)=>{ level : (rows)=>{
return _.concat([`${_.sample(Data.classes)} Level`, ':---:'], _.times(rows, (i)=>`${i*2+3}th`)); return _.concat([`${_.sample(Data.classes)} Level`, ':---:'], _.times(rows, (i)=>Data.levels[i*2]));
}, },
spell : (rows)=>{ spell : (rows)=>{