diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-11-12 21:53:08 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-11-12 21:53:08 -0700 |
commit | a3734368cd5a36541dab2fa8f7404cb850991b5b (patch) | |
tree | 57bf1833d1b474b359481b9c009cfbf6cc402aac | |
parent | af5e2afb8c862f348da75c25cb0a71fb444fe2a7 (diff) | |
download | org-d20-a3734368cd5a36541dab2fa8f7404cb850991b5b.tar.gz |
org-d20-d20: show d4 in case Bless spell is active
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | NEWS.md | 1 | ||||
-rw-r--r-- | org-d20.el | 13 |
2 files changed, 12 insertions, 2 deletions
@@ -2,6 +2,7 @@ ---------------- - New defcustom, `org-d20-display-rolls-buffer`. +- `org-d20-d20` shows the result of rolling a d4 in case /Bless/ is active. - Replace some calls to `loop` with calls to `cl-loop`. - Other code cleanup. @@ -210,16 +210,25 @@ the best N of them, e.g., 4d6k3." (interactive) (let* ((fst (cdr (org-d20--roll "1d20"))) (snd (cdr (org-d20--roll "1d20"))) + (bls (cdr (org-d20--roll "1d4"))) (fst* (int-to-string fst)) (snd* (int-to-string snd)) + (bls* (int-to-string bls)) (adv (if (>= fst snd) (concat (propertize fst* 'face 'bold) " " snd*) (concat fst* " " (propertize snd* 'face 'bold)))) (disadv (if (<= fst snd) (concat (propertize fst* 'face 'bold) " " snd*) (concat fst* " " (propertize snd* 'face 'bold))))) - (org-d20--record-roll "No adv./disadv.: %s\tAdv.: %s\tDisadv.: %s" - fst* adv disadv)) + (org-d20--record-roll + "No adv./disadv.: %s%sAdv.: %s%sDisadv.: %s%sBless: %s" + fst* + (make-string (- 4 (length fst*)) ?\ ) + adv + (make-string (- 8 (length adv)) ?\ ) + disadv + (make-string (- 10 (length disadv)) ?\ ) + bls*)) (when org-d20-dice-sound (play-sound-file org-d20-dice-sound))) |