diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 14:49:11 -0400 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 14:49:11 -0400 |
commit | a31c3a1fd44a37cf0fcfff8c1cc52792565247b3 (patch) | |
tree | df238e311a87344e52faf587c6f2165cc4487e4b /src | |
parent | 56d36c9129292cd0dd0b5e79eea14d79a4219a94 (diff) |
Implement bonusAdd
Diffstat (limited to 'src')
-rw-r--r-- | src/dice.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dice.js b/src/dice.js index 5e3b975..14addd4 100644 --- a/src/dice.js +++ b/src/dice.js @@ -75,6 +75,14 @@ const keepHigh = (die1, die2) => { } } +const bonusAdd = (die1, die2) => { + return () => { + return die1().map(die => { + return () => die() + roll(die2) + }) + } +} + exports.pool = pool exports.roll = roll exports.constant = constant @@ -84,3 +92,4 @@ exports.subtract = subtract exports.negative = negative exports.explode = explode exports.keepHigh = keepHigh +exports.bonusAdd = bonusAdd |