summaryrefslogtreecommitdiff
path: root/.emacs.d/site-lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-11-21 08:49:24 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-11-21 08:49:24 -0700
commitaec7a942707cc18fe2bb9fae35c4f77368520511 (patch)
treeb62d503d518dba9b9239226375df44841f42d9ee /.emacs.d/site-lisp
parent8613614841976e778d381fe3112756b99312f398 (diff)
downloaddotfiles-aec7a942707cc18fe2bb9fae35c4f77368520511.tar.gz
spwd20: number monsters
Diffstat (limited to '.emacs.d/site-lisp')
-rw-r--r--.emacs.d/site-lisp/spwd20.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/.emacs.d/site-lisp/spwd20.el b/.emacs.d/site-lisp/spwd20.el
index 9183a14c..1150b122 100644
--- a/.emacs.d/site-lisp/spwd20.el
+++ b/.emacs.d/site-lisp/spwd20.el
@@ -42,9 +42,7 @@
;;;
;;; # -*- mode: org; mode: spwd20; spwd20-party: (("Zahrat" . 0) ("Anca" . 1)) -*-
-;;; TODO
-;;; number monsters (Wight 1, Wight 2, etc.); dice
-;;; expression roller shows results for each die
+;;; TODO dice expression roller shows results for each die
;;; Code:
@@ -118,13 +116,15 @@ the best N of them, e.g., 4d6k3."
(let ((init (int-to-string
(spwd20--roll (concat
"1d20"
- (spwd20--num-to-term init-input))))))
- (while (> num-input 0)
+ (spwd20--num-to-term init-input)))))
+ (monster num-input))
+ (while (>= monster 1)
(let ((hp (int-to-string (spwd20--roll hd-input))))
(push (list
- "" name-input (spwd20--num-to-term init-input) init hp "0")
+ "" (concat name-input " " (int-to-string monster))
+ (spwd20--num-to-term init-input) init hp "0")
rows))
- (setq num-input (- num-input 1)))))
+ (setq monster (1- monster)))))
while (-all? (lambda (x) (> (length x) 0))
(list name-input init-input hd-input))))
(dolist (pc spwd20-party)
@@ -259,11 +259,14 @@ the best N of them, e.g., 4d6k3."
(let ((init (int-to-string
(spwd20--roll (concat
"1d20"
- (spwd20--num-to-term init-input))))))
- (while (> num-input 0)
+ (spwd20--num-to-term init-input)))))
+ (monster num-input))
+ (while (>= monster 1)
(org-table-insert-row)
(org-table-next-field)
(insert name-input)
+ (insert " ")
+ (insert (int-to-string monster))
(org-table-next-field)
(insert (spwd20--num-to-term init-input))
(org-table-next-field)
@@ -272,7 +275,7 @@ the best N of them, e.g., 4d6k3."
(insert (int-to-string (spwd20--roll hd-input)))
(org-table-next-field)
(insert "0")
- (setq num-input (- num-input 1))))
+ (setq monster (1- monster))))
(org-table-goto-column 4)
(org-table-sort-lines nil ?N)
(org-table-align)))