aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-01-06 07:51:11 +0000
committerSean Whitton <spwhitton@spwhitton.name>2019-01-06 07:51:11 +0000
commit19332496290b088cabbe6a26a41211a792b2c8b7 (patch)
tree712bb8e7ca5b829bfc4ed40bc56cf4848154be4e
parentcb6afad1e314728d5294dc6fe61a4408dac6188f (diff)
downloadorg-d20-19332496290b088cabbe6a26a41211a792b2c8b7.tar.gz
add comments
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--org-d20.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/org-d20.el b/org-d20.el
index 398610a..16dcef9 100644
--- a/org-d20.el
+++ b/org-d20.el
@@ -386,12 +386,14 @@ the best N of them, e.g., 4d6k3."
;;; helper functions
+;; convert a signed integer to a string term
(defun org-d20--num-to-term (n)
(let ((k (if (stringp n) (string-to-number n) n)))
(if (>= k 0)
(concat "+" (int-to-string k))
(int-to-string k))))
+;; return the number or letter with which a monster name should be suffixed
(defun org-d20--monster-number (n)
(if (and org-d20-letter-monsters (>= 26 n))
(seq-elt
@@ -400,6 +402,7 @@ the best N of them, e.g., 4d6k3."
(- n 1))
(int-to-string n)))
+;; concat b onto a as a signed term, where a is possibly empty
(defun org-d20--rolls-concat (sign a b)
(if (>= sign 0)
(if (s-blank? a)
@@ -409,6 +412,7 @@ the best N of them, e.g., 4d6k3."
(concat "- " b)
(concat a " - " b))))
+;; bracket a number so it looks a bit like a dice roll result
(defun org-d20--rolls-bracket (sides roll)
(let ((roll* (int-to-string roll)))
(cond ((= sides 4)