aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-01-06 10:34:35 +0000
committerSean Whitton <spwhitton@spwhitton.name>2019-01-06 10:34:35 +0000
commitb2dc59d0f89a69069ca8fd52caa68a4c68034ada (patch)
treebf2c7fcf08980a26ee1a4e6e0cd72719e2e86096
parent373361744e144bcee5327a07f4c1c3792299d775 (diff)
downloadorg-d20-b2dc59d0f89a69069ca8fd52caa68a4c68034ada.tar.gz
Bug fix: make roll20's 'k' notation actually have an effect
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--NEWS.md1
-rw-r--r--org-d20.el7
2 files changed, 4 insertions, 4 deletions
diff --git a/NEWS.md b/NEWS.md
index f047dcd..b912d6d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,7 @@
- Bug fix: off-by-one error in call to `random`
- This meant that the maximum value on a dice could never be
rolled. Now monsters can critically hit players again.
+- Bug fix: make roll20's 'k' notation actually have an effect
- Change default keybindings to match Emacs conventions
- Avoid binding to <f9>
diff --git a/org-d20.el b/org-d20.el
index b8b79d9..863b8c9 100644
--- a/org-d20.el
+++ b/org-d20.el
@@ -129,10 +129,9 @@ the best N of them, e.g., 4d6k3."
(let ((rolls*
(org-d20--rolls-concat sign rolls (int-to-string times))))
(cons rolls* (+ total (* sign times))))
- (while (> times 0)
- (let ((new-roll (1+ (random sides))))
- (push new-roll new-rolls))
- (setq times (1- times)))
+ (loop repeat times
+ do (let ((new-roll (1+ (random sides))))
+ (push new-roll new-rolls)))
(when keep
;; TODO: This should drop the items without reordering the
;; list (spw 2019-01-05)