m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-22 14:49:11 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-22 14:49:11 -0400
commita31c3a1fd44a37cf0fcfff8c1cc52792565247b3 (patch)
treedf238e311a87344e52faf587c6f2165cc4487e4b /src
parent56d36c9129292cd0dd0b5e79eea14d79a4219a94 (diff)
Implement bonusAdd
Diffstat (limited to 'src')
-rw-r--r--src/dice.js9
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