diff options
-rw-r--r-- | NEWS.md | 5 | ||||
-rw-r--r-- | TODO.md | 1 | ||||
-rw-r--r-- | org-d20.el | 18 |
3 files changed, 21 insertions, 3 deletions
@@ -1,3 +1,8 @@ +0.3 (unreleased) +---------------- + +- New defcustom, `org-d20-letter-monsters` + 0.2 (2018-12-31) ---------------- @@ -2,7 +2,6 @@ Soon ---- - Dice expression roller shows results for each die -- Option to use letters, rather than digits, to individuate monsters - Option to continue numbering/lettering between types of monsters - So there is exactly one monster with a given digit/letter - [Submit to MELPA](https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org#making-your-package-ready-for-inclusion) @@ -55,6 +55,10 @@ (defcustom org-d20-dice-sound nil "Path to a sound file that `play-sound-file' can play.") +(defcustom org-d20-letter-monsters nil + "Individuate up to 26 monsters/NPCs with letters, rather than + with digits.") + (defvar org-d20-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "<f9>") 'org-d20-initiative-dwim) @@ -122,7 +126,9 @@ the best N of them, e.g., 4d6k3." (while (>= monster 1) (let ((hp (int-to-string (org-d20--roll hd-input)))) (push (list - "" (concat name-input " " (int-to-string monster)) + "" (concat name-input + " " + (org-d20--monster-number monster)) (org-d20--num-to-term init-input) init hp "0") rows)) (setq monster (1- monster))))) @@ -281,7 +287,7 @@ the best N of them, e.g., 4d6k3." (org-table-next-field) (insert name-input) (insert " ") - (insert (int-to-string monster)) + (insert (org-d20--monster-number monster)) (org-table-next-field) (insert (org-d20--num-to-term init-input)) (org-table-next-field) @@ -302,6 +308,14 @@ the best N of them, e.g., 4d6k3." (concat "+" (int-to-string k)) (int-to-string k)))) +(defun org-d20--monster-number (n) + (if (and org-d20-letter-monsters (>= 26 n)) + (seq-elt + (list "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" + "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z") + n) + (int-to-string n))) + (defun org-d20-roll-at-point () "Roll the dice expression at point and display result in minibuffer." (interactive) |