m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/dice.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/dice.js')
-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