├── Docs ├── battleboard │ └── Battleboard.odg ├── Maps │ ├── test │ │ ├── watermap.org │ │ ├── watertiles.org │ │ ├── bigwater-map.org │ │ └── water-test.org │ ├── defaultfeatures.svg │ ├── map-styles.org │ ├── testmap.alt.org │ ├── testmap.org │ ├── bigwater.svg │ └── Design.org ├── Tables │ └── Savingthrow.org ├── Table-Design.org ├── Misc │ ├── Abbreviations.org │ ├── SavingThrow.org │ └── index.org ├── Baddies │ ├── aliens.org │ └── Chamber.org ├── Treasure │ ├── generator.org │ └── Relic.org └── savannah-app.org ├── fosshost-bling ├── fosshost.org_Cloud_Dark.png ├── fosshost.org_Host_Dark.png ├── fosshost.org_Host_Light.png ├── fosshost.org_Team_Dark.png ├── fosshost.org_Team_Light.png ├── fosshost.org_Cloud_Light.png ├── fosshost.org_Cloud_Logo_Dark.png ├── fosshost.org_Host_Logo_Dark.png ├── fosshost.org_Host_Logo_Light.png ├── fosshost.org_Cloud_Logo_Light.png └── LICENSE ├── .gitignore ├── emacs-init-scripts ├── user │ ├── init-dm.el │ └── sample-init.el └── development │ └── bootstrap.el ├── src ├── dm-test-util.el ├── dm-util-tests--remove-keywords.el ├── dm-util-tests--coalesce-hash.el ├── dm-object-to-org.el ├── dm-svg-tests.el ├── dm-svg.el ├── dm-util.el ├── ox-ox-test.el └── dm-table.el ├── t └── org │ ├── maps-tiles--04_table-striping.org │ ├── maps-03_svg.org │ ├── maps-01_cell-path.org │ ├── maps-02_tile-path.org │ ├── maps-04_river.org │ ├── maps-05_ramps_overdraw.org │ └── maps-06_0.0_does_not_render.org ├── testmap.org ├── test.svg └── dungeon-game.org /Docs/battleboard/Battleboard.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/Docs/battleboard/Battleboard.odg -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Cloud_Dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Cloud_Dark.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Host_Dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Host_Dark.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Host_Light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Host_Light.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Team_Dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Team_Dark.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Team_Light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Team_Light.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Cloud_Light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Cloud_Light.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Cloud_Logo_Dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Cloud_Logo_Dark.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Host_Logo_Dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Host_Logo_Dark.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Host_Logo_Light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Host_Logo_Light.png -------------------------------------------------------------------------------- /fosshost-bling/fosshost.org_Cloud_Logo_Light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mplscorwin/dungeon-mode/HEAD/fosshost-bling/fosshost.org_Cloud_Logo_Light.png -------------------------------------------------------------------------------- /fosshost-bling/LICENSE: -------------------------------------------------------------------------------- 1 | These files were provided by Fosshost as part of their press-kit. 2 | We didn't research their licensing terms carefully but we're confident 3 | they are okay to use on GitHub for our parking README as we do here. 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build/*/*.html 2 | *.html 3 | *.html~ 4 | *.org~ 5 | *~ 6 | \.#*# 7 | *.elc 8 | 9 | 10 | # -*- mode: gitignore; -*- 11 | *~ 12 | \#*\# 13 | /.emacs.desktop 14 | /.emacs.desktop.lock 15 | *.elc 16 | auto-save-list 17 | tramp 18 | .\#* 19 | *.html 20 | *~ 21 | 22 | # Org-mode 23 | .org-id-locations 24 | *_archive 25 | 26 | # flymake-mode 27 | *_flymake.* 28 | 29 | # eshell files 30 | /eshell/history 31 | /eshell/lastdir 32 | 33 | # elpa packages 34 | /elpa/ 35 | 36 | # reftex files 37 | *.rel 38 | 39 | # AUCTeX auto folder 40 | /auto/ 41 | 42 | # cask packages 43 | .cask/ 44 | dist/ 45 | 46 | # Flycheck 47 | flycheck_*.el 48 | 49 | # server auth directory 50 | /server/ 51 | 52 | # projectiles files 53 | .projectile 54 | 55 | # directory configuration 56 | .dir-locals.el 57 | 58 | # network security 59 | /network-security.data 60 | 61 | # project specific stuff 62 | README.html 63 | INTEREST-LIST.* 64 | *.html 65 | *~ 66 | #*# 67 | 68 | -------------------------------------------------------------------------------- /emacs-init-scripts/user/init-dm.el: -------------------------------------------------------------------------------- 1 | ;;; init-dm.el --- initialize dungeon-mode for GNU Emacs -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; This is a sample init script for dugeon-mode. 24 | 25 | ;; You should change the value of `my-path' to wherever you have 26 | ;; install or clone path. 27 | 28 | ;; FFI: https://github.com/dungeon-mode/game 29 | 30 | ;; .el 31 | 32 | ;;; Code: 33 | (let* ((my-path "d:/projects/dungeon-mode/")) 34 | (add-to-list 'load-path (concat my-path "src/")) 35 | (setq dm-files (list my-path)) 36 | (setq dm-map-tags t) 37 | (require 'dungeon-mode) 38 | (require 'dm-map)) 39 | 40 | (provide 'init-dm) 41 | ;;; init-dm.el ends here 42 | -------------------------------------------------------------------------------- /Docs/Maps/test/watermap.org: -------------------------------------------------------------------------------- 1 | * Water Test Map 2 | :PROPERTIES: 3 | :NAME: water-test-map-level 4 | :ETL: cell 5 | :END: 6 | 7 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 8 | This softare is released under the GNU Public Licence version three 9 | or, at your disgression, any newer version of the GNU Public 10 | License. For specific terms please see [[LICENSE]] at end-of-file. 11 | 12 | #+NAME:water-test-map-level 13 | 14 | This is a sample map used to develop and test map features and rendering code. 15 | Refer to design.org for more details. 16 | 17 | | X | Y | Path | 18 | |---+---+---------| 19 | | 0 | 0 | &pool | 20 | | 1 | 0 | (0 . 0) | 21 | | 2 | 0 | (0 . 0) | 22 | | 3 | 0 | | 23 | |---+---+---------| 24 | | 0 | 1 | (0 . 0) | 25 | | 1 | 1 | (0 . 0) | 26 | | 2 | 1 | (0 . 0) | 27 | | 3 | 0 | &riv1E | 28 | |---+---+---------| 29 | | 0 | 2 | (0 . 0) | 30 | | 1 | 2 | (0 . 0) | 31 | | 2 | 2 | (0 . 0) | 32 | | 3 | 0 | | 33 | |---+---+---------| 34 | | 0 | 3 | | 35 | | 1 | 3 | &riv1S | 36 | | 2 | 3 | | 37 | | 3 | 0 | | 38 | 39 | * LICENSE 40 | 41 | This program is free software; you can redistribute it and/or modify 42 | it under the terms of the GNU General Public License as published by 43 | the Free Software Foundation, either version 3 of the License, or 44 | (at your option) any later version. 45 | 46 | This program is distributed in the hope that it will be useful, 47 | but WITHOUT ANY WARRANTY; without even the implied warranty of 48 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 49 | GNU General Public License for more details. 50 | 51 | You should have received a copy of the GNU General Public License 52 | along with this program. If not, see . 53 | -------------------------------------------------------------------------------- /src/dm-test-util.el: -------------------------------------------------------------------------------- 1 | ;;; dm-test-util.el --- macros and internal settings for testing dungeon-mode -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; testing utiliities. 24 | 25 | ;;; Code: 26 | 27 | (defmacro dm-test-buffer-or-file-load-path (&optional bof-name) 28 | "Build a temporary `load-path' for a test's context package. 29 | 30 | BOF-NAME allows an alternative to searching first amung variable 31 | `buffer-file-name' and then function `buffer-name'." 32 | `(list (file-name-directory (or bof-name 33 | buffer-file-name 34 | (buffer-name))))) 35 | 36 | (defun dm-test-maybe-require (feature &optional forcep) 37 | "Load FEATURE when not loaded or FORCEP is t. 38 | 39 | Differs from `require' (which it uses) in that `load-path' is 40 | limited to the directory of the current buffer-file or buffer, 41 | assumed to be a test program being harnessed or evaluated." 42 | (unless (or forcep (featurep feature)) 43 | (let ((load-path (dm-test-buffer-or-file-load-path))) 44 | (require feature) 45 | t))) ;; t if require was called and no error raised 46 | 47 | (provide 'dm-test-util) 48 | ;;; dm-test-util.el ends here 49 | -------------------------------------------------------------------------------- /Docs/Maps/defaultfeatures.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Docs/Maps/map-styles.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Map Styles 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik Elmshauser 5 | :Created: 2020/04/16 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | * Overview 14 | 15 | This file is designed to define the appearance of the various SVG paths used to render the map. 16 | 17 | * Map Path Styles 18 | :PROPERTIES: 19 | :name: map-styles 20 | :MAP-FEATURES: t 21 | :ETL: style 22 | :END: 23 | 24 | # #+NAME: Map-Styles 25 | | Style | Key | Value | 26 | |-------------+--------------+----------| 27 | | path | fill | "none" | 28 | | | stroke | "black" | 29 | | | stroke-width | 1 | 30 | | | | | 31 | | water | fill | "blue" | 32 | | | stroke | "none" | 33 | | | | | 34 | | beach | fill | "Yellow" | 35 | | | stroke | "none" | 36 | | | | | 37 | | Decorations | fill | "cyan" | 38 | | | stroke | "none" | 39 | | | | | 40 | | stairs | fill | "Pink" | 41 | | | stroke | "none" | 42 | | | | | 43 | 44 | * LICENSE 45 | 46 | This program is free software; you can redistribute it and/or modify 47 | it under the terms of the GNU General Public License as published by 48 | the Free Software Foundation, either version 3 of the License, or 49 | (at your option) any later version. 50 | 51 | This program is distributed in the hope that it will be useful, 52 | but WITHOUT ANY WARRANTY; without even the implied warranty of 53 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 54 | GNU General Public License for more details. 55 | 56 | You should have received a copy of the GNU General Public License 57 | along with this program. If not, see . 58 | -------------------------------------------------------------------------------- /t/org/maps-tiles--04_table-striping.org: -------------------------------------------------------------------------------- 1 | #+TITLE Test: Missing overlay for some tiles; other paths for all #4 2 | 3 | * Tiles 4 | :PROPERTIES: 5 | :ETL: tile 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | | tile | overlay | 14 | | aaa | aaa | 15 | 16 | | tile | path | 17 | | aaa | h3 v3 h-3 v-3 | 18 | 19 | | tile | water | 20 | | aaa | m.75,.75 h1.5 v1.5 h-1.5 v-1.5 | 21 | 22 | 23 | * Cells 24 | :PROPERTIES: 25 | :ETL: cell 26 | :END: 27 | 28 | | x | y | path | 29 | | 1 | 1 | aaa | 30 | 31 | * Test 32 | 33 | #+BEGIN_SRC emacs-lisp 34 | (let ((dm-map-files (list (buffer-file-name))) 35 | (dm-map-draw-other-props '(water)) 36 | (dm-map-background '(nil)) 37 | (dm-map-draw-attributes 38 | '(path ((fill . "none") 39 | (stroke . "green") 40 | (stroke-width . "1")) 41 | 42 | water ((fill . "none") 43 | (stroke . "orange") 44 | (stroke-width . "1"))))) 45 | (dm-map-draw t) 46 | (prin1-to-string (list 'tiles dm-map-tiles 'level dm-map-level))) 47 | #+END_SRC 48 | 49 | #+RESULTS: 50 | : (tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (aaa (path ((h (3)) (v (3)) (h (-3)) (v (-3))) tag nil overlay ((text ((x . 0.8) (y . 1.65) (font-size . 1)) "aaa")) stairs nil water ((m (0.75 0.75)) (h (1.5)) (v (1.5)) (h (-1.5)) (v (-1.5))) beach nil neutronium nil decorations nil))) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((1 . 1) (path (aaa))))) 51 | 52 | * LICENSE 53 | 54 | This program is free software; you can redistribute it and/or modify 55 | it under the terms of the GNU General Public License as published by 56 | the Free Software Foundation, either version 3 of the License, or 57 | (at your option) any later version. 58 | 59 | This program is distributed in the hope that it will be useful, 60 | but WITHOUT ANY WARRANTY; without even the implied warranty of 61 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 62 | GNU General Public License for more details. 63 | 64 | You should have received a copy of the GNU General Public License 65 | along with this program. If not, see . 66 | -------------------------------------------------------------------------------- /t/org/maps-03_svg.org: -------------------------------------------------------------------------------- 1 | #+TITLE Test: Map Cells with Paths 2 | # d:/projects/dungeon-mode/t/org/maps-03_svg.org 3 | 4 | This tests map rendering using a tile and cell containing an SVG/XML element. 5 | 6 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 7 | This softare is released under the GNU Public Licence version three 8 | or, at your disgression, any newer version of the GNU Public 9 | License. For specific terms please see [[LICENSE]] at end-of-file. 10 | 11 | * Tiles 12 | :PROPERTIES: 13 | :ETL: tile 14 | :END: 15 | 16 | | tile | overlay | 17 | | aaa | aaa | 18 | 19 | 20 | * Cells 21 | :PROPERTIES: 22 | :ETL: cell 23 | :END: 24 | 25 | | x | y | path | 26 | | 1 | 1 | aaa | 27 | 28 | * Test 29 | 30 | #+BEGIN_SRC emacs-lisp 31 | (let ((dm-map-files (list (buffer-file-name))) 32 | (dm-map-level-size (cons 5 5)) 33 | (dm-map-draw-other-props nil) 34 | (dm-map-background '(nil)) 35 | (dm-map-draw-attributes 36 | '(overlay ((fill . "#00f") 37 | (stroke . "#ff0") 38 | (stroke-width . "1"))))) 39 | (prin1-to-string (list 'image (dm-map-draw t) 40 | 'tiles dm-map-tiles 41 | 'level dm-map-level))) 42 | #+END_SRC 43 | 44 | #+RESULTS: 45 | : (image #s(dm-svg (svg ((width . 385) (height . 385) (version . "1.1") (xmlns . "http://www.w3.org/2000/svg") (stroke . white) (stroke-width . 1) (:image . #)) nil (path ((d . "M 137 137 aaa")))) (path ((d . "M 137 137 aaa")))) tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (aaa (path ("aaa") tag nil overlay nil stairs nil water nil beach nil neutronium nil decorations nil))) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((1 . 1) (path (aaa))))) 46 | 47 | * LICENSE 48 | 49 | This program is free software; you can redistribute it and/or modify 50 | it under the terms of the GNU General Public License as published by 51 | the Free Software Foundation, either version 3 of the License, or 52 | (at your option) any later version. 53 | 54 | This program is distributed in the hope that it will be useful, 55 | but WITHOUT ANY WARRANTY; without even the implied warranty of 56 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 57 | GNU General Public License for more details. 58 | 59 | You should have received a copy of the GNU General Public License 60 | along with this program. If not, see . 61 | -------------------------------------------------------------------------------- /t/org/maps-01_cell-path.org: -------------------------------------------------------------------------------- 1 | #+TITLE Test: Map Cells with Paths 2 | # d:/projects/dungeon-mode/t/org/maps-01_cell-path.org 3 | 4 | This tests map rendering using a single table and column. 5 | 6 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 7 | This softare is released under the GNU Public Licence version three 8 | or, at your disgression, any newer version of the GNU Public 9 | License. For specific terms please see [[LICENSE]] at end-of-file. 10 | 11 | * Cells 12 | :PROPERTIES: 13 | :ETL: cell 14 | :END: 15 | 16 | | x | y | path | 17 | | 1 | 1 | h1 v.43 a.07,.07,0,1,1,0,.14 a.07,.07,0,1,1,0,-.14 m0,.14 v.43 m-1,0 v-1 | 18 | 19 | * Test 20 | 21 | #+BEGIN_SRC emacs-lisp 22 | (let ((dm-map-files (list (buffer-file-name))) 23 | (dm-map-level-size (cons 3 3)) 24 | (dm-map-draw-other-props nil) 25 | (dm-map-background '(nil)) 26 | (dm-map-draw-attributes 27 | '(path ((fill . "none") 28 | (stroke . "#f0f") 29 | (stroke-width . "1"))))) 30 | (prin1-to-string (list 'image (dm-map-draw t) 31 | 'tiles dm-map-tiles 32 | 'level dm-map-level))) 33 | #+END_SRC 34 | 35 | #+RESULTS: 36 | : (image #s(dm-svg (svg ((width . 311) (height . 311) (version . "1.1") (xmlns . "http://www.w3.org/2000/svg") (stroke . white) (stroke-width . 1) (:image . #)) nil (path ((d . "M 137 137 h 37 v 15.91 a 0.07 0.07 0 1 1 0 5 a 0.07 0.07 0 1 1 0 -5 m 0 5 v 15.91 m -37 0 v -37") (fill . "none") (stroke . "#f0f") (stroke-width . "1")))) (path ((d . "M 137 137 h 37 v 15.91 a 0.07 0.07 0 1 1 0 5 a 0.07 0.07 0 1 1 0 -5 m 0 5 v 15.91 m -37 0 v -37") (fill . "none") (stroke . "#f0f") (stroke-width . "1")))) tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((1 . 1) (path ((h (1)) (v (0.43)) (a (0.07 0.07 0 1 1 0 0.14)) (a (0.07 0.07 0 1 1 0 -0.14)) (m (0 0.14)) (v (0.43)) (m (-1 0)) (v (-1))))))) 37 | 38 | * LICENSE 39 | 40 | This program is free software; you can redistribute it and/or modify 41 | it under the terms of the GNU General Public License as published by 42 | the Free Software Foundation, either version 3 of the License, or 43 | (at your option) any later version. 44 | 45 | This program is distributed in the hope that it will be useful, 46 | but WITHOUT ANY WARRANTY; without even the implied warranty of 47 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 48 | GNU General Public License for more details. 49 | 50 | You should have received a copy of the GNU General Public License 51 | along with this program. If not, see . 52 | -------------------------------------------------------------------------------- /Docs/Maps/test/watertiles.org: -------------------------------------------------------------------------------- 1 | ** Water Tiles Tables 2 | 3 | :PROPERTIES: 4 | :name: 10-water-tiles 5 | :MAP-FEATURES: t 6 | :WATER: stroke="none" fill="blue" 7 | :DECORATIONS: stroke="none" fill="" fill-opacity=".9" 8 | :ETL: tile 9 | :END: 10 | 11 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 12 | This softare is released under the GNU Public Licence version three 13 | or, at your disgression, any newer version of the GNU Public 14 | License. For specific terms please see [[LICENSE]] at end-of-file. 15 | 16 | # #+NAME: 10-water-Tiles 17 | | Tile | Water | Decorations | 18 | |-----------+--------------------------------------------------+-----------------------------------------------------| 19 | | pool1 | h1 a1.5,1.5,0,0,1,1,1 v1 a1.5,1.5,0,0,1,-1,1 | | 20 | | | h-1 a1.5,1.5,0,0,1,-1,-1 v-1 a1.5,1.5,0,0,1,1,-1 | | 21 | | | | | 22 | | riv1 | h1 v1 h-1 v-1 | | 23 | | | | | 24 | | riv1N | &riv1 | m.49,.80 h.02 v-.5 h.05 l-.06,-.1 l-.06,.1 h.05 v.5 | 25 | | riv1E | &riv1 | m.75,.49 h-.5 v.02 h.5 v.05 l.1,-.06 l-.1,-.06 v.05 | 26 | | riv1S | &riv1 | m.49,.2 h.02 v.5 h.05 l-.06,.1 l-.06,-.1 h.05 v-.5 | 27 | | riv1W | &riv1 | m.25,.49 h.5 v.02 h-.5 v.05 l-.1,-.06 l.1,-.06 v.05 | 28 | | | | | 29 | 30 | * LICENSE 31 | 32 | This program is free software; you can redistribute it and/or modify 33 | it under the terms of the GNU General Public License as published by 34 | the Free Software Foundation, either version 3 of the License, or 35 | (at your option) any later version. 36 | 37 | This program is distributed in the hope that it will be useful, 38 | but WITHOUT ANY WARRANTY; without even the implied warranty of 39 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 40 | GNU General Public License for more details. 41 | 42 | You should have received a copy of the GNU General Public License 43 | along with this program. If not, see . 44 | -------------------------------------------------------------------------------- /t/org/maps-02_tile-path.org: -------------------------------------------------------------------------------- 1 | #+TITLE Test: Map Cells with Paths 2 | # d:/projects/dungeon-mode/t/org/maps-01_tile-path.org 3 | 4 | This tests map rendering using a tile and cell containing a only path commands.. 5 | 6 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 7 | This softare is released under the GNU Public Licence version three 8 | or, at your disgression, any newer version of the GNU Public 9 | License. For specific terms please see [[LICENSE]] at end-of-file. 10 | 11 | * Tiles 12 | :PROPERTIES: 13 | :ETL: tile 14 | :END: 15 | 16 | | tile | path | 17 | | aaa | v.43 a.07,.07,0,0,1,0,.14 a.07,.07,0,1,1,0,-.14 m0,.14 v.43 h1 v-1 m -.3,0 h-.7 | 18 | 19 | 20 | * Cells 21 | :PROPERTIES: 22 | :ETL: cell 23 | :END: 24 | 25 | | x | y | path | 26 | | 1 | 1 | aaa | 27 | 28 | * Test 29 | 30 | #+BEGIN_SRC emacs-lisp 31 | (let ((dm-map-files (list (buffer-file-name))) 32 | (dm-map-level-size (cons 3 3)) 33 | (dm-map-draw-other-props nil) 34 | (dm-map-background '(nil)) 35 | (dm-map-draw-attributes 36 | '(path ((fill . "none") 37 | (stroke . "#0f0") 38 | (stroke-width . "1"))))) 39 | (prin1-to-string (list 'image (dm-map-draw t) 40 | 'tiles dm-map-tiles 41 | 'level dm-map-level))) 42 | #+END_SRC 43 | 44 | #+RESULTS: 45 | 46 | * LICENSE 47 | 48 | This program is free software; you can redistribute it and/or modify 49 | it under the terms of the GNU General Public License as published by 50 | the Free Software Foundation, either version 3 of the License, or 51 | (at your option) any later version. 52 | 53 | This program is distributed in the hope that it will be useful, 54 | but WITHOUT ANY WARRANTY; without even the implied warranty of 55 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 56 | GNU General Public License for more details. 57 | 58 | You should have received a copy of the GNU General Public License 59 | along with this program. If not, see . 60 | : (image #s(dm-svg (svg ((width . 311) (height . 311) (version . "1.1") (xmlns . "http://www.w3.org/2000/svg") (stroke . white) (stroke-width . 1) (:image . #)) nil (path ((d . "M 137 137 v 15.91 a 0.07 0.07 0 0 1 0 5 a 0.07 0.07 0 1 1 0 -5 m 0 5 v 15.91 h 37 v -37 h -26") (fill . "none") (stroke . "#0f0") (stroke-width . "1")))) (path ((d . "M 137 137 v 15.91 a 0.07 0.07 0 0 1 0 5 a 0.07 0.07 0 1 1 0 -5 m 0 5 v 15.91 h 37 v -37 h -26") (fill . "none") (stroke . "#0f0") (stroke-width . "1")))) tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (aaa (path ((v (0.43)) (a (0.07 0.07 0 0 1 0 0.14)) (a (0.07 0.07 0 1 1 0 -0.14)) (m (0 0.14)) (v (0.43)) (h (1)) (v (-1)) m -\.3\,0 (h (-0.7))) tag nil overlay nil stairs nil water nil beach nil neutronium nil decorations nil))) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((1 . 1) (path (aaa))))) 61 | -------------------------------------------------------------------------------- /src/dm-util-tests--remove-keywords.el: -------------------------------------------------------------------------------- 1 | ;;; dm-util-tests--remove-keywords.el --- test --remove-keywords from dm-util -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; 24 | 25 | ;;; Code: 26 | 27 | (require 'dm-test-util) 28 | 29 | (ert-deftest dm-test-remove-keywords-nil () 30 | "transformation `dm--remove-keywords'" 31 | :tags '(:dm-util :internal :transformation) 32 | (should (equal nil (dm--remove-keywords nil))) 33 | ) 34 | 35 | (ert-deftest dm-test-remove-keywords-nil2 () 36 | "transformation `dm--remove-keywords'" 37 | :tags '(:dm-util :internal :transformation) 38 | (should (equal nil (dm--remove-keywords '()))) 39 | ) 40 | 41 | (ert-deftest dm-test-remove-keywords-arg () 42 | "transformation `dm--remove-keywords'" 43 | :tags '(:dm-util :internal :transformation) 44 | (should (equal '(arg) (dm--remove-keywords '(arg)))) 45 | ) 46 | 47 | (ert-deftest dm-test-remove-keywords-kw () 48 | "transformation `dm--remove-keywords'" 49 | :tags '(:dm-util :internal :transformation) 50 | (should (equal nil (dm--remove-keywords '(:kw)))) 51 | ) 52 | 53 | (ert-deftest dm-test-remove-keywords-kw+arg () 54 | "transformation `dm--remove-keywords'" 55 | :tags '(:dm-util :internal :transformation) 56 | (should (equal nil (dm--remove-keywords '(:kw arg)))) 57 | ) 58 | 59 | (ert-deftest dm-test-remove-keywords-arg+kw () 60 | "transformation `dm--remove-keywords'" 61 | :tags '(:dm-util :internal :transformation) 62 | (should (equal '(arg) (dm--remove-keywords '(arg :kw)))) 63 | ) 64 | 65 | (ert-deftest dm-test-remove-keywords-arg+kw+arg () 66 | "transformation `dm--remove-keywords'" 67 | :tags '(:dm-util :internal :transformation) 68 | (should (equal '(arg) (dm--remove-keywords '(arg :kw arg2)))) 69 | ) 70 | 71 | (ert-deftest dm-test-remove-keywords-arg+kw+arg+arg () 72 | "transformation `dm--remove-keywords'" 73 | :tags '(:dm-util :internal :transformation) 74 | (should (equal '(arg arg3) (dm--remove-keywords '(arg :kw arg2 arg3)))) 75 | ) 76 | 77 | (ert-deftest dm-test-remove-keywords-kw+arg+arg+arg () 78 | "transformation `dm--remove-keywords'" 79 | :tags '(:dm-util :internal :transformation) 80 | (should (equal '(arg arg3) (dm--remove-keywords '(:kw arg2 arg arg3)))) 81 | ) 82 | 83 | 84 | (provide 'dm-util-tests--remove-keywords) 85 | ;;; dm-util-tests--remove-keywords.el ends here 86 | -------------------------------------------------------------------------------- /t/org/maps-04_river.org: -------------------------------------------------------------------------------- 1 | #+TITLE Test: Map Cells with Paths 2 | # d:/projects/dungeon-mode/t/org/maps-03_svg.org 3 | 4 | This tests map rendering using a tile and cell containing an SVG/XML element. 5 | 6 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 7 | This softare is released under the GNU Public Licence version three 8 | or, at your disgression, any newer version of the GNU Public 9 | License. For specific terms please see [[LICENSE]] at end-of-file. 10 | 11 | * Tiles 12 | :PROPERTIES: 13 | :ETL: tile 14 | :END: 15 | 16 | | Tile | Water | Decorations | 17 | | riv1 | h1 v1 h-1 v-1 | | 18 | | riv1N | riv1 | m.49,.80 h.02 v-.5 h.05 l-.06,-.1 l-.06,.1 h.05 v.5 | 19 | 20 | # | Tile | Water | Decorations | 21 | # | riv1N | h1 v1 h-1 v-1 | m.49,.80 h.02 v-.5 h.05 l-.06,-.1 l-.06,.1 h.05 v.5 | 22 | 23 | 24 | 25 | * Cells 26 | :PROPERTIES: 27 | :ETL: cell 28 | :END: 29 | 30 | | X | Y | Path | 31 | |---+---+-------| 32 | | 0 | 0 | riv1N | 33 | 34 | * Test 35 | 36 | #+BEGIN_SRC emacs-lisp 37 | (let (dm-map-tiles dm-map-cells 38 | (dm-map-files (list (buffer-file-name))) 39 | (dm-map-level-size (cons 5 5)) 40 | (dm-map-background '(nil)) 41 | (dm-map-draw-other-props (list 'water 'beach 'stairs 'decorations)) 42 | (dm-map-draw-attributes 43 | '(decorations ((fill . "#00f") 44 | (stroke . "#00f") 45 | (stroke-width . "1")) 46 | water ((fill . "#ff0") 47 | (stroke . "#ff0") 48 | (stroke-width . "1"))))) 49 | (prin1-to-string (list 'image (dm-map-draw t) 50 | 'tiles dm-map-tiles 51 | 'level dm-map-level))) 52 | #+END_SRC 53 | 54 | #+RESULTS: 55 | : (image #s(dm-svg (svg ((width . 385) (height . 385) (version . "1.1") (xmlns . "http://www.w3.org/2000/svg") (stroke . white) (stroke-width . 1) (:image . #)) nil (path ((d . "M 100 100 m 18 30 h 1 v -18.5 h 2 l -2 -4 l -2 4 h 2 v 18.5") (fill . "#00f") (stroke . "#00f") (stroke-width . "1"))) (path ((d . "")))) (path ((d . "")))) tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (riv1 (path nil tag nil overlay nil water ((h (1)) (v (1)) (h (-1)) (v (-1))) beach nil stairs nil decorations nil) riv1N (path nil tag nil overlay nil water (riv1) beach nil stairs nil decorations ((m (0.49 0.8)) (h (0.02)) (v (-0.5)) (h (0.05)) (l (-0.06 -0.1)) (l (-0.06 0.1)) (h (0.05)) (v (0.5)))))) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((0 . 0) (path (riv1N))))) 56 | 57 | * LICENSE 58 | 59 | This program is free software; you can redistribute it and/or modify 60 | it under the terms of the GNU General Public License as published by 61 | the Free Software Foundation, either version 3 of the License, or 62 | (at your option) any later version. 63 | 64 | This program is distributed in the hope that it will be useful, 65 | but WITHOUT ANY WARRANTY; without even the implied warranty of 66 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 67 | GNU General Public License for more details. 68 | 69 | You should have received a copy of the GNU General Public License 70 | along with this program. If not, see . 71 | -------------------------------------------------------------------------------- /emacs-init-scripts/development/bootstrap.el: -------------------------------------------------------------------------------- 1 | ;;; bootstrap.el --- bootstrap emacs for dungeon-mode development -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; Automatically install packages used in deveopment of dungeon-mode 24 | ;; URL: https://github.com/mplsCorwin/dungeon-mode 25 | 26 | ;; Packages are installed alongside the default install path, in 27 | ;; ~/.emacs.d/dm-elpa 28 | 29 | ;; Add the following line near the top of your init.el or .emacs.d 30 | ;; nicked from straight.el (https://github.com/raxod502/straight.el) 31 | ;; to auto-install dungeon-mode development configuration 32 | ;; dependancies. 33 | 34 | ;; (let ((bootstrap-file 35 | ;; (expand-file-name "dm-elpa/bootstrap.el" user-emacs-directory))) 36 | ;; (unless (file-exists-p bootstrap-file) 37 | ;; (with-current-buffer 38 | ;; (url-retrieve-synchronously 39 | ;; (concat "https://raw.githubusercontent.com/mplsCorwin/dungeon-mode" 40 | ;; "/master/emacs-init-scripts/development/bootstrap.el") 41 | ;; 'silent 'inhibit-cookies) 42 | ;; (goto-char (point-max)) 43 | ;; (eval-print-last-sexp))) 44 | ;; (load bootstrap-file nil 'nomessage)) 45 | 46 | ;; install deps to a custom location using -Q, e.g: 47 | ;; emacs -Q -e "(setq dm-devel-packages-path \"d:/dm-packages\")" -l bootstrap.el 48 | 49 | ;; then you can link in the new libraries with this: 50 | ;; (add-to-list 'load-path (expand-file-name dm-devel-packages-path)) 51 | 52 | ;;; Code: 53 | 54 | (progn 55 | (unless (bound-and-true-p dm-devel-packages-path) 56 | (defvar dm-devel-packages-path 57 | (expand-file-name "dm-elpa" user-emacs-directory) 58 | "Folder to store packages installed for dungeon-mode development.")) 59 | (setq 60 | package-user-dir dm-devel-packages-path 61 | package-archives '(("melpa-stable" . "http://stable.melpa.org/packages/") 62 | ("melpa" . "http://melpa.org/packages/") 63 | ("gnu" . "http://elpa.gnu.org/packages/")) 64 | package-selected-packages (quote (all-the-icons company-quickhelp which-key rainbow-delimiters use-package delight bug-hunter pos-tip posframe org elisp-format org-make-toc paredit gist fullframe forge diminish diminish-buffer pdf-tools ascii-art-to-unicode company company-box company-emoji treemacs-projectile use-ttf tramp doom-themes treemacs darktooth-theme emojify easymenu cyberpunk-theme writegood-mode smex markdown-mode magit treemacs-magit htmlize flycheck autopair ac-slime helpful))) 65 | (package-initialize) 66 | (package-refresh-contents) 67 | (package-install-selected-packages)) 68 | -------------------------------------------------------------------------------- /Docs/Tables/Savingthrow.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Saving Throw table 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik C Elmshauser 5 | :Created: 2020/01/11 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | This table is a lookup of saving throws. 14 | 15 | + Players roll 2D6 together 16 | + Low Doubles means double 1 or 2 17 | + High Doubles means double 5 or 6 18 | + SnakEyes means double 1 19 | + BoxCars means double 6 20 | 21 | ** Saving Throws by level 22 | | Level | Roll Needed | Odds | 23 | | 0 | No Throw | Automatic Success | 24 | | 1 | Avoid SnakEyes | 35/36 | 25 | | 2 | Avoid Low Doubles | 34/36 | 26 | | 3 | Avoid Doubles | 30/36 | 27 | | 4 | Avoid Doubles, 7 | 24/36 | 28 | | 5 | Avoid Doubles, 7, 8 | 19/36 | 29 | | 6 | Doubles, 7, 9, 11 | 18/36 | 30 | | 7 | Doubles, 7, 9 | 16/36 | 31 | | 8 | Avoid Doubles, 6, 7, 8 | 14/36 | 32 | | 9 | Doubles, 7 | 12/36 | 33 | | 10 | Doubles, 9 | 10/36 | 34 | | 11 | Doubles, 11 | 8/36 | 35 | | 12 | Doubles | 6/36 | 36 | | 13 | Doubles !SnakEyes | 5/36 | 37 | | 14 | Double 3,4,5,6 | 4/36 | 38 | | 15 | Double 4,5,6 | 3/36 | 39 | | 16 | High Doubles | 2/36 | 40 | | 17 | BoxCars | 1/36 | 41 | | 18 | No Throw | Automatic Fail | 42 | 43 | 44 | + The following table is for reference only and was used to help compute odds in the above table. 45 | ** Saving throw breakdown by odds 46 | | | 1 | 2 | 3 | 4 | 5 | 6 | 47 | | 1 | 2 (Dbl) (LD) (SE) | 3 | 4 | 5 | 6 | 7 | 48 | | 2 | 3 | 4 (Dbl) (LD) | 5 | 6 | 7 | 8 | 49 | | 3 | 4 | 5 | 6 (Dbl) | 7 | 8 | 9 | 50 | | 4 | 5 | 6 | 7 | 8 (Dbl) | 9 | 10 | 51 | | 5 | 6 | 7 | 8 | 9 | 10 (Dbl) (HD) | 11 | 52 | | 6 | 7 | 8 | 9 | 10 | 11 | 12 (Dbl) (HD) (BX) | 53 | 54 | * LICENSE 55 | 56 | This program is free software; you can redistribute it and/or modify 57 | it under the terms of the GNU General Public License as published by 58 | the Free Software Foundation, either version 3 of the License, or 59 | (at your option) any later version. 60 | 61 | This program is distributed in the hope that it will be useful, 62 | but WITHOUT ANY WARRANTY; without even the implied warranty of 63 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 64 | GNU General Public License for more details. 65 | 66 | You should have received a copy of the GNU General Public License 67 | along with this program. If not, see . 68 | -------------------------------------------------------------------------------- /Docs/Table-Design.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Table Design 2 | 3 | This file describes parsing rules for tables. 4 | 5 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 6 | This softare is released under the GNU Public Licence version three 7 | or, at your disgression, any newer version of the GNU Public 8 | License. For specific terms please see [[LICENSE]] at end-of-file. 9 | 10 | Rules for designing dungeon mode tables and table implementations. 11 | 12 | 1. Tables are stored in org files or sections having a 13 | `dungeon-mode' property specifying the scope of the data-set. 14 | 15 | 1.1 Tables must be nested within a section or as a special case 16 | before first section, if any. 17 | 18 | 1.2 Any section level is accepted 19 | 20 | 1.3 The 'dungon-mode property is added the containing section, 21 | or to the document when at the top of the page. 22 | 23 | 1.4 The 'dungeon-mode' property is not inheretable, e.g. by sub- 24 | elements. 25 | 26 | 2. Tables may be further identified used the built-in NAME 27 | property. 28 | 29 | 2.1 Given table implementations (e.g. map-features) may ignore 30 | NAME properties. 31 | 32 | 2.2 Given table implementations (e.g. map-level) may require 33 | NAME properties. 34 | 35 | 2.3 Name properties are positioned as per the dungon-mode 36 | property, that is within the property drawer or otherwise 37 | immediately after the beginning of the section, or in the 38 | properties drawer or otherwise at the top of the file. 39 | 40 | 3. Given table implementations may support different modes of 41 | altering the target data-set as a result of reading the table 42 | content. 43 | 3.1 Create - create or replace a data-set or the NAMed feature 44 | thereof. 45 | 46 | 3.2 Add - add records to a data-set or the NAMED feature thereof. 47 | 48 | 4. Each table must contain an header row. 49 | 50 | 4.1 The header row appears exactly once as the first row of the 51 | table. 52 | 53 | 4.2 Given table implementations may accept a fixed or variable 54 | column arrangement. 55 | 56 | 4.3 Table implementations with variable column arrangements may 57 | define given columns as required or optional. 58 | 59 | 4.3.1 Rows which omit required columns are assmed to take their 60 | values for missing columns from the prior row. 61 | 62 | 4.3.2 Rows which omit all required columns or which begin the first 63 | column with a comment are considered comments and ignored. 64 | 65 | 4.4 Table implementation with variable column arrangements and which 66 | support Add mode may allow incrementally accumulating row values 67 | (e.g. "striping"). 68 | 69 | 4.4.1 Tables are striped only when all identifying properties are 70 | identical (`eq'). 71 | 72 | 4.4.2 Tables include striped rows only when they include all 73 | required columns (eventually). 74 | 75 | * LICENSE 76 | 77 | This program is free software; you can redistribute it and/or modify 78 | it under the terms of the GNU General Public License as published by 79 | the Free Software Foundation, either version 3 of the License, or 80 | (at your option) any later version. 81 | 82 | This program is distributed in the hope that it will be useful, 83 | but WITHOUT ANY WARRANTY; without even the implied warranty of 84 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 85 | GNU General Public License for more details. 86 | 87 | You should have received a copy of the GNU General Public License 88 | along with this program. If not, see . 89 | -------------------------------------------------------------------------------- /Docs/Maps/test/bigwater-map.org: -------------------------------------------------------------------------------- 1 | * BigWater Test Map 2 | :PROPERTIES: 3 | :NAME: bigwater-test-map-level 4 | :ETL: cell 5 | :END: 6 | 7 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 8 | This softare is released under the GNU Public Licence version three 9 | or, at your disgression, any newer version of the GNU Public 10 | License. For specific terms please see [[LICENSE]] at end-of-file. 11 | 12 | #+NAME:test-map-level 13 | 14 | This is a sample map used to verify the bigwater features draw corectly 15 | 16 | | X | Y | Path | 17 | |---+---+---------| 18 | | 0 | 0 | | 19 | | 1 | 0 | bNW | 20 | | 2 | 0 | (0 . 0) | 21 | | 3 | 0 | (0 . 0) | 22 | | 4 | 0 | cEW | 23 | | 5 | 0 | cEW | 24 | | 6 | 0 | bNE | 25 | | 7 | 0 | (5 . 0) | 26 | | 8 | 0 | (5 . 0) | 27 | | 9 | 0 | | 28 | | 0 | 1 | | 29 | | 1 | 1 | (0 . 0) | 30 | | 2 | 1 | (0 . 0) | 31 | | 3 | 1 | (0 . 0) | 32 | | 4 | 1 | pool | 33 | | 5 | 1 | (3 . 1) | 34 | | 6 | 1 | (6 . 0) | 35 | | 7 | 1 | (6 . 0) | 36 | | 8 | 1 | (6 . 0) | 37 | | 9 | 1 | | 38 | | | | | 39 | | 0 | 2 | | 40 | | 1 | 2 | (0 . 0) | 41 | | 2 | 2 | (0 . 0) | 42 | | 3 | 2 | (0 . 0) | 43 | | 4 | 2 | (3 . 1) | 44 | | 5 | 2 | (3 . 1) | 45 | | 6 | 2 | (6 . 0) | 46 | | 7 | 2 | (6 . 0) | 47 | | 8 | 2 | (6 . 0) | 48 | | 9 | 2 | | 49 | | | | | 50 | | 0 | 3 | | 51 | | 1 | 3 | cNS | 52 | | 2 | 3 | pool | 53 | | 3 | 3 | (0 . 3) | 54 | | 4 | 3 | pool | 55 | | 5 | 3 | (3 . 0) | 56 | | 6 | 3 | pool | 57 | | 7 | 3 | (5 . 3) | 58 | | 8 | 3 | rivE | 59 | | 9 | 3 | rivE | 60 | | | | | 61 | | 0 | 4 | | 62 | | 1 | 4 | cNS | 63 | | 2 | 4 | (1 . 3) | 64 | | 3 | 4 | (1 . 3) | 65 | | 4 | 4 | (3 . 3) | 66 | | 5 | 4 | (3 . 3) | 67 | | 6 | 4 | (5 . 3) | 68 | | 7 | 4 | (5 . 3) | 69 | | 8 | 4 | (7 . 3) | 70 | | 9 | 4 | (8 . 3) | 71 | | | | | 72 | | 0 | 5 | | 73 | | 1 | 5 | bSW | 74 | | 2 | 5 | (0 . 5) | 75 | | 3 | 5 | (0 . 5) | 76 | | 4 | 5 | pool | 77 | | 5 | 5 | (3 . 5) | 78 | | 6 | 5 | bSE | 79 | | 7 | 5 | (6 . 5) | 80 | | 8 | 5 | (6 . 5) | 81 | | 9 | 5 | | 82 | | | | | 83 | | 0 | 6 | | 84 | | 1 | 6 | (0 . 5) | 85 | | 2 | 6 | (0 . 5) | 86 | | 3 | 6 | (0 . 5) | 87 | | 4 | 6 | (3 . 5) | 88 | | 5 | 6 | (3 . 5) | 89 | | 6 | 6 | (6 . 5) | 90 | | 7 | 6 | (6 . 5) | 91 | | 8 | 6 | (6 . 5) | 92 | | 9 | 6 | | 93 | | | | | 94 | | 0 | 7 | | 95 | | 1 | 7 | (0 . 5) | 96 | | 2 | 7 | (0 . 5) | 97 | | 3 | 7 | (0 . 5) | 98 | | 4 | 7 | rivS | 99 | | 5 | 7 | (4 . 7) | 100 | | 6 | 7 | (6 . 5) | 101 | | 7 | 7 | (6 . 5) | 102 | | 8 | 7 | (6 . 5) | 103 | | 9 | 7 | | 104 | | | | | 105 | 106 | * LICENSE 107 | 108 | This program is free software; you can redistribute it and/or modify 109 | it under the terms of the GNU General Public License as published by 110 | the Free Software Foundation, either version 3 of the License, or 111 | (at your option) any later version. 112 | 113 | This program is distributed in the hope that it will be useful, 114 | but WITHOUT ANY WARRANTY; without even the implied warranty of 115 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 116 | GNU General Public License for more details. 117 | 118 | You should have received a copy of the GNU General Public License 119 | along with this program. If not, see . 120 | -------------------------------------------------------------------------------- /t/org/maps-05_ramps_overdraw.org: -------------------------------------------------------------------------------- 1 | #+TITLE Test: Map Cells with Paths 2 | # d:/projects/dungeon-mode/t/org/maps-01_tile-path.org 3 | 4 | This tests map rendering using a tile and cell containing a only path commands.. 5 | 6 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 7 | This softare is released under the GNU Public Licence version three 8 | or, at your disgression, any newer version of the GNU Public 9 | License. For specific terms please see [[LICENSE]] at end-of-file. 10 | 11 | * Tiles 12 | :PROPERTIES: 13 | :ETL: tile 14 | :END: 15 | 16 | | Tile | Path | stairs | 17 | | cEW | ‡N ‡S | | 18 | | cW | h1 v1 h-1 ↑ | | 19 | | ‡N | h1 | | 20 | | ‡S | ↓ h1 | | 21 | | → | m1,0 | | 22 | | ← | m-1,0 | | 23 | | ↑ | m0,-1 | | 24 | | ↓ | m0,1 | | 25 | | R▲E | | | 26 | | R▲E:!dwarf | cEW → cEW → cEW → cEW → cW | | 27 | | R▲E:dwarf | cEW → cEW → cEW → cEW → cW | h5 v1 h-5 v-1 | 28 | | | | | 29 | 30 | * Cells 31 | :PROPERTIES: 32 | :ETL: cell 33 | :END: 34 | 35 | | X | Y | Path | 36 | | 0 | 0 | R▲E | 37 | 38 | * Test 39 | 40 | #+BEGIN_SRC emacs-lisp 41 | (let ((dm-map-files (list (buffer-file-name))) 42 | (dm-map-level-size (cons 3 3)) 43 | (dm-map-draw-other-props nil) 44 | (dm-map-background '(nil)) 45 | (dm-map-draw-attributes 46 | '(path ((fill . "none") 47 | (stroke . "#0f0") 48 | (stroke-width . "1"))))) 49 | (prin1-to-string (list 'image (dm-map-draw t) 50 | 'tiles dm-map-tiles 51 | 'level dm-map-level))) 52 | #+END_SRC 53 | 54 | #+RESULTS: 55 | : (image #s(dm-svg (svg ((width . 311) (height . 311) (version . "1.1") (xmlns . "http://www.w3.org/2000/svg") (stroke . white) (stroke-width . 1) (:image . #)) nil (path ((d . "M 137 137 v 15.91 a 0.07 0.07 0 0 1 0 5 a 0.07 0.07 0 1 1 0 -5 m 0 5 v 15.91 h 37 v -37 h -26") (fill . "none") (stroke . "#0f0") (stroke-width . "1")))) (path ((d . "M 137 137 v 15.91 a 0.07 0.07 0 0 1 0 5 a 0.07 0.07 0 1 1 0 -5 m 0 5 v 15.91 h 37 v -37 h -26") (fill . "none") (stroke . "#0f0") (stroke-width . "1")))) tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (aaa (path ((v (0.43)) (a (0.07 0.07 0 0 1 0 0.14)) (a (0.07 0.07 0 1 1 0 -0.14)) (m (0 0.14)) (v (0.43)) (h (1)) (v (-1)) m -\.3\,0 (h (-0.7))) tag nil overlay nil stairs nil water nil beach nil neutronium nil decorations nil))) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((1 . 1) (path (aaa))))) 56 | 57 | * LICENSE 58 | 59 | This program is free software; you can redistribute it and/or modify 60 | it under the terms of the GNU General Public License as published by 61 | the Free Software Foundation, either version 3 of the License, or 62 | (at your option) any later version. 63 | 64 | This program is distributed in the hope that it will be useful, 65 | but WITHOUT ANY WARRANTY; without even the implied warranty of 66 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 67 | GNU General Public License for more details. 68 | 69 | You should have received a copy of the GNU General Public License 70 | along with this program. If not, see . 71 | -------------------------------------------------------------------------------- /src/dm-util-tests--coalesce-hash.el: -------------------------------------------------------------------------------- 1 | ;;; dm-util-tests--coalesce-hash.el --- test coalesce-hash from dm-util -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; 24 | 25 | ;;; Code: 26 | 27 | (require 'dm-util) 28 | 29 | (ert-deftest dm-test-coalesce-hash/strings () 30 | "macro `dm-coalesce-hash'" 31 | :tags '(:dm-util :macro :internal) 32 | (dm-coalesce-hash (("h1" "H2" "H3") 33 | ("r1" "V12" "V13") 34 | ("r2" "V22" "V23") 35 | ("r3" "V32" "V33")))) 36 | 37 | (ert-deftest dm-test-coalesce-hash () 38 | "macro `dm-coalesce-hash'" 39 | :tags '(:dm-util :macro :internal) 40 | (let ((dm-default-coalesce-key '(id _ h1))) 41 | (dm-coalesce-hash (("h1" "H2" "H3") 42 | ("r1" "V12" "V13") 43 | ("r2" "V22" "V23") 44 | ("r3" "V32" "V33"))))) 45 | 46 | (ert-deftest dm-test-coalesce-hash () 47 | "macro `dm-coalesce-hash'" 48 | :tags '(:dm-util :macro :internal) 49 | (dm-coalesce-hash (("h1" "H2" "H3") 50 | ("r1" "V12" "V13") 51 | ("r2" "V22" "V23") 52 | ("r3" "V32" "V33")) 53 | nil 54 | (puthash (nth 0 row) row hash) 55 | :after nil)) 56 | 57 | (ert-deftest dm-test-coalesce-hash () 58 | "macro `dm-coalesce-hash'" 59 | :tags '(:dm-util :macro :internal) 60 | (dm-coalesce-hash (("h1" "H2" "H3") 61 | ("r1" "V12" "V13") 62 | ("r2" "V22" "V23") 63 | ("r3" "V32" "V33")) 64 | (_) 65 | (puthash (intern (nth 0 row)) row hash) 66 | :after nil 67 | )) 68 | 69 | (ert-deftest dm-test-coalesce-hash () 70 | "macro `dm-coalesce-hash'" 71 | :tags '(:dm-util :macro :internal) 72 | (dm-coalesce-hash (("h1" "H2" "H3") 73 | ("r1" "V12" "V13") 74 | ("r2" "V22" "V23") 75 | ("r3" "V32" "V33")) 76 | (_) 77 | :after 78 | (puthash (intern (nth 0 row)) (cdr row) hash))) 79 | 80 | (ert-deftest dm-test-coalesce-hash () 81 | "macro `dm-coalesce-hash'" 82 | :tags '(:dm-util :macro :internal) 83 | (dm-coalesce-hash (("h1" "H2" "H3") 84 | ("r1" "V12" "V13") 85 | ("r2" "V22" "V23") 86 | ("r3" "V32" "V33")) 87 | (id bob) 88 | (list (quote bob) bob))) 89 | 90 | 91 | 92 | (ert-deftest dm-test-coalesce-hash () 93 | "macro `dm-coalesce-hash'" 94 | :tags '(:dm-util :macro :internal) 95 | (dm-coalesce-hash (("h1" "H2" "H3") 96 | ("r1" "V12" "V13") 97 | ("r2" "V22" "V23") 98 | ("r3" "V32" "V33")) 99 | (id _ h2) 100 | :start-column 0 101 | (list 'id (format "id:<%s>" id) '2 h2 'raw row))) 102 | 103 | (ert-deftest dm-test-coalesce-hash () 104 | "macro `dm-coalesce-hash'" 105 | :tags '(:dm-util :macro :internal) 106 | (let ((h (dm-coalesce-hash (("h1" "H2" "H3") 107 | ("r1" "V12" "V13") 108 | ("r2" "V22" "V23") 109 | ("r3" "V32" "V33")) 110 | (id h2) 111 | :hash-table #s(hash-table size 30 test equal) 112 | :start-column 1 113 | (list 'id id 'h2 h2)))) 114 | ;;(print h) 115 | h)) 116 | 117 | (provide 'dm-util-tests--coalesce-hash) 118 | ;;; dm-util-tests--coalesce-hash.el ends here 119 | -------------------------------------------------------------------------------- /Docs/Maps/testmap.alt.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Test Map 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik Elmshauser 5 | :Created: 2020/01/26 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | * Test Map 14 | :PROPERTIES: 15 | :NAME: test-map-level 16 | :END: 17 | 18 | This is a sample map used to develop and test map features and rendering code. 19 | Refer to design.org for more details. 20 | 21 | #+NAME:test-map-level 22 | | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 23 | | 0 | 20*S-E | (0 . 0) | 20*S-E | (2 . 0) | 20*S-W | (4 . 0) | 20*S-W | (6 . 0) | 20*S-W | (7 . 0) | 20*S-E | (10 . 0) | 20*S-W | (12 . 0) | 20*S-W | (14 . 0) | cES | cEW | cEW*S | cEW*S | cEW | cEW | cEW*S | cSW | 24 | | 1 | (0 . 0) | (0 . 0) | (2 . 0) | (2 . 0) | (4 . 0) | (4 . 0) | (6 . 0) | (6 . 0) | (7 . 0) | (7 . 0) | (10 . 0) | (10 . 0) | (12 . 0) | (12 . 0) | (14 . 0) | (14 . 0) | cNS | 20*N-E | (17 . 1) | 20*N-W | (19 . 1) | 10xS*S | 10xS*N | cNS | 25 | | 2 | 10*E | cES*NW | cESW | cEW*NS | cEW*NS | cSW | A2 _W *N > _N ! _E _S < _S | (6 . 2) | cEW*NS | cEW*S | cEW | cEW*NS | cEW*NS | cEW | cESW*N | cEW | cNW | (17 . 1) | (17 . 1) | (19 . 1) | (19 . 1) | (21 . 1) | (22 . 1) | cNS | 26 | | 3 | 10*E | cNS*W | cNS | 10*N | 10*N | cNES | (6 . 2) | (6 . 2) | | | | | | | | | | | | | | | | | 27 | | 4 | 10*E | cNS*W | cNES | cEW*S | cEW | cNSW | cSE *E | 10*W | | | | | | | | | | | | | | | | | 28 | | 5 | 10*E | cNS*W | cNS | 20*N-W | (3 . 5) | cNES | cNSW*E | 10*W | | | | | | | | | | | | | | | | | 29 | | 6 | 10*E | cNS*W | cNS | (3 . 5) | (3 . 5) | cNS | cN*ES | 10*W | | | | | | | | | | | | | | | | | 30 | | 7 | 10*E | cNES*W | c4 | cESW | cEW | cWN*E | 20*W-N*N-W | (6 . 7) | | | | | | | | | | | | | | | | | 31 | | 8 | 10*E | cNS*W | cNS | cNS | 10*S | 10*S | (6 . 7) | (6 . 7) | | | | | | | | | | | | | | | | | 32 | 33 | * LICENSE 34 | 35 | This program is free software; you can redistribute it and/or modify 36 | it under the terms of the GNU General Public License as published by 37 | the Free Software Foundation, either version 3 of the License, or 38 | (at your option) any later version. 39 | 40 | This program is distributed in the hope that it will be useful, 41 | but WITHOUT ANY WARRANTY; without even the implied warranty of 42 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 43 | GNU General Public License for more details. 44 | 45 | You should have received a copy of the GNU General Public License 46 | along with this program. If not, see . 47 | -------------------------------------------------------------------------------- /Docs/Misc/Abbreviations.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Abbreviations 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik C Elmshauser 5 | :Created: 2020/01/11 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | THIS IS BADLY BROKEN :) 14 | 15 | * Common 16 | 17 | 18 | # *** comment this works 19 | 20 | #+latex_header: \usepackage{pifont} 21 | #+latex_header: \DeclareFontFamily{U}{dice3d}{} 22 | #+latex_header: \DeclareFontShape{U}{dice3d}{m}{n}{<-> s*[4] dice3d}{} 23 | 24 | # #+latex: {\usefont{U}{dice3d}{m}{n}3d 3d} 25 | 26 | 27 | ** COMMENT setup 28 | #+begin_src emacs-lisp :results silent 29 | (setq org-babel-latex-htlatex "htlatex") 30 | (defmacro by-backend (&rest body) 31 | `(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body)) 32 | #+end_src 33 | 34 | ** test 35 | 36 | #+name: my-dice 37 | #+header: :file (by-backend (html "die.svg") (t 'nil)) 38 | #+header: :imagemagick 39 | #+header: :results (by-backend (pdf "latex") (t "raw")) 40 | #+begin_src latex 41 | {\usefont{U}{dice3d}{m}{n}3d 3d} 42 | #+end_src 43 | 44 | #+RESULTS: my-dice 45 | {\usefont{U}{dice3d}{m}{n}3d 3d} 46 | 47 | #+begin_src latex :noweb yes 48 | <> 49 | #+end_src 50 | 51 | #+RESULTS: 52 | #+begin_export latex 53 | {\usefont{U}{dice3d}{m}{n}3d 3d} 54 | #+end_export 55 | 56 | # #+latex: 57 | 58 | # #+latex: {\usefont{U}{dice3d}{m}{n}3d 3d} 59 | 60 | # *** comment this doesn't 61 | 62 | # #+latex_header: \usepackage{threedice} 63 | 64 | # \die{face-6} 65 | 66 | These abbreviations are global meaning entries not providing a legend 67 | are referencing this table where terms intersect, or do not intersect 68 | with any provided legend. 69 | 70 | # #+latex_header: \usepackage{pifont}\DeclareFontFamily{U}{⟨name⟩}{}\DeclareFontShape{U}{⟨name⟩}{m}{n}{<->⟨font⟩}{} 71 | 72 | *** RAW \Pisymbol{hands}{65} 73 | 74 | header 75 | 76 | # #+latex: \Pisymbol{hands}{65} 77 | 78 | \pi 79 | 80 | * Table 81 | 82 | | Abbreviation | Documentation | Notes | 83 | |-------------------+--------------------------------------------------------------------------------------------+-------| 84 | | 2d, 2d6, roll | Players roll 2D6 together | | 85 | | Low Doubles, LowD | \Pisymbol{dice3d}{49} \Pisymbol{dice3d}{49} or \Pisymbol{dice3d}{50} \Pisymbol{dice3d}{50} | | 86 | | High Doubles ,HiD | \Pisymbol{dice3d}{53} \Pisymbol{dice3d}{53} or \Pisymbol{dice3d}{54} \Pisymbol{dice3d}{54} | | 87 | | Snakeyes, Sn | \Pisymbol{dice3d}{49} \Pisymbol{dice3d}{49} | | 88 | | BoxCars, Bx, Box | \Pisymbol{dice3d}{54} \Pisymbol{dice3d}{54} | | 89 | 90 | # \Pisymbol{dice3d}{105} 91 | # http://tug.ctan.org/info/symbols/comprehensive/symbols-letter.pdf 92 | 93 | * COMMENT org-mode configuration 94 | 95 | # Local Variables: 96 | # org-latex-inputenc-alist: (("utf8" . "utf8x")) 97 | # eval: (setq org-latex-default-packages-alist (cons '("mathletters" "ucs" nil) org-latex-default-packages-alist)) 98 | # End: 99 | 100 | * LICENSE 101 | 102 | This program is free software; you can redistribute it and/or modify 103 | it under the terms of the GNU General Public License as published by 104 | the Free Software Foundation, either version 3 of the License, or 105 | (at your option) any later version. 106 | 107 | This program is distributed in the hope that it will be useful, 108 | but WITHOUT ANY WARRANTY; without even the implied warranty of 109 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 110 | GNU General Public License for more details. 111 | 112 | You should have received a copy of the GNU General Public License 113 | along with this program. If not, see . 114 | -------------------------------------------------------------------------------- /t/org/maps-06_0.0_does_not_render.org: -------------------------------------------------------------------------------- 1 | #+TITLE Test: Map Cells with Paths 2 | # d:/projects/dungeon-mode/t/org/maps-01_tile-path.org 3 | 4 | This tests map rendering using a tile and cell containing a only path commands.. 5 | 6 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 7 | This softare is released under the GNU Public Licence version three 8 | or, at your disgression, any newer version of the GNU Public 9 | License. For specific terms please see [[LICENSE]] at end-of-file. 10 | 11 | * Tiles 12 | :PROPERTIES: 13 | :ETL: tile 14 | :END: 15 | | Tile | Beach | Water | Overlay | 16 | |------+------------------------------------+--------------------------------+------------------------------------------------| 17 | | b1NE | h2 v2 h-1 a1.5,1.5,0,0,0,-1,-1 v-1 | m1,2 a1.5,1.5,0,0,0,-1,-1 v1 h1 | B | 18 | 19 | 20 | | Tile | Water | 21 | | water1 | h1 v1 h-1 v-1 | 22 | 23 | * Cells 24 | :PROPERTIES: 25 | :ETL: cell 26 | :END: 27 | 28 | | X | Y | Path | 29 | | 0 | 0 | b1NE | 30 | | 1 | 0 | | 31 | | 2 | 0 | b1NE | 32 | | 0 | 1 | | 33 | | 1 | 1 | | 34 | | 2 | 1 | | 35 | | 0 | 2 | | 36 | | 1 | 2 | b1NE | 37 | | 2 | 2 | | 38 | 39 | 40 | * Test 41 | 42 | #+BEGIN_SRC emacs-lisp 43 | (let ((dm-map-files (list (buffer-file-name))) 44 | (dm-map-level-size (cons 7 7)) 45 | (dm-map-draw-other-props nil) 46 | ; (dm-map-background '(nil)) 47 | (dm-map-draw-attributes 48 | '((water ((fill . "blue") 49 | (stroke . "none") 50 | (stroke-width . "1"))) 51 | (beach ((fill . "yellow") 52 | (stroke . "none") 53 | (stroke-width . "1"))) 54 | (stairs ((fill . "#FF69B4") 55 | (stroke . "none") 56 | (stroke-width . "1"))) 57 | (neutronium ((fill . "orange") 58 | (stroke . "orange") 59 | (stroke-width . "1"))) 60 | (decorations ((fill . "none") 61 | (stroke . "#3c0545") 62 | (stroke-width . "1")))))) 63 | (prin1-to-string (list 'image (dm-map-draw t) 64 | 'tiles dm-map-tiles 65 | 'level dm-map-level))) 66 | #+END_SRC 67 | 68 | #+RESULTS: 69 | : (image #s(dm-svg (svg ((width . 480) (height . 480) (version . "1.1") (xmlns . "http://www.w3.org/2000/svg") (stroke . white) (stroke-width . 1)) (svg ((width . 480) (height . 480) (version . "1.1") (xmlns . "http://www.w3.org/2000/svg")) (rect ((width . 480) (height . 480) (x . 0) (y . 0) (fill . "#fffdd0") (stroke-width . 0))) (path ((d . "M0,100 h480 M0,140 h480 M0,180 h480 M0,220 h480 M0,260 h480 M0,300 h480 M0,340 h480 M0,380 h480 M100,0 v480 M140,0 v480 M180,0 v480 M220,0 v480 M260,0 v480 M300,0 v480 M340,0 v480 M380,0 v480") (fill . "none") (stroke . "blue") (stroke-width . ".25")))) (g nil (text ((font-size . 20.0) (x . 134.0) (y . 146.0)) "B")) (g nil (text ((font-size . 20.0) (x . 214.0) (y . 146.0)) "B")) (g nil (text ((font-size . 20.0) (x . 174.0) (y . 226.0)) "B")) (path ((d . "")))) (path ((d . "")))) tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (b1NE (path nil tag nil overlay ((g nil (text ((font-size . 0.5) (x . 0.85) (y . 1.15)) "B"))) stairs nil water nil beach nil neutronium nil decorations nil) water1 (path nil tag nil overlay nil stairs nil water nil beach nil neutronium nil decorations nil))) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((0 . 0) (path (b1NE)) (1 . 0) (path nil) (2 . 0) (path (b1NE)) (0 . 1) (path nil) (1 . 1) (path nil) (2 . 1) (path nil) (0 . 2) (path nil) (1 . 2) (path (b1NE)) (2 . 2) (path nil)))) 70 | 71 | * LICENSE 72 | 73 | This program is free software; you can redistribute it and/or modify 74 | it under the terms of the GNU General Public License as published by 75 | the Free Software Foundation, either version 3 of the License, or 76 | (at your option) any later version. 77 | 78 | This program is distributed in the hope that it will be useful, 79 | but WITHOUT ANY WARRANTY; without even the implied warranty of 80 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 81 | GNU General Public License for more details. 82 | 83 | You should have received a copy of the GNU General Public License 84 | along with this program. If not, see . 85 | -------------------------------------------------------------------------------- /Docs/Baddies/aliens.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Baddies for chambers 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik C Elmshauser 5 | :Created: 2020/01/11 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | * Aliens Table 14 | 15 | + This table contains all the members of the alien family 16 | 17 | | Table | Name | Index | primary | secondary | special | sp | sw | ax | ma | hits | worth | Notes | 18 | |-------+-------------+-------+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------+----+----+----+----+------+-------+--------------------| 19 | | / | > | <> | < | | > | < | | | > | < | > | <> | 20 | | 01B | Zerglings | 18 | 2 on 8 for 1 | | | 9 | 8 | 8 | 10 | 2 | 2 | | 21 | | 02B | Face Hugger | 1 | 1 on dbl for hug | | Hug: You become incapacitated for 1d rounds (or rest of battle). Each battle there after is a dbl chance a baby alien will emerge | 11 | 11 | 11 | 10 | 1 | 10 | *ACID* | 22 | | 03B | Giant Brain | 1 | 1 on dbl for special | | Stupify ray gives brain control of character for 1D rounds | 7 | 7 | 7 | 7 | 5 | 10 | | 23 | | 04B | Baby Alien | 1 | 2 on 8 for 1 | 1 on 10 for 2 | | 9 | 9 | 9 | 9 | 5 | 1 | *ACID* | 24 | | 05B | Hydrolisk | 12 | 2 on 8 for 3 | 3 on 8 for 2 | use attack 1 or 2 | 9 | 9 | 9 | 9 | 8 | 8 | Attack 2 is ranged | 25 | | 06B | Cybermen | 12 | 2 on 8 for 3 | 1 on dbl for special | implant cybermites (convert to cyberman) | 9 | 9 | 9 | 9 | 15 | 30 | | 26 | | 07B | Vogons | 15 | 1 on 10 for special | | read poetry does 1D damage to whole party | 9 | 10 | 9 | 10 | 15 | 25 | | 27 | | 08B | Predator | 12 | 2 on 8 for 3 | 1 on dbl for special | shoulder cannon does DoD | 9 | 9 | 9 | 9 | 15 | 30 | Invisible | 28 | | 09B | Alien | 12 | 2 on 8 for 3 | 1 on dbl for special | Tail does DoD | 11 | 11 | 10 | 11 | 10 | 50 | *ACID* | 29 | | 10B | Daleks | 12 | 1 on dbl for kill | | | 11 | 11 | 11 | 11 | 20 | 50 | | 30 | 31 | * LICENSE 32 | 33 | This program is free software; you can redistribute it and/or modify 34 | it under the terms of the GNU General Public License as published by 35 | the Free Software Foundation, either version 3 of the License, or 36 | (at your option) any later version. 37 | 38 | This program is distributed in the hope that it will be useful, 39 | but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | GNU General Public License for more details. 42 | 43 | You should have received a copy of the GNU General Public License 44 | along with this program. If not, see . 45 | -------------------------------------------------------------------------------- /Docs/Treasure/generator.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Treasure generation table 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik C Elmshauser 5 | :Created: 2020/01/10 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | This set of tables is designed to pick what kind of treasure the party finds for normal chamber encounters 14 | 15 | + Players Roll 3D, 1 at a time 16 | + Current dungeon level is the table used for a roll of 1 on the first die 17 | + Second die is Down the table 18 | + Third die is across the table 19 | 20 | ** Key: 21 | | S | Silver | 22 | | G | Gold | 23 | | J | Jewels | 24 | | V | Victual | 25 | | W | Weapon | 26 | | R | Relic | 27 | | Sp | Spell | 28 | | A | Amulet / Ring | 29 | | E | Event | 30 | | C | Card | 31 | | U | Ubik | 32 | 33 | ** Table 1 34 | | | 1 | 2 | 3 | 4 | 5 | 6 | 35 | | 1 | 30 Silver | S | S | S | S | G | 36 | | 2 | S | S | S | S | G | G | 37 | | 3 | S | S | S | G | G | J | 38 | | 4 | S | S | G | G | J | J | 39 | | 5 | S | G | G | J | J | C | 40 | | 6 | G | G | J | J | C | E | 41 | 42 | ** Table 2 43 | | | 1 | 2 | 3 | 4 | 5 | 6 | 44 | | 1 | 30 Silver | S | S | G | G | J | 45 | | 2 | S | S | G | G | J | J | 46 | | 3 | S | G | G | J | J | V | 47 | | 4 | G | G | J | J | V | C | 48 | | 5 | G | J | J | V | C | W | 49 | | 6 | J | J | V | C | R | Sp | 50 | 51 | ** Table 3 52 | | | 1 | 2 | 3 | 4 | 5 | 6 | 53 | | 1 | 30 Silver | S | G | J | J | V | 54 | | 2 | S | G | G | J | V | Sp | 55 | | 3 | G | G | J | V | R | A | 56 | | 4 | J | J | V | Sp | A | E | 57 | | 5 | J | V | W | A | E | C | 58 | | 6 | V | R | A | E | C | C | 59 | 60 | ** Table 4 61 | | | 1 | 2 | 3 | 4 | 5 | 6 | 62 | | 1 | S | S | G | G | J | V | 63 | | 2 | S | G | G | J | V | Sp | 64 | | 3 | G | G | J | V | A | A | 65 | | 4 | G | J | V | W | A | C | 66 | | 5 | Sp | V | R | A | C | E | 67 | | 6 | V | R | A | C | E | E | 68 | 69 | ** Table 5 70 | | | 1 | 2 | 3 | 4 | 5 | 6 | 71 | | 1 | S | S | G | G | J | V | 72 | | 2 | S | G | G | J | V | Sp | 73 | | 3 | G | G | J | V | A | A | 74 | | 4 | G | J | V | W | A | C | 75 | | 5 | Sp | V | R | A | C | E | 76 | | 6 | V | R | A | C | E | E | 77 | 78 | ** Table 6 79 | | | 1 | 2 | 3 | 4 | 5 | 6 | 80 | | 1 | S | G | J | V | R | Sp | 81 | | 2 | G | J | V | R | Sp | C | 82 | | 3 | J | V | R | Sp | C | C | 83 | | 4 | V | W | Sp | C | C | E | 84 | | 5 | R | R | C | C | E | E | 85 | | 6 | Sp | C | C | E | E | U | 86 | 87 | ** Table 7 88 | | | 1 | 2 | 3 | 4 | 5 | 6 | 89 | | 1 | G | J | V | Sp | R | W | 90 | | 2 | J | V | Sp | R | W | A | 91 | | 3 | V | Sp | S | W | A | C | 92 | | 4 | W | W | R | A | C | C | 93 | | 5 | Sp | R | A | C | E | E | 94 | | 6 | R | A | C | C | E | U | 95 | 96 | ** Table 8 97 | | | 1 | 2 | 3 | 4 | 5 | 6 | 98 | | 1 | G | J | V | Sp | R | W | 99 | | 2 | J | V | Sp | R | W | A | 100 | | 3 | V | Sp | S | W | A | C | 101 | | 4 | W | W | R | A | C | C | 102 | | 5 | Sp | R | A | C | E | E | 103 | | 6 | R | A | C | C | E | U | 104 | 105 | ** Table 9 106 | | | 1 | 2 | 3 | 4 | 5 | 6 | 107 | | 1 | J | V | A | W | R | Sp | 108 | | 2 | V | A | W | R | Sp | C | 109 | | 3 | A | W | R | Sp | C | C | 110 | | 4 | W | W | Sp | C | C | E | 111 | | 5 | R | R | C | C | E | U | 112 | | 6 | Sp | C | C | E | U | U | 113 | 114 | * LICENSE 115 | 116 | This program is free software; you can redistribute it and/or modify 117 | it under the terms of the GNU General Public License as published by 118 | the Free Software Foundation, either version 3 of the License, or 119 | (at your option) any later version. 120 | 121 | This program is distributed in the hope that it will be useful, 122 | but WITHOUT ANY WARRANTY; without even the implied warranty of 123 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 124 | GNU General Public License for more details. 125 | 126 | You should have received a copy of the GNU General Public License 127 | along with this program. If not, see . 128 | -------------------------------------------------------------------------------- /Docs/Misc/SavingThrow.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Merged Saving Throw table 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik C Elmshauser and Corwin Brust 5 | :Created: 2020/01/11 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | * Erik's Version 14 | 15 | This table is a lookup of saving throws. 16 | 17 | + Players roll 2D6 together 18 | + Low Doubles means double 1 or 2 19 | + High Doubles means double 5 or 6 20 | + SnakEyes means double 1 21 | + BoxCars means double 6 22 | 23 | ** Saving Throws by level 24 | | Level | Roll Needed | Odds | 25 | | 0 | No Throw | Automatic Success | 26 | | 1 | Avoid SnakEyes | 35/36 | 27 | | 2 | Avoid Low Doubles | 34/36 | 28 | | 3 | Avoid Doubles | 30/36 | 29 | | 4 | Avoid Doubles, 7 | 24/36 | 30 | | 5 | Avoid Doubles, 7, 8 | 19/36 | 31 | | 6 | Doubles, 7, 9, 11 | 18/36 | 32 | | 7 | Doubles, 7, 9 | 16/36 | 33 | | 8 | Avoid Doubles, 6, 7, 8 | 14/36 | 34 | | 9 | Doubles, 7 | 12/36 | 35 | | 10 | Doubles, 9 | 10/36 | 36 | | 11 | Doubles, 11 | 8/36 | 37 | | 12 | Doubles | 6/36 | 38 | | 13 | Doubles !SnakEyes | 5/36 | 39 | | 14 | Double 3,4,5,6 | 4/36 | 40 | | 15 | Double 4,5,6 | 3/36 | 41 | | 16 | High Doubles | 2/36 | 42 | | 17 | BoxCars | 1/36 | 43 | | 18 | No Throw | Automatic Fail | 44 | 45 | + The following table is for reference only and was used to help compute odds in the above table. 46 | ** Saving throw breakdown by odds 47 | | | 1 | 2 | 3 | 4 | 5 | 6 | 48 | | 1 | 2 (Dbl) (LD) (SE) | 3 | 4 | 5 | 6 | 7 | 49 | | 2 | 3 | 4 (Dbl) (LD) | 5 | 6 | 7 | 8 | 50 | | 3 | 4 | 5 | 6 (Dbl) | 7 | 8 | 9 | 51 | | 4 | 5 | 6 | 7 | 8 (Dbl) | 9 | 10 | 52 | | 5 | 6 | 7 | 8 | 9 | 10 (Dbl) (HD) | 11 | 53 | | 6 | 7 | 8 | 9 | 10 | 11 | 12 (Dbl) (HD) (BX) | 54 | 55 | * Corwin's Version 56 | This is a generic lookup table used for calculating difficulty as a 57 | single roll of two six-sided dice. The base difficulty is the dungeon 58 | level unless otherwise noted (e.g. a difficulty specified for selected 59 | baddie would generally govern). 60 | 61 | ** Difficulty 62 | 63 | | -10 | Boxcars => Boxcars | bad | 64 | | -9 | Bx => Avoid Even | | 65 | | -8 | Bx => Avoid D+3+5+7 | | 66 | | -7 | Bx => Avoid D+7 | | 67 | | -6 | Bx => Avoid D+3+5 | | 68 | | -5 | Bx => Avoid D | | 69 | | -4 | Bx => Avoid LowD | | 70 | | -3 | Bx => Avoid Sn | | 71 | | -2 | Boxcars | | 72 | | -1 | High-Doubles | | 73 | | 0 | Doubles | even-up | 74 | | 1 | D+11 | | 75 | | 2 | D+9+11 | | 76 | | 3 | D+7 | | 77 | | 4 | D+7+11 | | 78 | | 5 | D+7+9+11 | | 79 | | 6 | Even | | 80 | | 7 | Avoid D+3+5+7+11 | | 81 | | 8 | Avoid D+7 | | 82 | | 10 | Avoid D | | 83 | | 11 | Avoid High Doubles | | 84 | | 12 | Avoid Boxcars | | 85 | | 13 | Avoid Boxcars => Boxcars | good | 86 | 87 | * LICENSE 88 | 89 | This program is free software; you can redistribute it and/or modify 90 | it under the terms of the GNU General Public License as published by 91 | the Free Software Foundation, either version 3 of the License, or 92 | (at your option) any later version. 93 | 94 | This program is distributed in the hope that it will be useful, 95 | but WITHOUT ANY WARRANTY; without even the implied warranty of 96 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 97 | GNU General Public License for more details. 98 | 99 | You should have received a copy of the GNU General Public License 100 | along with this program. If not, see . 101 | -------------------------------------------------------------------------------- /testmap.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Test Map 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik Elmshauser 5 | :Created: 2020/01/26 6 | :END: 7 | 8 | * Test Map 9 | :PROPERTIES: 10 | :NAME: test-map-level 11 | :ETL: cell 12 | :END: 13 | 14 | #+NAME:test-map-level 15 | 16 | This is a sample map used to develop and test map features and rendering code. 17 | Refer to design.org for more details. 18 | 19 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 20 | This softare is released under the GNU Public Licence version three 21 | or, at your disgression, any newer version of the GNU Public 22 | License. For specific terms please see [[LICENSE]] at end-of-file. 23 | 24 | | X | Y | Features | 25 | |---+---+-----------------------------| 26 | | 0 | 0 | 20◦S-E | 27 | | 1 | 0 | (0 . 0) | 28 | | 2 | 0 | 20◦S-E | 29 | | 3 | 0 | (2 . 0) | 30 | | 4 | 0 | 20◦S-W | 31 | | 5 | 0 | (4 . 0) | 32 | | 6 | 0 | 20◦S-W | 33 | | 7 | 0 | (6 . 0) | 34 | | | | | 35 | | 0 | 1 | (0 . 0) | 36 | | 1 | 1 | (0 . 0) | 37 | | 2 | 1 | (2 . 0) | 38 | | 3 | 1 | (2 . 0) | 39 | | 4 | 1 | (4 . 0) | 40 | | 5 | 1 | (4 . 0) | 41 | | 6 | 1 | (6 . 0) | 42 | | 7 | 1 | (6 . 0) | 43 | | | | | 44 | | 0 | 2 | 10◦E | 45 | | 1 | 2 | cES◦NW | 46 | | 2 | 2 | cESW | 47 | | 3 | 2 | cEW◦NS | 48 | | 4 | 2 | cEW◦NS | 49 | | 5 | 2 | cSW | 50 | | 6 | 2 | A2 ‡W ◦N → ‡N ! ‡E ‡S ← ‡S | 51 | | 7 | 2 | (6 . 2) | 52 | | | | | 53 | | 0 | 3 | 10◦E | 54 | | 1 | 3 | cNS◦W | 55 | | 2 | 3 | cNS | 56 | | 3 | 3 | 10◦N | 57 | | 4 | 3 | 10◦N | 58 | | 5 | 3 | cNES | 59 | | 6 | 3 | (6 . 2) | 60 | | 7 | 3 | (6 . 2) | 61 | | | | | 62 | | 0 | 4 | 10◦E | 63 | | 1 | 4 | cNS◦W | 64 | | 2 | 4 | cNES | 65 | | 3 | 4 | cEW◦S | 66 | | 4 | 4 | cEW | 67 | | 5 | 4 | cNSW | 68 | | 6 | 4 | cSE ◦E | 69 | | 7 | 4 | 10◦W | 70 | | | | | 71 | | 0 | 5 | 10◦E | 72 | | 1 | 5 | cNS◦W | 73 | | 2 | 5 | cNS | 74 | | 3 | 5 | 20◦N-W | 75 | | 4 | 5 | (3 . 5) | 76 | | 5 | 5 | cNES | 77 | | 6 | 5 | cNSW◦E | 78 | | 7 | 5 | 10◦W | 79 | | | | | 80 | | 0 | 6 | 10◦E | 81 | | 1 | 6 | cNS◦W | 82 | | 2 | 6 | cNS | 83 | | 3 | 6 | (3 . 5) | 84 | | 4 | 6 | (3 . 5) | 85 | | 5 | 6 | cNS | 86 | | 6 | 6 | cN◦ES | 87 | | 7 | 6 | 10◦W | 88 | | | | | 89 | | 0 | 7 | 10◦E | 90 | | 1 | 7 | cNES◦W | 91 | | 2 | 7 | c4 | 92 | | 3 | 7 | cESW | 93 | | 4 | 7 | cEW | 94 | | 5 | 7 | cWN◦E | 95 | | 6 | 7 | 20◦W-N◦N-W | 96 | | 7 | 7 | (6 . 7) | 97 | | | | | 98 | | 0 | 8 | 10◦E | 99 | | 1 | 8 | cNS◦W | 100 | | 2 | 8 | cNS | 101 | | 3 | 8 | cNS | 102 | | 4 | 8 | 10◦S | 103 | | 5 | 8 | 10◦S | 104 | | 6 | 8 | (6 . 7) | 105 | | 7 | 8 | (6 . 7) | 106 | | | | | 107 | 108 | * LICENSE 109 | 110 | This program is free software; you can redistribute it and/or modify 111 | it under the terms of the GNU General Public License as published by 112 | the Free Software Foundation, either version 3 of the License, or 113 | (at your option) any later version. 114 | 115 | This program is distributed in the hope that it will be useful, 116 | but WITHOUT ANY WARRANTY; without even the implied warranty of 117 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 118 | GNU General Public License for more details. 119 | 120 | You should have received a copy of the GNU General Public License 121 | along with this program. If not, see . 122 | -------------------------------------------------------------------------------- /Docs/Maps/testmap.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Test Map 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik Elmshauser 5 | :Created: 2020/01/26 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | * Test Map 14 | :PROPERTIES: 15 | :NAME: test-map-level 16 | :ETL: cell 17 | :END: 18 | 19 | #+NAME:test-map-level 20 | 21 | This is a sample map used to develop and test map features and rendering code. 22 | Refer to design.org for more details. 23 | 24 | | X | Y | Path | 25 | |---+---+-----------------------------| 26 | | 0 | 0 | 20◦S-E | 27 | | 1 | 0 | (0 . 0) | 28 | | 2 | 0 | 20◦S-E | 29 | | 3 | 0 | (2 . 0) | 30 | | 4 | 0 | 20◦S-W | 31 | | 5 | 0 | (4 . 0) | 32 | | 6 | 0 | 20◦S-W | 33 | | 7 | 0 | (6 . 0) | 34 | | | | | 35 | | 0 | 1 | (0 . 0) | 36 | | 1 | 1 | (0 . 0) | 37 | | 2 | 1 | (2 . 0) | 38 | | 3 | 1 | (2 . 0) | 39 | | 4 | 1 | (4 . 0) | 40 | | 5 | 1 | (4 . 0) | 41 | | 6 | 1 | (6 . 0) | 42 | | 7 | 1 | (6 . 0) | 43 | | | | | 44 | | 0 | 2 | 10◦E | 45 | | 1 | 2 | cES◦NW | 46 | | 2 | 2 | cESW | 47 | | 3 | 2 | cEW◦NS | 48 | | 4 | 2 | cEW◦NS | 49 | | 5 | 2 | cSW | 50 | | 6 | 2 | A2 ‡W ◦N → ‡N ! ‡E ‡S ← ‡S | 51 | | 7 | 2 | (6 . 2) | 52 | | | | | 53 | | 0 | 3 | 10◦E | 54 | | 1 | 3 | cNS◦W | 55 | | 2 | 3 | cNS | 56 | | 3 | 3 | 10◦N | 57 | | 4 | 3 | 10◦N | 58 | | 5 | 3 | cNES | 59 | | 6 | 3 | (6 . 2) | 60 | | 7 | 3 | (6 . 2) | 61 | | | | | 62 | | 0 | 4 | 10◦E | 63 | | 1 | 4 | cNS◦W | 64 | | 2 | 4 | cNES | 65 | | 3 | 4 | cEW◦S | 66 | | 4 | 4 | cEW | 67 | | 5 | 4 | cNSW | 68 | | 6 | 4 | cSE ◦E | 69 | | 7 | 4 | 10◦W | 70 | | | | | 71 | | 0 | 5 | 10◦E | 72 | | 1 | 5 | cNS◦W | 73 | | 2 | 5 | cNS | 74 | | 3 | 5 | 20◦N-W | 75 | | 4 | 5 | (3 . 5) | 76 | | 5 | 5 | cNES | 77 | | 6 | 5 | cNSW◦E | 78 | | 7 | 5 | 10◦W | 79 | | | | | 80 | | 0 | 6 | 10◦E | 81 | | 1 | 6 | cNS◦W | 82 | | 2 | 6 | cNS | 83 | | 3 | 6 | (3 . 5) | 84 | | 4 | 6 | (3 . 5) | 85 | | 5 | 6 | cNS | 86 | | 6 | 6 | cN◦ES | 87 | | 7 | 6 | 10◦W | 88 | | | | | 89 | | 0 | 7 | 10◦E | 90 | | 1 | 7 | cNES◦W | 91 | | 2 | 7 | c4 | 92 | | 3 | 7 | cESW | 93 | | 4 | 7 | cEW | 94 | | 5 | 7 | cWN◦E | 95 | | 6 | 7 | 20◦W-N◦N-W | 96 | | 7 | 7 | (6 . 7) | 97 | | | | | 98 | | 0 | 8 | 10◦E | 99 | | 1 | 8 | cNS◦W | 100 | | 2 | 8 | cNS | 101 | | 3 | 8 | cNS | 102 | | 4 | 8 | 10◦S | 103 | | 5 | 8 | 10◦S | 104 | | 6 | 8 | (6 . 7) | 105 | | 7 | 8 | (6 . 7) | 106 | | | | | 107 | 108 | * LICENSE 109 | 110 | This program is free software; you can redistribute it and/or modify 111 | it under the terms of the GNU General Public License as published by 112 | the Free Software Foundation, either version 3 of the License, or 113 | (at your option) any later version. 114 | 115 | This program is distributed in the hope that it will be useful, 116 | but WITHOUT ANY WARRANTY; without even the implied warranty of 117 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 118 | GNU General Public License for more details. 119 | 120 | You should have received a copy of the GNU General Public License 121 | along with this program. If not, see . 122 | -------------------------------------------------------------------------------- /src/dm-object-to-org.el: -------------------------------------------------------------------------------- 1 | ;;; dm-object-to-org.el --- stringify objects to org format -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: lisp 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;;; require core 24 | (require 'eieio) 25 | (require 'subr-x) 26 | (require 'seq) 27 | 28 | ;; use format sequences to stringify objects for use with `org-mode' 29 | 30 | ;;; Code: 31 | 32 | ;;; CONSIDER: 33 | ;;; - use DATA cell (first slot) for alist 34 | ;;; ( #+NAME . ( PROPERTIES-DRAWER )) 35 | ;;; Construct Doc: 36 | ;;; - format per DATA 37 | ;;; - SRC block for object's elisp source 38 | ;;; Construct Obj: 39 | ;;; - when SRC block exists: 40 | ;;; * load from block 41 | ;;; * update from any org sources for named items given in DATA 42 | ;;; - when no SRC block exists: 43 | ;;; * prompt user for any missing info (e.g. slots, instance types,...) 44 | ;;; - must be able to define classes as well as instances 45 | 46 | 47 | 48 | (defvar dm-object-to-org-keyword-alist 49 | '((:h* dm-object-to-org--format-h*) 50 | (:begin_src "\n#+BEGIN_SRC") 51 | (:end_src "\n#+END_SRC\n") 52 | (:begin_quote "\n#+BEGIN_QUOTE") 53 | (:end_quote "\n#+END_QUOTE\n") 54 | (:begin_table "\n|") 55 | (:end_table "|\n")) 56 | "Alist mapping keywords to org syntax. 57 | 58 | Maps a keyword representing an ORG-MODE-BLOCK to a STRING 59 | representation. Values may be either string or other 60 | literal (which will be converted to string) or a function which 61 | will receive the keyword along with the format sequence in which 62 | and index at which it appeared.") 63 | 64 | (defun dm-object-to-org--format-h* (kw &rest ignored) 65 | "Format org headline type KW as a string. 66 | 67 | Other inputs are IGNORED. 68 | 69 | \(fn (kw &optional obj seq ix))" 70 | (ignore ignored) 71 | (concat "\n" 72 | (make-string 73 | (string-to-number (substring (symbol-name kw) 2)) 74 | ?*) 75 | " ")) 76 | ;;(dm-object-to-org--format-h* :h3) 77 | 78 | (defun dm-object-to-org (obj &rest seq) 79 | "Return string continaing org markup for OBJ. 80 | 81 | SEQ are org blocks, OBJ slots, other objects, and instructions 82 | for formatting these. 83 | 84 | Supported Directives: 85 | 86 | A list found following an org specifier is taken as args and 87 | appended to the (first line of) output concaterating all elements 88 | and any prior text on the line with a space. The same is true 89 | for a list found following a symbol with a function defination, 90 | see below, however list is inital args to function al-al 91 | `apply-partially'. Similarly, a list found following an object 92 | is assumed to be inputs to this function to support a recursive 93 | call. 94 | 95 | - Org Directives: 96 | 97 | * :h1 .. :hN - per `TODO var name for max org levels??' 98 | * :begin-src and :end-src - begin/end org code block 99 | * :begin-quote and :end-quote - begin/end org quote block 100 | * :start-table and :end-table - begin/end org table 101 | 102 | - Object/Slot/Other Access Directives 103 | 104 | * OBJECT - insert the result of calling this function on OBJECT 105 | * SLOT (unquoted) - include content of SLOT of OBJ 106 | * FUNCTION (unquoted) - call FUNCTION passing obj, sections 107 | and position into sections as a zero based index. 108 | 109 | - Any other values treated as literal and converted to 110 | string as necessary. 111 | 112 | Note, although most unrecognized keywords will be silently 113 | ignored, due to the implemention of :h1 and friends those 114 | beginning with :h won't be. A confusing error will be throw if 115 | not such a keyword is found which does not appear in 116 | `dm-object-to-org-keyword-alist'." 117 | (when obj 118 | (apply 'concat 119 | (delete 120 | nil 121 | (seq-map-indexed 122 | (lambda (fmt findex) 123 | (cond ((stringp fmt) fmt) 124 | ((keywordp fmt) 125 | (let ((fmtr 126 | (cadr (assq fmt dm-object-to-org-keyword-alist)))) 127 | (if fmtr 128 | (if (functionp fmtr) 129 | (funcall fmtr fmt obj seq findex) 130 | (format "%s" fmtr)) 131 | (when (string= "h" (substring (symbol-name fmt) 1 2)) 132 | (funcall (cadr (assq ':h* dm-object-to-org-keyword-alist)) 133 | fmt obj seq findex))))) 134 | ((slot-exists-p obj fmt) (format "%s" (oref obj fmt))) 135 | ((eieio-object-p fmt) 136 | (ingore "TODO: save this for when it moves into dm-persistent")) 137 | ((functionp fmt) (funcall fmt fmt obj seq findex)) 138 | (t (format "%s" fmt)))) seq))) 139 | )) 140 | 141 | ;;(defclass my-class () ((foo :initform "bar" :initarg :foo))) 142 | ;;(defun my-foo (&rest args) "Docstring using ARGS." (ignore args) "Hi") 143 | ;;(dm-object-to-org (my-class) :h1 "hi" :h3 "hi back" :begin_src :h4 'my-foo) 144 | 145 | (provide 'dm-object-to-org) 146 | ;;; dm-object-to-org.el ends here 147 | -------------------------------------------------------------------------------- /src/dm-svg-tests.el: -------------------------------------------------------------------------------- 1 | ;;; dm-svg-tests.el --- tests for dm-svg -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; Tests for `dm-svg' which see 24 | 25 | ;;; Code: 26 | 27 | (defmacro dm-test-load-path () 28 | "Build a temporary `load-path' for a test's context package." 29 | `(list (file-name-directory (or buffer-file-name (buffer-name))))) 30 | 31 | (defun dm-test-maybe-require (package &optional forcep) 32 | "Require PACKAGE when not loaded or FORCEP is t." 33 | (unless (or forcep (featurep 'dm-svg)) 34 | (require package))) 35 | 36 | ;; :TODO:DONE: factor out above macro and func 37 | ;; TODO consider buttercup.el https://github.com/jorgenschaefer/emacs-buttercup 38 | 39 | (ert-deftest dm-svg--require () 40 | "require `dm-svg'" 41 | :tags '(:dm-svg :requires) 42 | (let ((load-path (dm-test-load-path))) 43 | (should (eq 'dm-svg (require 'dm-svg))))) 44 | 45 | (ert-deftest dm-svg-dom-node-p () 46 | "predicate `dm-svg-dom-node-p'" 47 | :tags '(:dm-svg :dom :predicate) 48 | (should (equal nil (dm-svg-dom-node-p nil))) 49 | (should (equal nil (dm-svg-dom-node-p '()))) 50 | (should (equal t (dm-svg-dom-node-p '(tag)))) 51 | (should (equal nil (dm-svg-dom-node-p '(tag) 'nottag))) 52 | (should (equal t (dm-svg-dom-node-p '(tag) 'tag))) 53 | (should (equal t (dm-svg-dom-node-p (dom-node 'tag) 'tag))) 54 | (should (equal t (dm-svg-dom-node-p (dom-node 'tag '((attr . "val")) 55 | ) 'tag))) 56 | (should (equal t (dm-svg-dom-node-p (dom-node 'tag nil (dom-node 'child) 57 | ) 'tag))) 58 | (should (equal t (dm-svg-dom-node-p (dom-node 'tag 59 | '((attr . "val")) 60 | (dom-node 'child) 61 | ) 'tag)))) 62 | 63 | (ert-deftest dm-svg-or-nil-p () 64 | "predicate `dm-svg-or-nil-p'" 65 | :tags '(:dm-svg :svg :predicate) 66 | (should (eq 2 (length (delete 67 | nil 68 | (mapcar 'dm-svg-or-nil-p 69 | (list nil t (svg-create 500 500)))))))) 70 | 71 | (ert-deftest dm-svg-path-or-path-data-p () 72 | "predicate `dm-svg-path-or-path-data-p'" 73 | :tags '(:dm-svg :svg :predicate) 74 | (should (eq nil (dm-svg-path-or-path-data-p 'foo))) 75 | (should (eq t (dm-svg-path-or-path-data-p nil))) 76 | (should (eq t (dm-svg-path-or-path-data-p ""))) 77 | (should (eq t (dm-svg-path-or-path-data-p (dom-node 'path))))) 78 | 79 | (ert-deftest dm-svg-create-path () 80 | "function `dm-svg-create-path'" 81 | :tags '(:dm-svg :svg :predicate) 82 | (should (dm-svg-create-path)) 83 | (should (equal (dom-node 'path '((d))) 84 | (dm-svg-create-path))) 85 | (should (equal (dom-node 'path '((d))) 86 | (dm-svg-create-path nil))) 87 | (should (equal (dom-node 'path '((d . ""))) 88 | (dm-svg-create-path ""))) 89 | (should (equal (dom-node 'path '((d . "m1,1"))) 90 | (dm-svg-create-path "m1,1"))) 91 | (should (equal (dom-node 'path '((d . "") (stroke . "black"))) 92 | (dm-svg-create-path "" '((stroke . "black"))))) 93 | (should (equal (dom-node 'path '((d . "")) (dom-node 'child)) 94 | (dm-svg-create-path "" nil (dom-node 'child) )))) 95 | 96 | (ert-deftest dm-svg--create () 97 | "constructor `dm-svg'" 98 | :tags '(:dm-svg :svg :create) 99 | (should 100 | (prog1 t (dolist (x (list '(nil . nil) `(,(svg-create 500 500) . "v100"))) 101 | (dm-svg :svg (car x) :path-data (cdr x)))))) 102 | 103 | (ert-deftest dm-svg-add-svg-element () 104 | "method `add-path-data'" 105 | :tags '(:dm-svg :svg :method) 106 | (should 107 | (equal (dom-append-child (dom-node 'svg) (dom-node 'child)) 108 | (let ((o (dm-svg))) 109 | (add-svg-element o (dom-node 'child)) 110 | )))) 111 | 112 | (ert-deftest dm-svg-add-path-data () 113 | "method `add-svg-element'" 114 | :tags '(:dm-svg :svg :method) 115 | (should 116 | (string= "v100h100v-100h-100" 117 | (let ((o (dm-svg :svg (svg-create 500 500) :path-data "v100"))) 118 | (add-path-data o "h100v-100h-100"))))) 119 | 120 | (ert-deftest dm-svg-render-and-insert () 121 | "method `render-and-insert'" 122 | :tags '(:dm-svg :svg :method) 123 | (let* ((c (with-temp-buffer 124 | (render-and-insert (dm-svg :svg (svg-create 100 100) 125 | :path-data 126 | "m100,100h100v100h-100v-100")) 127 | ;;(buffer-string) 128 | (plist-get (text-properties-at 1) 'display))) 129 | (d (plist-get (cdr c) ':data)) 130 | (s (plist-get (cdr c) ':type))) 131 | (message "c:%s\nd:%s\ns:%s" c d s) 132 | (should (eq s 'svg)) 133 | (should (string= d (concat 134 | "" 136 | " "))) 137 | )) 138 | 139 | ;; :ease-of-eval 140 | ;; (render-and-insert (dm-svg :svg (svg-create 500 500 :stroke "none" :fill "none") 141 | ;; :path-data 142 | ;; (dm-svg-create-path "m100,100h100v100h-100v-100" 143 | ;; '((stroke . "green") 144 | ;; (stroke-width . 3)) 145 | ;; ))) 146 | 147 | 148 | 149 | (provide 'dm-svg-tests) 150 | ;;; dm-svg-tests.el ends here 151 | -------------------------------------------------------------------------------- /Docs/Maps/test/water-test.org: -------------------------------------------------------------------------------- 1 | * Water Tiles 2 | :PROPERTIES: 3 | :name: 10-water-tiles 4 | :MAP-FEATURES: t 5 | :WATER: stroke="none" fill="blue" 6 | :DECORATIONS: stroke="none" fill="" fill-opacity=".9" 7 | :ETL: tile 8 | :END: 9 | 10 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 11 | This softare is released under the GNU Public Licence version three 12 | or, at your disgression, any newer version of the GNU Public 13 | License. For specific terms please see [[LICENSE]] at end-of-file. 14 | 15 | # #+NAME: 10-water-Tiles 16 | | Tile | Water | Decorations | 17 | |-----------+--------------------------------------------------+-----------------------------------------------------| 18 | | pool1 | h1 a1.5,1.5,0,0,1,1,1 v1 a1.5,1.5,0,0,1,-1,1 | | 19 | | | h-1 a1.5,1.5,0,0,1,-1,-1 v-1 a1.5,1.5,0,0,1,1,-1 | | 20 | | | | | 21 | | riv1 | h1 v1 h-1 v-1 | | 22 | | | | | 23 | | riv1N | &riv1 | m.49,.80 h.02 v-.5 h.05 l-.06,-.1 l-.06,.1 h.05 v.5 | 24 | | riv1E | &riv1 | m.75,.49 h-.5 v.02 h.5 v.05 l.1,-.06 l-.1,-.06 v.05 | 25 | | riv1S | &riv1 | m.49,.2 h.02 v.5 h.05 l-.06,.1 l-.06,-.1 h.05 v-.5 | 26 | | riv1W | &riv1 | m.25,.49 h.5 v.02 h-.5 v.05 l-.1,-.06 l.1,-.06 v.05 | 27 | | | | | 28 | 29 | * Water Test Map 30 | :PROPERTIES: 31 | :NAME: water-test-map-level 32 | :ETL: cell 33 | :END: 34 | 35 | #+NAME:water-test-map-level 36 | 37 | This is a sample map used to develop and test map features and rendering code. 38 | Refer to design.org for more details. 39 | 40 | | X | Y | Path | 41 | |---+---+---------| 42 | | 0 | 0 | &pool1 | 43 | | 1 | 0 | (0 . 0) | 44 | | 2 | 0 | (0 . 0) | 45 | | 3 | 0 | | 46 | |---+---+---------| 47 | | 0 | 1 | (0 . 0) | 48 | | 1 | 1 | (0 . 0) | 49 | | 2 | 1 | (0 . 0) | 50 | | 3 | 0 | &riv1E | 51 | |---+---+---------| 52 | | 0 | 2 | (0 . 0) | 53 | | 1 | 2 | (0 . 0) | 54 | | 2 | 2 | (0 . 0) | 55 | | 3 | 0 | | 56 | |---+---+---------| 57 | | 0 | 3 | | 58 | | 1 | 3 | &riv1S | 59 | | 2 | 3 | | 60 | | 3 | 0 | | 61 | 62 | 63 | * Test 64 | 65 | #+BEGIN_SRC emacs-lisp 66 | (let ((dm-map-files (list (buffer-file-name))) 67 | (dm-map-draw-other-props (list 'water 'decorations)) 68 | ;;(dm-map-background '(nil)) 69 | (dm-map-level-size (cons 4 4)) 70 | (dm-map-nudge (cons 8 8)) 71 | (dm-map-draw-attributes 72 | '(path ((fill . "none") 73 | (stroke . "red") 74 | (stroke-width . "1")) 75 | water ((fill . "blue") 76 | (stroke . "cyan") 77 | (stroke-width . "1")) 78 | decorations ((fill . "none") 79 | (stroke . "green") 80 | (stroke-width . "1"))))) 81 | (dm-map-draw t) 82 | (prin1-to-string (list 'tiles dm-map-tiles 'level dm-map-level))) 83 | #+END_SRC 84 | 85 | #+RESULTS: 86 | : (tiles #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (pool1 (path nil tag nil overlay nil stairs nil water ((h (1)) (a (1.5 1.5 0 0 1 1 1)) (v (1)) (a (1.5 1.5 0 0 1 -1 1)) (h (-1)) (a (1.5 1.5 0 0 1 -1 -1)) (v (-1)) (a (1.5 1.5 0 0 1 1 -1))) beach nil neutronium nil decorations nil) riv1 (path nil tag nil overlay nil stairs nil water ((h (1)) (v (1)) (h (-1)) (v (-1))) beach nil neutronium nil decorations nil) riv1N (path nil tag nil overlay nil stairs nil water (riv1) beach nil neutronium nil decorations ((m (0.49 0.8)) (h (0.02)) (v (-0.5)) (h (0.05)) (l (-0.06 -0.1)) (l (-0.06 0.1)) (h (0.05)) (v (0.5)))) riv1E (path nil tag nil overlay nil stairs nil water (riv1) beach nil neutronium nil decorations ((m (0.75 0.49)) (h (-0.5)) (v (0.02)) (h (0.5)) (v (0.05)) (l (0.1 -0.06)) (l (-0.1 -0.06)) (v (0.05)))) riv1S (path nil tag nil overlay nil stairs nil water (riv1) beach nil neutronium nil decorations ((m (0.49 0.2)) (h (0.02)) (v (0.5)) (h (0.05)) (l (-0.06 0.1)) (l (-0.06 -0.1)) (h (0.05)) (v (-0.5)))) riv1W (path nil tag nil overlay nil stairs nil water (riv1) beach nil neutronium nil decorations ((m (0.25 0.49)) (h (0.5)) (v (0.02)) (h (-0.5)) (v (0.05)) (l (-0.1 -0.06)) (l (0.1 -0.06)) (v (0.05)))))) level #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ((0 . 0) (path (pool1)) (1 . 0) (path ((0 . 0))) (2 . 0) (path ((0 . 0))) (3 . 0) (path nil) (0 . 1) (path ((0 . 0))) (1 . 1) (path ((0 . 0))) (2 . 1) (path ((0 . 0))) (0 . 2) (path ((0 . 0))) (1 . 2) (path ((0 . 0))) (2 . 2) (path ((0 . 0))) (0 . 3) (path nil) (1 . 3) (path (riv1S)) (2 . 3) (path nil)))) 87 | 88 | * LICENSE 89 | 90 | This program is free software; you can redistribute it and/or modify 91 | it under the terms of the GNU General Public License as published by 92 | the Free Software Foundation, either version 3 of the License, or 93 | (at your option) any later version. 94 | 95 | This program is distributed in the hope that it will be useful, 96 | but WITHOUT ANY WARRANTY; without even the implied warranty of 97 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 98 | GNU General Public License for more details. 99 | 100 | You should have received a copy of the GNU General Public License 101 | along with this program. If not, see . 102 | -------------------------------------------------------------------------------- /Docs/Treasure/Relic.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Treasure generation table 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Corwin Brust 5 | :Created: 2020/01/11 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | This set of tables pick a specific Relic found in treasure. In can be 14 | use for normal chamber and other types of encounters (e.g. beach, 15 | tower, corridor). 16 | 17 | + Calculate (base-index) as the index of the encounter after adding any 18 | adjustment from the baddie, events, etc. 19 | + Dungeon Master rolls 1d re-rolling and adding any six to create 20 | (adjusted-index) 21 | + Use the final die roll to select a Type 22 | + Players roll into starting tables according the rules given 23 | 24 | ** Type: 25 | | 1 | Armor | 26 | | 2 | Shields | 27 | | 3 | Items | 28 | | 4 | Relic Power | 29 | | 5 | Weapons | 30 | | 6 | Add & Re-roll | 31 | 32 | ** Armor 33 | 34 | + Players roll 1d (re-rolling 6s) into the table according the final 35 | adjusted index from the games master. Effectively, we are 36 | graduating the increase in base damage with an increased 37 | possibility of the armor having additional properties ("effects"). 38 | + Players roll to trigger each possible effect, forms generally 39 | following the Saving Throw difficulty table. 40 | + See the Effects table for individual descriptions. 41 | 42 | | ix | item | On | Effect | On | Effect | On | Effect | 43 | |---------+------------------------------+-------+------------+-----+------------+-----+------------| 44 | | 1-30 | plate, 10 + floor(ix *.25) | Bx-Bx | Reflect/D | | | | | 45 | | 31-50 | plate, 5 + floor(ix * .5) | Bx | Regen(1d) | | | | | 46 | | 51-70 | plate, -15 + floor(ix * .5) | D | Regen(2d) | Bx | Regen(D) | | | 47 | | 71-80 | plate, -10 + floor(ix * .5) | Even | Regen(2d) | Bx | Reflect/D | | | 48 | | 81-90 | plate, -20 + floor(ix * .5) | D | Regen(3d) | HiD | Regen(D) | Bx | Defect(D) | 49 | | 91-100 | plate, -15 + floor(ix * .5) | Even | Regen(3d) | HiD | Regen(D) | Bx | Reflect(D) | 50 | | 101-120 | plate, -30 + floor(ix * .75) | D | Regen(DoD) | D | Regen(D+7) | HiD | Deflect(D) | 51 | | 121- | plate, -40 + floor(ix * .75) | Even | Regen(D+7) | D+7 | Deflect(D) | D | Reflect(D) | 52 | 53 | ** Shields 54 | 55 | + Same general idea as Armor 56 | 57 | | ix | item | On | Effect | On | Effect | On | Effect | 58 | |----+------+----+--------+----+--------+----+--------| 59 | | | | | | | | | | 60 | 61 | ** Items 62 | 63 | + Players roll 1d down followed by 1d across into the first table. 64 | + Asterisks mark cells which advance the player to the next table, 65 | into which they must roll again in the same manner as before. 66 | + The Item Descriptions table indexes items from all tables. 67 | + TODO: process/legend for 68 | charge/perishable/per-(decent|battle|evening) quantities or just 69 | inline this with each item? 70 | 71 | ** Relic Power 72 | 73 | Relic Power allows priests possessing their holy symbols to, in some 74 | circumstances to wit generally during combat, alter the natural roll 75 | of player or Games Masters dice rolls. Generally rolls related to 76 | treasure are exempt from Relic Power as typically are those of NPCs. 77 | 78 | + TODO: write indexed formula using dungeon level and DM adjusted 79 | index + player 1d (re-rolling 6) 80 | 81 | ** Weapons 82 | 83 | Weapon assignment is similar to armor but also graduates increased 84 | chance of throwable and multi-attack. 85 | 86 | + TODO: write the relic:weapons table 87 | 88 | ** Effects 89 | 90 | This section describes effects applied to armor and shields. These 91 | generally operate after the battle during healing phase. 92 | 93 | | _Legend_ | Activates | Activation Roll | Description | 94 | |---------+-------------------+-----------------+---------------------------------------------------------| 95 | | Regen | After battle | 1d | Regenerate 1 die armor hits after each battle. | 96 | | Regen | After battle | 2d | Regenerate 2 dice armor hits after each battle. | 97 | | Regen | After battle | 3d | Regenerate 3 dice armor hits after each battle. | 98 | | Regen | After battle | DoD | Regenerate die-of-dice armor hits after each battle. | 99 | | Regen | After battle | D | Regenerate armor hits after the battle on doubles. | 100 | | Regen | After battle | D+7 | Regenerate armor hits after the battle on doubles or 7. | 101 | | Deflect | Once/combat round | D | Deflect a magical attack each round on doubles. | 102 | | Reflect | Once/combat round | D | Reflect a magical attack each round on doubles. | 103 | 104 | # LocalWords: throwable NPCs 105 | 106 | * LICENSE 107 | 108 | This program is free software; you can redistribute it and/or modify 109 | it under the terms of the GNU General Public License as published by 110 | the Free Software Foundation, either version 3 of the License, or 111 | (at your option) any later version. 112 | 113 | This program is distributed in the hope that it will be useful, 114 | but WITHOUT ANY WARRANTY; without even the implied warranty of 115 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 116 | GNU General Public License for more details. 117 | 118 | You should have received a copy of the GNU General Public License 119 | along with this program. If not, see . 120 | -------------------------------------------------------------------------------- /Docs/savannah-app.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Application for Savannah 2 | 3 | Savannah is the project hosting solution provided by the Free Software foundation. 4 | 5 | This document represents our (dungeon-mode, the project and product 6 | team) application to host with and authoritatively publish via 7 | Savannah. 8 | 9 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 10 | This softare is released under the GNU Public Licence version three 11 | or, at your disgression, any newer version of the GNU Public 12 | License. For specific terms please see [[LICENSE]] at end-of-file. 13 | 14 | The initial application web-form is on gnu's web-site: 15 | 16 | https://savannah.gnu.org/register/ 17 | 18 | Which provides some additional advice: 19 | 20 | http://savannah.gnu.org/maintenance/HowToGetYourProjectApprovedQuickly/ 21 | 22 | You must have an account to register a project. Accounts expire 23 | quickly (within days) if not used for example to report a bug or 24 | create a project. 25 | 26 | * Document Scope 27 | 28 | The above links as well as the body of this document relate to hosting 29 | 'dungeon-mode' on GNU Savannah. 30 | 31 | This refers to providing a repository for the source code and 32 | deployable artifacts of dungeon-mode "core". Generally this is meant 33 | to include all of the source material for the default game, the elisp 34 | or C sources for the game, and any other sources and configuration 35 | needed for SDLC as well as the source materials for authoritative 36 | documentation of each of these. In this context "game" and "core" 37 | both mean all of the features provided by dungeon-mode, for example 38 | those for content authoring and print publication. 39 | 40 | This is a separate process from (and one not implicitly linked to) 41 | offering our project sources (e.g. transfer of the copyright for the 42 | above same work) to GNU. Source donation has a [[https://www.gnu.org/help/evaluation.html][separate application]]. 43 | 44 | * ~20-lines technical description 45 | ** Detail and Clarification 46 | * What is your project? 47 | (purpose, topic, programming language...) 48 | * What is special about it? 49 | ** Notes 50 | ** Response 51 | 52 | Create free (as in freedom) RPGs with GNU Emacs. And then play them. 53 | 54 | We want to: 55 | 1. Create, publish and play RPGs without any costs now or ever. 56 | 2. Own all our data and understand our rights when we use other 57 | people's content and when we share content, especially online. 58 | 3. Learn from self-documenting software and heuristic features that 59 | maximize universal design opportunities improve RPG accessibility. 60 | 4. Evangelize Free Software and GNU and drive adaptation by gamers 61 | by providing a single free platform e.g., whether for 62 | interactively joining a shared world across a network connection 63 | or at a table or while preparing a commercial work for binding. 64 | 5. Play and create with the fewest possible assumptions, for example 65 | the presence of a window manager, access to a network, or use of 66 | a restricted or proprietary operating system or application. 67 | 6. Maintain and distribute a "core" (meaning minimum original) set 68 | of technical components to support interactive play and authoring 69 | and provide a basis for creating original game experiences. 70 | 7. Enable and support peer-to-peer and distributed content sharing 71 | free from any implicit oversight. If approved, the dungeon-mode 72 | repository will include neither user supplied content nor game 73 | sources except for the "Default Dungeon" which source materials 74 | share the copyright and licensing terms of the of the project. 75 | 8. If otherwise successful, enhance the GNU tool-chain of Free Software 76 | with additional audio and video conferencing capabilities 77 | especially for gaming and empower users to manage such streams 78 | from GNU Emacs and, e.g. while playing. While these would likely 79 | culminate in new projects initial research may occur at this one. 80 | 9. If otherwise successful, fork GNU Emacs and other GNU projects to 81 | create a mobile first information centric heuristic operating 82 | system focused on user freedom and privacy, e.g. to dungeon with. 83 | 84 | * Other license, details 85 | ** Detail and Clarification 86 | ** Notes 87 | ** Response 88 | 89 | In discussion and with support from FSF directory community/proponents 90 | we have recently updated from GLPv3 to GPLv3+ in order to provide 91 | users and others the ability, at their option, to select newer terms 92 | which may address circumstance not anticipated by GLPv3. 93 | 94 | * Checkboxes 95 | Checklist - see [[http://savannah.gnu.org/maintenance/HowToGetYourProjectApprovedQuickly/][How To Get Your Project Approved Quickly]] 96 | 97 | * [X] My project runs primarily on a completely free OS 98 | * [X] My license is compatible with the GNU GPL or GFDL 99 | * [X] My dependencies are compatible with my project license 100 | * [X] All my files include valid copyright notices 101 | * [X] All my files include a license header [1] [2] 102 | * [ ] Origin and license of media files is specified 103 | * [ ] My tarball includes a copy of the license 104 | * [ ] I read carefully and don't check this one 105 | * [ ] I agree with the hosting requirements 106 | 107 | ** Detail and Clarification 108 | ** Notes 109 | ** Response 110 | 111 | * Dependencies 112 | ** Detail and Clarification 113 | 114 | name + license + website for each dependency 115 | 116 | ** Notes 117 | ** Response 118 | 119 | * Other Comments 120 | ** Detail and Clarification 121 | ** Notes 122 | ** Response 123 | 124 | * LICENSE 125 | 126 | This program is free software; you can redistribute it and/or modify 127 | it under the terms of the GNU General Public License as published by 128 | the Free Software Foundation, either version 3 of the License, or 129 | (at your option) any later version. 130 | 131 | This program is distributed in the hope that it will be useful, 132 | but WITHOUT ANY WARRANTY; without even the implied warranty of 133 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 134 | GNU General Public License for more details. 135 | 136 | You should have received a copy of the GNU General Public License 137 | along with this program. If not, see . 138 | -------------------------------------------------------------------------------- /src/dm-svg.el: -------------------------------------------------------------------------------- 1 | ;;; dm-svg.el --- render dungeon-mode map as SVG -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; * Implementation 23 | 24 | ;; This file implements SVG rendering of maps for, e.g. 25 | ;; [[https://github.com/mplsCorwin/dungeon-mode][dungeon-mode]] 26 | ;; a multi-player dungeon-crawl style RPG for 27 | ;; [[https://www.fsf.org/software/emacs][GNU Emacs]] 28 | ;; See [[Docs/Maps][Docs/Maps]] for example map definations from the 29 | ;; sample dungeon. 30 | ;; ** Overview 31 | 32 | ;; * Implement ~dm-svg~ as an EIEIO class having two slots: 33 | ;; * an [[https://www.gnu.org/software/emacs/manual/html_node/elisp/SVG-Images.html][~svg~]] object containing all graphic elements except the 34 | ;; main path element 35 | ;; * path-data for the main path element as a list of strings 36 | ;; ** Cursor Drawing using the [[https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths][SVG path element]] 37 | 38 | ;; Dungeon uses Scalable Vector Graphic (SVG) 39 | ;; [[https://www.w3.org/TR/SVG/paths.html][path element]] to show maps 40 | ;; within Emacs using a simple cursor based drawing approach similar 41 | ;; to 42 | ;; [[https://en.wikipedia.org/wiki/Logo_(programming_language)][Logo]] 43 | ;; (e.g. [[https://github.com/hahahahaman/turtle-geometry][turtle 44 | ;; graphics]]). By concatenating all of the required draw 45 | ;; instructions for the visible features of the map (along with 46 | ;; suitable fixed-address based movement instructions between) we can 47 | ;; add most non-text elements within a single path. 48 | 49 | ;; This imposes limitations in terms, for example, of individually 50 | ;; styling elements such as secret doors (drawn in-line, currently) but 51 | ;; seems a good starting point in terms of establishing a baseline for 52 | ;; the performance rendering SVG maps on-demand within Emacs. 53 | 54 | ;;; Requirements: 55 | 56 | (eval-when-compile 'cl-generic) 57 | 58 | (require 'eieio) 59 | (require 'svg) 60 | 61 | ;;; Code: 62 | 63 | (defun dm-svg-dom-node-p (object &optional tag) 64 | "Return t when OBJECT is a dom-node. 65 | 66 | When TAG is non-nill (car OBJECT) must also `equal' TAG." 67 | ;;; (message "dm-svg-dom-node-p:car:%s=>%s" (type-of (car object)) (car object)) 68 | (and (listp object) 69 | (symbolp (car object)) 70 | (not (null (car object))) 71 | (or (null tag) 72 | (equal tag (car object))))) 73 | 74 | (defun dm-svg-or-nil-p (obj) 75 | "True if OBJ is nil or an SVG `dom'." 76 | (or (null obj) 77 | (dm-svg-dom-node-p obj 'svg))) 78 | 79 | (defun dm-svg-path-or-path-data-p (obj) 80 | "True when OBJ is nil, a string, or a \"path\" `dom-node'." 81 | (or (null obj) 82 | (stringp obj) 83 | (dm-svg-dom-node-p obj 'path))) 84 | 85 | (defun dm-svg-create-path (&optional path-data properties children) 86 | "Create a 'path `dom-node'. 87 | 88 | PATH-DATA is an optional string controling the \"d\" attribute. 89 | PROPERTIES and CHILDREN map to corrisponding inputs accepted 90 | by, e.g. `dom-node' which see." 91 | (if children 92 | (dom-node 'path `((d . ,path-data) ,@properties) children) 93 | (dom-node 'path `((d . ,path-data) ,@properties)))) 94 | 95 | (defclass dm-svg () 96 | ((svg :type dm-svg-or-nil :initarg :svg :initform nil) 97 | (path-data :type dm-svg-path-or-path-data 98 | :initarg :path-data 99 | :initform nil)) 100 | :documentation 101 | "Wrap `svg' as an 'eieio' object. 102 | 103 | This allows us to built up data for a \"main\" SVG element in 104 | parallel to adding elements to the SVG in slot 1 in the usual 105 | way. PATH-DATA may be a string or a `dom-node' containing a 106 | 'path element, or nil. PATH-DATA is internally represented as a 107 | 'dom-node', created when a string is provided by wrapping the 108 | initarg value as a new 'path and using the string as the value of 109 | the \"d\" attribute.") 110 | 111 | (cl-defmethod initialize-instance :after ((object dm-svg) &rest _) 112 | "Docstring using MYOBJECT." 113 | (with-slots (svg path-data) object 114 | (unless (dm-svg-dom-node-p svg 'svg) 115 | (setq svg (dom-node 'svg))) 116 | (unless (dm-svg-dom-node-p path-data 'path) 117 | (setq path-data (dm-svg-create-path (and (stringp path-data) 118 | path-data)))) 119 | )) 120 | 121 | (cl-defmethod add-path-data ((object dm-svg) &rest strings) 122 | "Add STRINGS to `dm-svg' OBJECT's path-data." 123 | (with-slots (path-data) object 124 | (dom-set-attribute path-data 'd 125 | (concat (cdr (assoc 'd (dom-attributes path-data))) 126 | (mapconcat 'concat strings ""))))) 127 | 128 | (cl-defmethod add-svg-element ((object dm-svg) &rest elements) 129 | "Add ELEMENTS to `dm-svg' OBJECT's path-data." 130 | (with-slots (svg) object 131 | (dolist (element elements) 132 | (setq svg (dom-append-child svg element))) 133 | svg)) 134 | 135 | (cl-defmethod render-and-insert ((object dm-svg)) 136 | "Render and insert `svg' from a DM-SVG. 137 | 138 | Image is inserted to `current-buffer' at `point' after appending 139 | a path element using path-data of DM-SVG. See `add-path-data'." 140 | (with-slots (svg path-data) object 141 | (dom-append-child svg path-data) 142 | ;;(with-temp-file "out.svg" (set-buffer-multibyte nil) (svg-print svg)) 143 | (svg-insert-image svg))) 144 | 145 | (cl-defmethod render-and-insert-string ((object dm-svg)) 146 | "Render and insert `svg' from a DM-SVG. 147 | 148 | Image is inserted to `current-buffer' at `point' after appending 149 | a path element using path-data of DM-SVG. See `add-path-data'." 150 | (with-slots (svg path-data) object 151 | (dom-append-child svg path-data) 152 | ;;(with-temp-file "out.svg" (set-buffer-multibyte nil) (svg-print svg)) 153 | ;;(svg-insert-image svg) 154 | (svg-print svg))) 155 | 156 | (provide 'dm-svg) 157 | ;;; dm-svg.el ends here 158 | -------------------------------------------------------------------------------- /Docs/Misc/index.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Index 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik C Elmshauser 5 | :Created: 2020/01/11 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | * Index 14 | 15 | + Index is a quantity lookup table 16 | 17 | | Index | Quantity | 18 | |-------+----------| 19 | | < | > | 20 | | 1 | 1 | 21 | | 2 | 1 | 22 | | 3 | 1 | 23 | | 4 | 1 | 24 | | 5 | 1 | 25 | | 6 | 1 | 26 | | 7 | 1 | 27 | | 8 | 1 | 28 | | 9 | 1 | 29 | | 10 | 1 | 30 | | 11 | 1 | 31 | | 12 | 1 | 32 | | 13 | 1 | 33 | | 14 | 1 | 34 | | 15 | 1 | 35 | | 16 | 1 | 36 | | 17 | 1 | 37 | | 18 | 2 | 38 | | 19 | 2 | 39 | | 20 | 2 | 40 | | 21 | 2 | 41 | | 22 | 2 | 42 | | 23 | 2 | 43 | | 24 | 2 | 44 | | 25 | 2 | 45 | | 26 | 2 | 46 | | 27 | 2 | 47 | | 28 | 3 | 48 | | 29 | 3 | 49 | | 30 | 3 | 50 | | 31 | 3 | 51 | | 32 | 3 | 52 | | 33 | 3 | 53 | | 34 | 3 | 54 | | 35 | 3 | 55 | | 36 | 4 | 56 | | 37 | 4 | 57 | | 38 | 4 | 58 | | 39 | 4 | 59 | | 40 | 4 | 60 | | 41 | 4 | 61 | | 42 | 5 | 62 | | 43 | 5 | 63 | | 44 | 5 | 64 | | 45 | 5 | 65 | | 46 | 5 | 66 | | 47 | 6 | 67 | | 48 | 6 | 68 | | 49 | 6 | 69 | | 50 | 6 | 70 | | 51 | 6 | 71 | | 52 | 7 | 72 | | 53 | 7 | 73 | | 54 | 7 | 74 | | 55 | 7 | 75 | | 56 | 7 | 76 | | 57 | 8 | 77 | | 58 | 8 | 78 | | 59 | 8 | 79 | | 60 | 8 | 80 | | 61 | 8 | 81 | | 62 | 9 | 82 | | 63 | 9 | 83 | | 64 | 9 | 84 | | 65 | 9 | 85 | | 66 | 9 | 86 | | 67 | 10 | 87 | | 68 | 10 | 88 | | 69 | 11 | 89 | | 70 | 11 | 90 | | 71 | 12 | 91 | | 72 | 12 | 92 | | 73 | 13 | 93 | | 74 | 13 | 94 | | 75 | 14 | 95 | | 76 | 14 | 96 | | 77 | 15 | 97 | | 78 | 15 | 98 | | 79 | 16 | 99 | | 80 | 16 | 100 | | 81 | 17 | 101 | | 82 | 17 | 102 | | 83 | 18 | 103 | | 84 | 18 | 104 | | 85 | 19 | 105 | | 86 | 19 | 106 | | 87 | 20 | 107 | | 88 | 21 | 108 | | 89 | 22 | 109 | | 90 | 23 | 110 | | 91 | 24 | 111 | | 92 | 25 | 112 | | 93 | 26 | 113 | | 94 | 27 | 114 | | 95 | 28 | 115 | | 96 | 29 | 116 | | 97 | 30 | 117 | | 98 | 31 | 118 | | 99 | 32 | 119 | | 100 | 33 | 120 | | 101 | 34 | 121 | | 102 | 35 | 122 | | 103 | 36 | 123 | | 104 | 37 | 124 | | 105 | 38 | 125 | | 106 | 39 | 126 | | 107 | 40 | 127 | | 108 | 41 | 128 | | 109 | 42 | 129 | | 110 | 43 | 130 | | 111 | 44 | 131 | | 112 | 45 | 132 | | 113 | 46 | 133 | | 114 | 47 | 134 | | 115 | 48 | 135 | | 116 | 49 | 136 | | 117 | 50 | 137 | | 118 | 55 | 138 | | 119 | 60 | 139 | | 120 | 65 | 140 | | 121 | 70 | 141 | | 122 | 75 | 142 | | 123 | 80 | 143 | | 124 | 85 | 144 | | 125 | 90 | 145 | | 126 | 95 | 146 | | 127 | 100 | 147 | | 128 | 110 | 148 | | 129 | 120 | 149 | | 130 | 130 | 150 | | 131 | 140 | 151 | | 132 | 150 | 152 | | 133 | 160 | 153 | | 134 | 170 | 154 | | 135 | 180 | 155 | | 136 | 190 | 156 | | 137 | 200 | 157 | | 138 | 210 | 158 | | 139 | 220 | 159 | | 140 | 230 | 160 | | 141 | 240 | 161 | | 142 | 250 | 162 | | 143 | 275 | 163 | | 144 | 300 | 164 | | 145 | 325 | 165 | | 146 | 350 | 166 | | 147 | 375 | 167 | | 148 | 400 | 168 | | 149 | 425 | 169 | | 150 | 450 | 170 | | 151 | 475 | 171 | | 152 | 500 | 172 | | 153 | 550 | 173 | | 154 | 600 | 174 | | 155 | 650 | 175 | | 156 | 700 | 176 | | 157 | 750 | 177 | | 158 | 800 | 178 | | 159 | 850 | 179 | | 160 | 900 | 180 | | 161 | 950 | 181 | | 162 | 1000 | 182 | | 163 | 1100 | 183 | | 164 | 1200 | 184 | | 165 | 1300 | 185 | | 166 | 1400 | 186 | | 167 | 1500 | 187 | | 168 | 1600 | 188 | | 169 | 1700 | 189 | | 170 | 1800 | 190 | | 171 | 1900 | 191 | | 172 | 2000 | 192 | | 173 | 2100 | 193 | | 174 | 2200 | 194 | | 175 | 2300 | 195 | | 176 | 2400 | 196 | | 177 | 2500 | 197 | | 178 | 2600 | 198 | | 179 | 2700 | 199 | | 180 | 2800 | 200 | | 181 | 2900 | 201 | | 182 | 3000 | 202 | | 183 | 3250 | 203 | | 184 | 3500 | 204 | | 185 | 3750 | 205 | | 186 | 4000 | 206 | | 187 | 4250 | 207 | | 188 | 4500 | 208 | | 189 | 4750 | 209 | | 190 | 5000 | 210 | | 191 | 5500 | 211 | | 192 | 6000 | 212 | | 193 | 6500 | 213 | | 194 | 7000 | 214 | | 195 | 7500 | 215 | | 196 | 8000 | 216 | | 197 | 8500 | 217 | | 198 | 9000 | 218 | | 199 | 9500 | 219 | | 200 | 10000 | 220 | 221 | * LICENSE 222 | 223 | This program is free software; you can redistribute it and/or modify 224 | it under the terms of the GNU General Public License as published by 225 | the Free Software Foundation, either version 3 of the License, or 226 | (at your option) any later version. 227 | 228 | This program is distributed in the hope that it will be useful, 229 | but WITHOUT ANY WARRANTY; without even the implied warranty of 230 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 231 | GNU General Public License for more details. 232 | 233 | You should have received a copy of the GNU General Public License 234 | along with this program. If not, see . 235 | -------------------------------------------------------------------------------- /src/dm-util.el: -------------------------------------------------------------------------------- 1 | ;;; dm-util.el --- dungeon-mode table binding internals -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; TODO dm-util:1 refactor to use `cl-destructuring-bind' then factor 24 | ;; out most or all of the keyword implementations compisitonally. 25 | 26 | ;; TODO dm-util:2 binds should be the first arg and strings the second 27 | ;; this can be done irrespective of when we take on the dm-util:1. 28 | 29 | ;;; Code: 30 | 31 | (defgroup dm-util nil "Localizable internals. 32 | 33 | These settings are generally intended to be changed lexically 34 | from elisp-code; however, for game development it may be 35 | convenient to customize some of defaults." :group 'dungeon-mode) 36 | 37 | (eval-when-compile (require 'cl-macs)) 38 | 39 | (defcustom dm-util-default-coalesce-key '(id) 40 | "Default key when coalescing strings to hashes. 41 | 42 | See `dm-coalesce-hash." 43 | :group 'dm-util 44 | :type '(sequence symbol)) 45 | ;;(setq dm-util-default-coalesce-key '(id)) 46 | 47 | (defsubst dm-make-hashtable (&rest args) 48 | "Create an empty hash table using ARGS, if any." 49 | (apply 'make-hash-table (append (list :test 'equal) args))) 50 | 51 | (defun dm--remove-keywords (form) 52 | "Return FORM with any :keyword and following args removed." 53 | (if (and (car-safe form) 54 | (cdr-safe form) 55 | (car-safe (cdr form)) 56 | (keywordp (car form))) 57 | (dm--remove-keywords (cdr-safe (cdr form))) 58 | (if (cdr-safe form) 59 | (cons (car-safe form) (dm--remove-keywords (cdr form))) 60 | (unless (and (car-safe form) (keywordp (car form))) 61 | form)))) 62 | ;;(equal (dm--remove-keywords '(foo :bar baz qwz)) '(foo qwz)) 63 | ;;(equal (dm--remove-keywords '(:foo 1 baz qwz)) '(baz qwz)) 64 | 65 | (cl-defmacro dm-coalesce-hash (strings 66 | &optional 67 | (bindings dm-util-default-coalesce-key) 68 | &body body 69 | &key (hash-symbol 'hash) 70 | (hash-table '(dm-make-hashtable) hash-p) 71 | (row-symbol 'row) 72 | (key-symbol (car (delq '_ (delq nil bindings)))) 73 | (start-column 0) 74 | (result-symbol 'result) 75 | enable-after-nil 76 | enable-blank-rows 77 | (after `(progn 78 | ;; (message "[hash:after] k:%s r:%s" 79 | ;; ,key-symbol ,result-symbol) 80 | (when (and ,key-symbol 81 | ,hash-symbol 82 | (or ,enable-after-nil 83 | ,result-symbol) 84 | (hash-table-p ,hash-symbol)) 85 | (prog1 (puthash (if (stringp ,key-symbol) 86 | (intern ,key-symbol) 87 | ,key-symbol) 88 | ,result-symbol 89 | ,hash-symbol) 90 | ;; (message "[hash:after] k:%s r:%s" ,key-symbol 91 | ;; (gethash ,key-symbol ,hash-symbol)) 92 | )))) 93 | &allow-other-keys) 94 | "Build HASH by repeatedly applying BINDINGS to STRINGS for BODY. 95 | 96 | STRINGS is list of string lists, ((\"aa\" \"ab\") (\"ba\" \"bb\")). 97 | 98 | BINDINGS are symbols, each bound from STRINGS at the corrisonding 99 | index. Use \"_\" to ignore given positions. BODY is evaluated 100 | once per outer STRING list item after BINDINGS. BINDINGS are 101 | taken from `dm-util-default-coalesce-key' when nil or omitted. 102 | 103 | HASH-TABLE allows hash-table reuse. HASH-SYMBOL (default: 104 | \"hash\") exposes HASH-TABLE to BODY. ROW-SYMBOL (default: 105 | \"row\") is bound full list taken from STRINGS for a given 106 | evaluation of BODY. KEY-SYMBOL provides the value for the key 107 | written in HASH by the default AFTER implementation; it defaults 108 | to to the first of BINDINGS. START-COLUMN (default: 0) allows 109 | specifying the first column index for BINDINGS. 110 | RESULT-SYMBOL (default: \"result\") exposes the result of BODY 111 | after each evaluation. When ENABLE-BLANK-ROWS do not skip 112 | STRINGS when inner list contains no non-empty values. When 113 | ENABLE-AFTER-NIL is nil (the default) AFTER is not executed 114 | unless FORMS returns a nil value. When AFTER expression is 115 | non-nill it is evaluated after BODY in the same context given 116 | either BODY result or ENABLE-AFTER-NILL is not nil. The default 117 | AFTER implementation inserts the value of RESULT-SYMBOL into the 118 | hash identified by HASH-SYMBOL creating a key by interning the 119 | value of KEY-SYMBOL." 120 | (declare (indent 2)) 121 | (let* ((column-count start-column) 122 | (body-form (or (dm--remove-keywords body) 123 | `((list ,@(mapcan 124 | (lambda (var) `(',var ,var)) 125 | (delq '_ (delq nil bindings))))))) 126 | (symbol-bindings 127 | (delete nil (mapcar 128 | (lambda (var) 129 | (prog1 (if (and var 130 | (not (equal '_ var)) 131 | (>= column-count start-column)) 132 | (list var `(nth ,column-count ,row-symbol)) 133 | nil) 134 | (setq column-count (1+ column-count)))) 135 | bindings))) 136 | (row-form `(lambda (,row-symbol) 137 | (when (or ,enable-blank-rows (seq-filter 'org-string-nw-p 138 | ,row-symbol)) 139 | ,(if (and symbol-bindings (length symbol-bindings)) 140 | `(let (,@symbol-bindings) 141 | (prog1 ,(if result-symbol 142 | `(setq ,result-symbol 143 | (progn ,@body-form)) 144 | `(progn ,@body-form)) 145 | ,(when after after))) 146 | `(if ,after 147 | (prog1 ,(if result-symbol 148 | `(setq ,result-symbol 149 | (progn ,@body-form)) 150 | `(progn ,@body-form)) 151 | ,after) 152 | (progn ,@body-form))))))) 153 | ;;(prin1 symbol-bindings) ;;(prin1 '(hash hash-table)) 154 | `(let* ((,hash-symbol ,hash-table) ,row-symbol ,result-symbol) 155 | (mapcar ,row-form (quote ,strings)) 156 | ,hash-symbol))) 157 | 158 | 159 | ;; (let ((h (dm-coalesce-hash (("h1" "H2" "H3") 160 | ;; ("r1" "V12" "V13") 161 | ;; ("r2" "V22" "V23") 162 | ;; ("r3" "V32" "V33")) 163 | ;; (id h2) 164 | ;; :hash-table #s(hash-table size 30 test equal) 165 | ;; :start-column 1 166 | ;; (list 'id id 'h2 h2)))) 167 | ;; (print h) 168 | ;; h) 169 | ;; (dm-coalesce-hash((1 "a")(2 "b"))(_) :after(puthash(nth 0 row)(cdr row)hash)) 170 | 171 | 172 | (provide 'dm-util) 173 | ;;; dm-util.el ends here 174 | -------------------------------------------------------------------------------- /src/ox-ox-test.el: -------------------------------------------------------------------------------- 1 | ;;; ox-ox-test.el --- tests for ox-ox -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; tests, mostly of rx stuff 24 | 25 | ;; this initial version proves out some regexes used to support TBLFM 26 | ;; like interpolation syntax for @n$x, $# 27 | 28 | ;;; Code: 29 | 30 | (require 'rx) 31 | 32 | ;; Mostly taken from `org-table' then converted for `rx' 33 | (defvar my:rx) 34 | (setq my:rx 35 | '((var-sigel ?$) 36 | (col-sigel ?$) 37 | (row-sigel ?@) 38 | (key-sigel ?:) 39 | (comma (and (0+ blank) ?, (0+ blank))) 40 | (sign (group (any ?+ ?-))) 41 | (boundry (group (1+ (or ?< ?>)))) 42 | (numbered (group (1+ digit))) 43 | (named (group (and (any "a-z" "A-Z" "_") 44 | (0+ (any alnum ?_))))) 45 | (key (and key-sigel named)) 46 | (special (or (and var-sigel (group (any ?* ?_ ?: ?#)) (opt key)) 47 | (and ?@ (group ?#)))) 48 | (remote (item) (and "remote(" (0+ blank) (group (1+ (not ?,))) 49 | comma item ")")) 50 | (col (or named boundry (and (opt sign) numbered))) 51 | (row (or boundry 52 | (and (opt sign) (group (1+ ?I)) 53 | (opt (and sign numbered))) 54 | (and (opt sign) numbered))) 55 | (cell (or (and row-sigel row (opt (and col-sigel col))) 56 | (and col-sigel col))) 57 | (range (and cell ".." (or cell row))) 58 | (range? (and cell (opt (and ".." (or cell row))))) 59 | (var (or special range? (remote range))))) 60 | ;; (eval (macroexpand `(rx-let ,my-rx (string-match-p (rx var) "$foo")))) 61 | 62 | (defvar my:rx-labels nil "Labels for the groups of var in `my:rx'.") 63 | (setq my:rx-labels 64 | '(full-match ; 0 65 | special-name ; 1 66 | special-keyword ; 2 67 | row-count ; 3 68 | row-boundry ; 4 69 | row-hline-sign ; 5 70 | row-hline ; 6 71 | row-hline-adj-sign ; 7 72 | row-hline-adj ; 8 73 | row-sign ; 9 74 | row-number ; 10 75 | field-name ; 11 76 | field-boundry ; 12 77 | field-sign ; 13 78 | field-number ; 14 79 | col-name ; 15 80 | col-boundry ; 16 81 | col-sign ; 17 82 | col-number ; 18 83 | right-row-boundry ; 19 84 | right-row-hline-sign ; 20 85 | right-row-hline ; 21 86 | right-row-hline-adj-sign ; 22 87 | right-row-hline-adj ; 23 88 | right-row-sign ; 24 89 | right-row-number ; 25 90 | right-field-name ; 26 91 | right-field-boundry ; 27 92 | right-field-sign ; 28 93 | right-field-number ; 29 94 | right-col-name ; 30 95 | right-col-boundry ; 31 96 | right-col-sign ; 32 97 | right-col-number ; 33 98 | ;; 34-40 never fill because remote doesn't handle: 99 | ;; | @#, 1 grp | special, 2 grp | col-*, 4 grp | = 6 | 100 | nil nil nil nil nil nil nil 101 | remote-name ; 41 102 | remote-row-boundry ; 42 103 | remote-row-hline-sign ; 43 104 | remote-row-hline ; 44 105 | remote-row-hline-adj-sign ; 45 106 | remote-row-hline-adj ; 46 107 | remote-row-sign ; 47 108 | remote-row-number ; 48 109 | remote-field-name ; 49 110 | remote-field-boundry ; 50 111 | remote-field-sign ; 51 112 | remote-field-number ; 52 113 | remote-col-name ; 53 114 | remote-col-boundry ; 54 115 | remote-col-sign ; 55 116 | remote-col-number ; 56 117 | remote-right-row-boundry ; 57 118 | remote-right-row-hline-sign ; 58 119 | remote-right-row-hline ; 59 120 | remote-right-row-hline-adj-sign ; 60 121 | remote-right-row-hline-adj ; 61 122 | remote-right-row-sign ; 62 123 | remote-right-row-number ; 63 124 | remote-right-field-name ; 64 125 | remote-right-field-boundry ; 65 126 | remote-right-field-sign ; 66 127 | remote-right-field-number ; 67 128 | remote-right-col-name ; 68 129 | remote-right-col-boundry ; 69 130 | remote-right-col-sign ; 70 131 | remote-right-col-number ; 71 132 | )) 133 | 134 | (defvar my:rx-test-strings nil "These are test strings that should all match.") 135 | (setq my:rx-test-strings 136 | '("$foo" ;; "remote(Bar,$foo)" "$foo:kw" ;;ZZZ: ? 137 | "$_" "$_:kw" "$*" "$*:kw" "$:" "$::kw" 138 | "@#" "$#" "$1" "$+2" "$>>>" 139 | "@1$1" "@1$1..@-2$+1" "remote(Bar,@1$1..@-2$+1)" 140 | "@-2$+1" "@-2$+1..@3$>>>" "remote(Bar,@-2$+1..@3$>>>)" 141 | "@3$>>>" "@3$>>>..@+4$foo" "remote(Bar,@3$>>>..@+4$foo)" 142 | "@+4$foo" 143 | "@+4$foo..@<$1" "remote(Bar,@+4$foo..@<$1)" 144 | "@<$1" "@<$1..@<<$-2" "remote(Bar,@<$1..@<<$-2)" 145 | "@<<$-2" "@<<$-2..@>>>$<<<" "remote(Bar,@<<$-2..@>>>$<<<)" 146 | "@>>>$<<<" "@>>>$<<<..@>>>>$foo" "remote(Bar,@>>>$<<<..@>>>>$foo)" 147 | "@>>>>$foo" 148 | "@>>>>$foo..@I$1" "remote(Bar,@>>>>$foo..@I$1)" 149 | "@I$1" "@I$1..@I+2$>>" "remote(Bar,@I$1..@I+2$>>)" 150 | "@I+2$>>" "@I+2$>>..@III$foo" "remote(Bar,@I+2$>>..@III$foo)" 151 | "@III$foo" "@III$foo..@+IIII-44$+4" "remote(Bar,@III$foo..@+IIII-44$+4)" 152 | "@+IIII-44$+4" 153 | "@+IIII-44$+4..@III-3$11" "remote(Bar,@+IIII-44$+4..@III-3$11)" 154 | "@III-3$11" "@III-3$11..@+I$12" "remote(Bar,@III-3$11..@+I$12)" 155 | "@+I$12" "@+I$12..@-II$13" "remote(Bar,@+I$12..@-II$13)" 156 | "@-II$13" "@-II$13..@+III-17$14" "remote(Bar,@-II$13..@+III-17$14)" 157 | "@>$<..@+III-17$foo" "remote(Bar,@>$<..@+III-17$foo)" 158 | "@+III-17$foo..$<" "remote(Bar,@+III-17$foo..$<)" 159 | "@+2$foo..@<<<$+14" "remote(Bar,@+2$foo..@<<<$+14)" 160 | "@>>$foo..$+42" "remote(Bar,@>>$foo..$+42)")) 161 | 162 | (defmacro my:rx-test (str &optional result) 163 | "Create an `ert' function testing STR expecting RESULT." 164 | (declare (indent 2)) 165 | (ignore result) 166 | `(rx-let ,my:rx 167 | (when (string-match (rx var) ,str) 168 | (mapconcat 169 | 'identity 170 | (delq nil (seq-map-indexed 171 | (lambda (_ n) 172 | (when-let ((m (match-string n ,str)) 173 | (g (nth-value n my:rx-labels))) 174 | (format "| %s | %s | %s |" n m g))) 175 | (make-list 72 nil))) 176 | "\n") 177 | ))) 178 | 179 | (defun my:do-rx-test () 180 | "Run `my:test-strings' against `my:rx'." 181 | (interactive) 182 | (let ((re-string ))) 183 | (with-current-buffer (get-buffer-create "**ox re test result") 184 | (erase-buffer) 185 | (goto-char (point-min)) 186 | (insert "#+title: Test Results: ~ox-ox rx~\n 187 | Try ~occur~ where ~n~ is a group number in: 188 | #+begin_example 189 | | n | [^ ] 190 | #+end_example\n 191 | * Regular Expression\n 192 | #+name: regex 193 | #+begin_src emacs-lisp") 194 | (print (eval `(macroexpand (rx-let ,my:rx (rx var)))) 195 | (current-buffer)) 196 | (insert "#+end_src\n\n* Test Strings") 197 | (dolist (test-form my:rx-test-strings) 198 | (insert (format "\n\n** %s\n\n| n | match | group |\n" test-form)) 199 | (insert (my:rx-test test-form))) 200 | (pop-to-buffer (current-buffer)) 201 | (org-mode))) 202 | 203 | (provide 'ox-ox-test) 204 | ;;; ox-ox-test.el ends here 205 | -------------------------------------------------------------------------------- /test.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | General Store 133 | 134 | 135 | 136 | F 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/dm-table.el: -------------------------------------------------------------------------------- 1 | ;;; dm-table.el --- define and access dungeon-mode tables -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; A very simple ETL tool for org. 24 | 25 | ;; We define a batch process in terms of a number of steps each 26 | ;; represented by a function returning the next step, if any. 27 | 28 | ;; Support "tables" (or maybe another org elemnt type bound to 29 | ;; dm-table-element) in terms of a set functions to: 30 | ;; - Extract e.g. read from the source document 31 | ;; - Transform, e.g. create a result or side effect from source 32 | ;; - Load e.g. write the sorce, back to the document or elsewhere 33 | 34 | ;; As any implicit cooperation amung these methods is left to their 35 | ;; implemention, this module simple provides an API for driving the 36 | ;; implicit state machine via interactive commands, functions, and 37 | ;; hooks. Each game intrinsic implements this API to allow 38 | ;; intersection amung game sources as we work with with them. 39 | 40 | ;;; Code: 41 | 42 | (require 'org-table) 43 | (eval-when-compile (require 'cl-lib) 44 | (require 'subr-x)) 45 | 46 | ;; DEVEL hack: prefer version from CWD, if any 47 | (let ((load-path (append (list ".") load-path))) 48 | (require 'dungeon-mode)) 49 | 50 | (defvar dm-table-alist nil 51 | "While editing or playing, an alist of source scope and state.") 52 | 53 | (defvar dm-table-load-table-var 'dm-table-alist 54 | "Variable updated by the default load function `dm-table-load-table'.") 55 | 56 | (defvar dm-table-load-table-fun (lambda (item list) (push item list)) 57 | "Function to update `dm-table-load-table-var'.") 58 | 59 | (defvar dm-table-states 60 | '((ledger :extract #'dm-table-extract-function 61 | :transform #'dm-table-transform-function 62 | :load #'dm-table-load-function)) 63 | "While editing or playing, available source state transitions. 64 | 65 | This is an irregular alist with items taking the form: 66 | 67 | (SCOPE :STATE1 FUN1 ...) 68 | 69 | Where SCOPE is a symbol representing the intrinsic (e.g. source 70 | category, or frame of reference), and each :STATE FUN pair 71 | represent a supported set pairing one of :extract :transform or 72 | :load with a function, called with the parsed element (or with 73 | point at the start of the unparsed element, in the case of 74 | :extract with no prior state) followed by any prior state 75 | information for the current workflow. FUN may return NEW-STATE 76 | to continue the workflow or nil to terminate it. 77 | 78 | Prior state as well as NEW-STATE may either be a keyword symbol 79 | or a con cell in the form: 80 | (SCOPE . STATE)") 81 | 82 | (defvar dm-table-extract-function #'dm-table-extract-table 83 | "Function used to read from org into to memory. 84 | 85 | The default implemention deligates to `org-table-to-lisp'.") 86 | 87 | (defvar dm-table-transform-function #'dm-table-tranform-table 88 | "Function used to lexically transform org sources. 89 | 90 | The default implemention relies on `dm-coalesce-hash'.") 91 | 92 | (defvar dm-table-load-function #'dm-table-load-table 93 | "Function used to store a table, e.g. in a var..") 94 | 95 | (defvar dm-table-step-function #'dm-table-step 96 | "Function to deduce the (next) step for `dm-table-batch'.") 97 | 98 | (defvar dm-table-coalesce-args nil "Options for dm-coalesce-hash.") 99 | 100 | (defun dm-table-extract-table 101 | (&rest _args) 102 | "Return :transform form passing table at point as elisp. 103 | 104 | Parsing and converison via `org-table-to-lisp', which see." 105 | ;; (when-let ((coalesce-prop (org-entry-get (point) "coalesce" t))) 106 | ;; (setq dm-table-coalesce-args (read coalesce-prop))) 107 | (dm-msg :fmt "[dm-table-extract-table] $args around..\n$context" 108 | :args (list :file (buffer-file-name) 109 | :buffer (buffer-name) 110 | :line (line-number-at-pos) 111 | :pos (point)) 112 | :context (concat (buffer-substring (if (< 150 (point)) (- (point) 150) 113 | (point-min)) (point)) 114 | "⧆" 115 | (buffer-substring (point) (+ (point) 10)))) 116 | (list :transform (delq 'hline (org-table-to-lisp)))) 117 | 118 | (defun dm-table-tranform-table (table) 119 | "Return :load form with TABLE as an hash-table. 120 | 121 | This version creates an hashmap of properties from each row from 122 | header labels in the first table row, take the first column as key." 123 | (eval `(list :load (dm-coalesce-hash ,(cdr table) 124 | ,@(or dm-table-coalesce-args 125 | (seq-map (lambda (label) (intern (downcase label))) 126 | (car table))) 127 | )))) 128 | 129 | ;; (defun dm-table-tranform-table-before-props (table) 130 | ;; "Return :load form with TABLE as an hash-table. 131 | ;; This version creates an hashmap of properties from each row from 132 | ;; header labels in the first table row, take the first column as key." 133 | ;; (let ((cols (or dm-table-slots 134 | ;; (seq-map (lambda (label) (intern (downcase label))) 135 | ;; (car table))))) 136 | ;; (eval `(list :load (dm-coalesce-hash ,(cdr table) 137 | ;; ,cols 138 | ;; ,@(when dm-table-key 139 | ;; `(:key-symbol ,dm-table-key))))))) 140 | 141 | ;; (setq x (cons x y)) 142 | ;; (list 'features (nth 2 row)) 143 | 144 | (defun dm-table-load-table (table) 145 | "Apply `dm-table-load-table-fun' to `dm-table-load-table-var' and TABLE. 146 | 147 | Return a terminating form." 148 | ;;(message "[load] fun:%s var:%s" dm-table-load-table-fun dm-table-load-table-var) 149 | (list nil (set dm-table-load-table-var table))) 150 | 151 | ;; (dm-table-load-table (cdr (apply 'dm-table-tranform-table (cdr (dm-table-extract-table 'map)))) '(map)) 152 | 153 | (cl-defun dm-table-defstates (type 154 | &optional &key 155 | (extract dm-table-extract-function) 156 | (transform dm-table-transform-function) 157 | (load dm-table-load-function)) 158 | "Define EXTRACT TRANSFORM and LOAD functions for TYPE, a symbol." 159 | (if (assoc type dm-table-states) 160 | (setcdr (assoc type dm-table-states) 161 | (list :extract extract :transform transform :load load)) 162 | (push (list type :extract extract :transform transform :load load) 163 | dm-table-states))) 164 | 165 | (defun dm-table-step (scope &optional step &rest _data) 166 | "Find the best next function to advance SCOPE. 167 | 168 | SCOPE is a symbol. STEP is a keyword symbol amung :extract 169 | :transform or :load, defaulting to first given for SCOPE.." 170 | ;; (message "[step] scope:%s step:%s scope-states:%s next-step:%s step-func:%s" 171 | ;; scope step (cdr-safe (assq scope dm-table-states)) 172 | ;; (or step (car-safe (cdr-safe (assq scope dm-table-states)))) 173 | ;; (car-safe (cdr-safe (plist-get (cdr-safe (assq scope dm-table-states)) 174 | ;; (or step (car-safe (cdr-safe (assq scope dm-table-states)))))))) 175 | (when-let* ((scope-states (cdr-safe (assoc scope dm-table-states 'equal))) 176 | (next-step (or step (car-safe scope-states))) 177 | (step-func (plist-get scope-states next-step))) 178 | ;;(message "[step] fun:%s next:%s states:%s" step-func next-step scope-states) 179 | (if (functionp step-func) step-func 180 | (eval step-func)))) 181 | 182 | (defun dm-table-batch(scope &optional step &rest data) 183 | "Execute functions in batch until unable to advance SCOPE. 184 | 185 | SCOPE is a symbol. STEP is a keyword symbol, nominally amung 186 | :extract :transform or :load, defaulting to the first for SCOPE 187 | among those given in `dm-table-states'. Any DATA is passed to 188 | the first step function (generally \":extract\"). 189 | 190 | Functions may return nil to halt the batch or a cons cell to 191 | continue: 192 | 193 | (NEXT-STEP RESULT) 194 | 195 | Where NEXT-STEP is a keyword symbol representing the next 196 | step (or nil, to stop), and LAST-RESULT is the current result-set 197 | being carried forward, if any." 198 | (let ((step-func (funcall dm-table-step-function scope step data)) 199 | (result (cons t data))) 200 | (while (and (car-safe result) step-func) 201 | ;;(message "[batch] before func:%s data:%s" step-func data) 202 | (setq result (apply step-func (cdr result))) 203 | ;;(message "[batch] result:%s" result) 204 | (when (car-safe result) 205 | (setq step-func (funcall dm-table-step-function scope (car result))) 206 | ;;(message "[batch] newfunc:%s" step-func) 207 | step-func))) 208 | ;;(message "var:%s eval:%s" dm-table-load-table-var (eval dm-table-load-table-var)) 209 | dm-table-load-table-var) 210 | ;; ^-- redo as when-let? 211 | 212 | (provide 'dm-table) 213 | ;;; dm-table.el ends here 214 | -------------------------------------------------------------------------------- /emacs-init-scripts/user/sample-init.el: -------------------------------------------------------------------------------- 1 | ;;; sample-init.el --- setup emacs with use-package the load dungeon-mode -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Corwin Brust 4 | 5 | ;; Author: Corwin Brust 6 | ;; Keywords: games, convenience 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; This is an example Emacs configuration file that sets up various 24 | ;; packages from MELPA are repository of features generally neither 25 | ;; provided nor supported by GNU. Likewise the authors of 26 | ;; dungeon-mode cannot explicitly vouch for these packages except to 27 | ;; say that we, ourselves, use them and, as users, recommend them. 28 | 29 | ;; This is not a Emacs starter kit. 30 | 31 | ;; No options are provided, for example to enable, disable, or 32 | ;; otherwise configure the specific features this script incorperates. 33 | ;; While you are oncourgaged to customize this script to that end, 34 | ;; this script is a subset of the configuration used by the 35 | ;; dungeon-mode development team, and is thus what we are generally 36 | ;; recommending as we welcome team members new to both the project and 37 | ;; GNU Emacs. https://www.gnu.org/software/emacs 38 | 39 | ;;; Code: 40 | 41 | 42 | ;; Hard-coding the path to init-dm seem to be enough for now. 43 | ;; this will be used in a load-library call at the end of the script 44 | (defvar my:dungeon-mode-init-path 45 | "d:/Projects/dungeon-mode/emacs-init-scripts/user/init-dm.el" 46 | "Location for the `dungeon-mode' init-dm.el script.") 47 | 48 | (require 'package) 49 | (add-to-list 'package-archives 50 | '("MELPA" . "https://melpa.org/packages/") t) 51 | (when (version< emacs-version "27.0") 52 | (package-initialize)) 53 | 54 | ;; !ALERT! This script requires and does not attempt attempt to 55 | ;; !ALERT! bootstrap use-package. Please install manually. 56 | (require use-package) 57 | 58 | (use-package diminish :ensure t) 59 | 60 | ;; shhh 61 | (defalias 'yes-or-no-p 'y-or-n-p) 62 | 63 | ;; disable boilerplate UX gadgets 64 | ;;(scroll-bar-mode -1) 65 | ;;(tool-bar-mode -1) 66 | ;;(menu-bar-mode -1) 67 | 68 | ;; unfuckify 69 | (setq echo-keystrokes 0.1 70 | use-dialog-box nil 71 | visible-bell t 72 | delete-by-moving-to-trash t) 73 | (show-paren-mode t) 74 | (prefer-coding-system 'utf-8) 75 | 76 | ;; clipboard 77 | (delete-selection-mode t) 78 | (transient-mark-mode t) 79 | (setq x-select-enable-clipboard t) 80 | 81 | ;; display line endings 82 | (setq-default show-trailing-whitespace t) 83 | (setq-default indicate-empty-lines t) 84 | (when (not indicate-empty-lines) 85 | (toggle-indicate-empty-lines)) 86 | 87 | ;;;;;;;;;; 88 | ;; line setup from https://github.com/mrvdb/emacs-config 89 | (setq-default truncate-lines nil) 90 | ;; Similar to mail messages, use vertical bar for wrapped paragaphs 91 | (setq visual-line-fringe-indicators '(vertical-bar nil)) 92 | 93 | ;; For all text modes use visual-line-mode 94 | (add-hook 'text-mode-hook 'visual-line-mode) 95 | 96 | ;; clobber tab related default 97 | (setq tab-width 2 98 | indent-tabs-mode nil) 99 | 100 | (setq column-number-mode t) 101 | ;;(require 'autopair) 102 | (use-package rainbow-delimiters :ensure t) 103 | 104 | (use-package powershell :ensure t) 105 | 106 | ;; help learning the keys 107 | (use-package which-key 108 | :ensure t 109 | :defer 0.5 110 | :delight 111 | :config (which-key-mode)) 112 | 113 | ;;; playing with smart-hungry delete 114 | (use-package smart-hungry-delete 115 | :ensure t 116 | :bind (("" . smart-hungry-delete-backward-char) 117 | ("C-d" . smart-hungry-delete-forward-char)) 118 | :defer nil ;; dont defer so we can add our functions to hooks 119 | :config (smart-hungry-delete-add-default-hooks)) 120 | 121 | (use-package emojify 122 | :ensure t 123 | ;; :after erc 124 | :defer 15 125 | :config 126 | (global-emojify-mode) 127 | (global-emojify-mode-line-mode -1)) 128 | 129 | ;; Save places in buffers between sessions 130 | (use-package saveplace 131 | :ensure nil ;builtin 132 | :init 133 | (setq-default save-place-mode t)) 134 | 135 | ;; local sources. I think... 136 | 137 | ;; whitespace on-save cleanup 138 | ;; (use-package ws-butler 139 | ;; :ensure nil ;; ALERT: local sources! 140 | ;; :diminish 141 | ;; :init 142 | ;; (add-hook 'prog-mode-hook 'ws-butler-mode) 143 | ;; (add-hook 'text-mode-hook 'ws-butler-mode) 144 | ;; ;;(ws-butler-global-mode) 145 | ;; ) 146 | 147 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 148 | ;; completion setup 149 | 150 | ;; basic completion with hippie-expand 151 | 152 | ;; https://github.com/asummers/.emacs.d/blob/master/init.el 153 | (use-package hippie-expand 154 | :ensure nil 155 | :bind 156 | ("M-/" . hippie-expand) 157 | :config 158 | (setq hippie-expand-try-functions-list 159 | '(try-expand-dabbrev 160 | try-expand-dabbrev-all-buffers 161 | try-expand-dabbrev-from-kill 162 | try-complete-file-name-partially 163 | try-complete-file-name 164 | try-expand-all-abbrevs 165 | try-expand-list 166 | try-expand-line))) 167 | 168 | ;; "smex is a necessity. It provides history and searching on top of M-x." 169 | (setq smex-save-file (expand-file-name ".smex-items" user-emacs-directory)) 170 | (smex-initialize) 171 | (global-set-key (kbd "M-x") 'smex) 172 | (global-set-key (kbd "M-X") 'smex-major-mode-commands) 173 | 174 | ;; ido filesystem nav 175 | (ido-mode t) 176 | (setq ido-enable-flex-matching t 177 | ido-use-virtual-buffers t) 178 | 179 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 180 | ;; window and frame setup and movement 181 | 182 | ;; undo/redo window arrangment commands with C-c 183 | 184 | ;;(require 'winner) 185 | ;;(winner-mode) 186 | 187 | ;; zip window to window with C-M- 188 | ;; binds are over in init-keybinds.el 189 | ;;(require 'windmove) 190 | ;; change frame when zipping past edgeward window 191 | ;; ALERT local source: https://www.emacswiki.org/emacs/framemove.el 192 | ;;(require 'framemove) 193 | ;;(setq framemove-hook-into-windmove t) 194 | 195 | ;; end windown and frame setup and movement 196 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 197 | 198 | ;; linting with flycheck 199 | ;; https://gist.github.com/daniel-vu/25826682d9af2a201a150aa3c4a4321a 200 | (use-package flycheck 201 | :ensure t 202 | :defer 2 203 | :delight 204 | :init (global-flycheck-mode) 205 | :custom 206 | (flycheck-display-errors-delay .3) 207 | :config 208 | ;;(add-hook 'typescript-mode-hook 'flycheck-mode) 209 | ) 210 | 211 | (use-package company 212 | :ensure t 213 | :config 214 | ;; (add-to-list 'company-backends 'company-math-symbols-unicode) 215 | ;; (add-to-list 'company-backends 'company-elisp) 216 | ;; (add-to-list 'company-backends 'company-emoji) 217 | ;; extra documentation while you wait 218 | ;; (use-package company-quickhelp :ensure t :config 219 | ;; (company-quickhelp-mode)) 220 | ;; M- to select a completion 221 | (setq company-show-numbers t) 222 | (setq company-tooltip-align-annotations t) 223 | ;; invert direction when popup is near bottom of window 224 | ;; TODO: can we also invert the keymap here somehow? 225 | (setq company-tooltip-flip-when-above t) 226 | (setq company-tooltip-align-annotations t) 227 | (global-company-mode)) ;; use everywhere 228 | 229 | (use-package helpful :ensure t 230 | :config 231 | ;; config and commentay from https://github.com/Wilfred/helpful 232 | ;;; Note that the built-in `describe-function' includes both functions 233 | ;; and macros. `helpful-function' is functions only, so we provide 234 | ;; `helpful-callable' as a drop-in replacement. 235 | (global-set-key (kbd "C-h f") #'helpful-callable) 236 | (global-set-key (kbd "C-h v") #'helpful-variable) 237 | (global-set-key (kbd "C-h k") #'helpful-key) 238 | 239 | ;;;; I also recommend the following keybindings to get the most out of helpful: 240 | ;; Lookup the current symbol at point. C-c C-d is a common keybinding 241 | ;; for this in lisp modes. 242 | (global-set-key (kbd "C-c C-d") #'helpful-at-point) 243 | 244 | ;;;; Look up *F*unctions (excludes macros). 245 | ;; 246 | ;; By default, C-h F is bound to `Info-goto-emacs-command-node'. Helpful 247 | ;; already links to the manual, if a function is referenced there. 248 | (global-set-key (kbd "C-h F") #'helpful-function) 249 | 250 | ;;;; Look up *C*ommands. 251 | ;; 252 | ;; By default, C-h C is bound to describe `describe-coding-system'. I 253 | ;; don't find this very useful, but it's frequently useful to only 254 | ;; look at interactive functions. 255 | (global-set-key (kbd "C-h C") #'helpful-command) 256 | 257 | ;;;; Ivy users can use Helpful with counsel commands: 258 | ;; (setq counsel-describe-function-function #'helpful-callable) 259 | ;; (setq counsel-describe-variable-function #'helpful-variable) 260 | ;; 261 | ) ;;;;;;;;;;; helpful 262 | (require 'powerline) 263 | (powerline-default-theme) 264 | 265 | 266 | ;; Added by Erik Elmshauser to enable dungeon-mode at emacs launch 267 | (load-library my:dungeon-mode-init-path) 268 | 269 | (provide 'sample-init) 270 | ;;; sample-init.el ends here 271 | -------------------------------------------------------------------------------- /Docs/Maps/bigwater.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | B 43 | 44 | 45 | 46 | 47 | 48 | 49 | B 50 | 51 | 52 | 53 | 54 | 55 | 56 | B 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | B 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | B 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | B 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | | 179 | 180 | -------------------------------------------------------------------------------- /Docs/Baddies/Chamber.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Baddies for chambers 2 | #+PROPERTIES: 3 | :Version: 0.01 4 | :Author: Erik C Elmshauser 5 | :Created: 2020/01/11 6 | :END: 7 | 8 | This file is a part of dungeon-mode. It is not a part of GNU Emacs. 9 | This softare is released under the GNU Public Licence version three 10 | or, at your disgression, any newer version of the GNU Public 11 | License. For specific terms please see [[LICENSE]] at end-of-file. 12 | 13 | * Chamber Baddies 14 | 15 | + This table is the Main baddies table used in chambhers and "normal" encounters 16 | + To find the starting table use (Dungeon level) + (number of squares of chamber - 1) 17 | + (Therefor a 10x10 on level 1 is (1) + (1-1) = 1 and a 10x20 on level 3 is (3) + (2-1) = 4) 18 | + half squares of chamber are half tables (start on the B table instead of the A Table) 19 | 20 | + Roll 1D6 into the starting table, 1-5 select baddie by ID, 6 reroll on the next table 21 | 22 | *** Informational note 23 | + Tables are divided into multiple parts for several reasons. 24 | + There is a variety of baddies that have a similar difficulty and can appear in the same part of the dungeon. 25 | + The table number is the number of treasure rolls after the battle, so we can have battles of comparable difficulty give the same ammount of treasure 26 | + The table letter should generally progress from less difficult to more difficult encounters, and can influence the quality of the treasure 27 | 28 | ** 1A 29 | | table | # | name | family | index | primary | secondary | special | sp | sw | ax | ma | hits | worth | Notes | 30 | |-------+---+-------------+----------+-------+---------------+----------------------+----------------+----+----+----+----+------+-------+---------------------------------| 31 | | / | < | > | < | > | < | | > | < | | | > | < | > | <> | 32 | | 01A | 1 | Bobcat | CATS | 26 | 1 on 7 for 1 | 2 on 8 for 1 | | 8 | 8 | 8 | 7 | 2 | 2 | | 33 | | 01A | 2 | Prarie Dogs | DOGS | 35 | 1 on 8 for 1 | | | 7 | 7 | 7 | 7 | 3 | 3 | | 34 | | 01A | 3 | Salamander | REPTILES | 10 | 1 on 9 for 1 | 1 on dbl for special | 1D fire damage | 6 | 6 | 6 | 6 | 2 | 5 | | 35 | | 01A | 4 | Sun Bears | BEARS | 26 | 2 on 10 for 1 | 1 on 8 for 2 | | 7 | 8 | 8 | 9 | 2 | 2 | | 36 | | 01A | 5 | Buzzard | BIRDS | 29 | 1 on 8 for 1 | | | 10 | 9 | 9 | 9 | 2 | 2 | Flies (can attack any position) | 37 | 38 | ** 1B 39 | | table | # | name | family | index | primary | secondary | special | sp | sw | ax | ma | hits | worth | Notes | 40 | |-------+---+---------------+---------+-------+--------------+----------------------+--------------------------------+----+----+----+----+------+-------+-----------------------| 41 | | / | < | > | < | > | < | | > | < | | | > | < | > | <> | 42 | | 01B | 1 | Kobolds | FANTASY | 35 | 1 on 9 for 1 | | | 8 | 8 | 8 | 9 | 2 | 2 | | 43 | | 01B | 2 | Keystone Cops | COPS | 35 | 1 on 8 for 1 | 1 on dbl for special | Cream Pie blinds for 1D rounds | 8 | 8 | 8 | 8 | 2 | 2 | cops throw cream pies | 44 | | 01B | 3 | Monkey | SIMEANS | 16 | 2 on 9 for 1 | 1 on dbl for special | steal an item from inventory | 7 | 7 | 7 | 7 | 3 | 3 | | 45 | | 01B | 4 | Zerglings | ALIENS | 18 | 2 on 8 for 1 | | | 9 | 8 | 8 | 10 | 2 | 2 | | 46 | | 01B | 5 | Floating Eye | DEAMONS | 1 | N/A | N/A | Paralyze attacker on doubles | 6 | 6 | 6 | 6 | 4 | 12 | | 47 | 48 | ** 1C 49 | + More level 1 baddies would go here 50 | 51 | ** 2A 52 | | table | # | name | family | index | primary | secondary | special | sp | sw | ax | ma | hits | worth | Notes | 53 | |-------+---+-------------+----------+-------+--------------+--------------+---------+----+----+----+----+------+-------+---------------------------------| 54 | | / | < | > | < | > | < | | > | < | | | > | < | > | <> | 55 | | 02A | 1 | Lynx | CATS | 26 | 1 on 7 for 1 | 2 on 7 for 1 | | 8 | 8 | 8 | 7 | 3 | 3 | | 56 | | 02A | 2 | Jackels | DOGS | 35 | 1 on 8 for 2 | | | | 7 | 7 | 7 | 7 | 4 | 4 | 57 | | 02A | 3 | Iguana | REPTILES | 14 | 1 on 7 for 1 | 1 on 8 for 2 | | 7 | 7 | 7 | 7 | 4 | 4 | | 58 | | 02A | 4 | Brown Bears | BEARS | 26 | 2 on 9 for 1 | 1 on 8 for 2 | | 8 | 9 | 9 | 10 | 4 | 4 | | 59 | | 02A | 5 | Red Hawk | BIRDS | 29 | 2 on 8 for 1 | | | 10 | 9 | 9 | 9 | 5 | 5 | Flies (can attack any position) | 60 | 61 | ** 2B 62 | | table | # | name | family | index | primary | secondary | special | sp | sw | ax | ma | hits | worth | Notes | 63 | |-------+---+-------------+---------+-------+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----+----+----+----+------+-------+-----------------| 64 | | / | < | > | < | > | < | | > | < | | | > | < | > | <> | 65 | | 02B | 1 | Goblins | FANTASY | 35 | 1 on 8 for 1 | | | 8 | 8 | 8 | 9 | 5 | 5 | | 66 | | 02B | 2 | Police | COPS | 18 | 1 on 8 for 2 | 1 on dbl for special | Glock: 10 shots do 1D damage | 9 | 9 | 9 | 9 | 5 | 5 | 1 shot pr round | 67 | | 02B | 3 | Wererat | SIMEANS | 15 | 2 on 10 for 1* | | *Bite makes you a wererat | 8 | 9 | 9 | 8 | 2 | 4 | | 68 | | 02B | 4 | Face Hugger | ALIENS | 1 | 1 on dbl for hug | | Hug: You become incapacitated for 1d rounds (or rest of battle) then is comes off. Each battle there after is a dbl chance a baby alien will emerge | 11 | 11 | 11 | 10 | 1 | 10 | *ACID* | 69 | | 02B | 5 | Beholder | DEAMONS | 1 | 1 on dbl for special | | Gaze will paralyze for 1D rounds; Will Paralyze attacker on doubles | 6 | 6 | 6 | 6 | 10 | 20 | | 70 | 71 | ** 3A 72 | | table | # | name | family | index | primary | secondary | special | sp | sw | ax | ma | hits | worth | Notes | 73 | |-------+---+---------------+----------+-------+--------------+----------------------+---------------------+----+----+----+----+------+-------+---------------------------------| 74 | | / | < | > | < | > | < | | > | < | | | > | < | > | <> | 75 | | 03A | 1 | Mountin Lion | CATS | 16 | 1 on 7 for 2 | 2 on 7 for 2 | | 8 | 8 | 8 | 7 | 8 | 8 | | 76 | | 03A | 2 | Wild Dogs | DOGS | 35 | 1 on 8 for 2 | | | 8 | 9 | 9 | 10 | 6 | 6 | | 77 | | 03A | 3 | Giant Lizzard | REPTILES | 14 | 1 on 7 for 2 | 1 on 8 for 2 | | 7 | 7 | 7 | 7 | 6 | 6 | | 78 | | 03A | 4 | Black Bears | BEARS | 26 | 2 on 9 for 2 | 1 on 8 for 2 | | 8 | 9 | 9 | 10 | 6 | 6 | | 79 | | 03A | 5 | Raven | BIRDS | 29 | 2 on 8 for 2 | 1 on dbl for special | blind for 1D rounds | 10 | 9 | 9 | 9 | 5 | 5 | Flies (can attack any position) | 80 | 81 | ** 3B 82 | | table | # | name | family | index | primary | secondary | special | sp | sw | ax | ma | hits | worth | Notes | 83 | |-------+---+-----------------+---------+-------+----------------------+----------------------+------------------------------------------------------------+----+----+----+----+------+-------+---------------------------| 84 | | / | < | > | < | > | < | | > | < | | | > | < | > | <> | 85 | | 03B | 1 | Orcs | FANTASY | 35 | 1 on 8 for 2 | | | 8 | 9 | 8 | 9 | 8 | 8 | | 86 | | 03B | 2 | Swat Team | COPS | 26 | 2 on 8 for 2 | 1 on dbl for special | AR-15: 30 shots do 1D damage | 10 | 10 | 10 | 10 | 8 | 8 | 1 shot pr round | 87 | | 03B | 3 | Werejackel | SIMEANS | 12 | 2 on 8 for 2* | | *Bite makes you a werejackel | 9 | 9 | 9 | 9 | 5 | 10 | | 88 | | 03B | 4 | Giant Brain | ALIENS | 1 | 1 on dbl for special | | Stupify ray gives brain control of character for 1D rounds | 7 | 7 | 7 | 7 | 5 | 10 | | 89 | | 03B | 5 | Freezing Sphere | DEAMONS | 1 | 1 on dbl for special | | 1D Freezing Damage | 7 | 7 | 7 | 7 | 10 | 20 | DoD Ice Blast when killed | 90 | 91 | * LICENSE 92 | 93 | This program is free software; you can redistribute it and/or modify 94 | it under the terms of the GNU General Public License as published by 95 | the Free Software Foundation, either version 3 of the License, or 96 | (at your option) any later version. 97 | 98 | This program is distributed in the hope that it will be useful, 99 | but WITHOUT ANY WARRANTY; without even the implied warranty of 100 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 101 | GNU General Public License for more details. 102 | 103 | You should have received a copy of the GNU General Public License 104 | along with this program. If not, see . 105 | -------------------------------------------------------------------------------- /dungeon-game.org: -------------------------------------------------------------------------------- 1 | #+TITLE: dungeon-game.el 2 | #+OPTIONS: broken-links:t num:nil H:8 3 | 4 | # logo image just floats left. Github does a nicer job than htmlize 5 | # so don't work about imaage overlapping first two text blocks in the 6 | # HTML output; it is just for preview purposes. Travis-ci makes the 7 | # real .el and github creates the key documentation for review prior 8 | # to download and install at which point prefer the help system. 9 | . 10 | #+HTML: 11 | 12 | # print a description at the top for GitHub 13 | # CEZB
 looks cool here.
 14 | 
 15 | #+NAME: dungeon-game-project-description
 16 | #+BEGIN_SRC text
 17 | Turn-based gaming with GNU Emacs
 18 | #+END_SRC
 19 | 
 20 | * Usage
 21 | :PROPERTIES:
 22 | :TOC: ignore
 23 | :END:
 24 | 
 25 | #+BEGIN_SRC elisp :tangle no
 26 |   ;; to join game as a plyer
 27 |   (dungeon-game-join "host.name" "player-secret")
 28 | 
 29 |   ;; to host a game
 30 |   (dungeon-game-run (dungeon-game-read "~/dm/my-game/"))
 31 | 
 32 |   ;; edit/create, mini-buffer prompts for path, etc.
 33 |   (dungeon-mode)
 34 | #+END_SRC
 35 | 
 36 | #+BEGIN_SRC elisp padline:no :exports none
 37 | ;;; dungeon-game.el --- build and play a dungeon game -*- lexical-binding: t; -*-
 38 | 
 39 | ;; Copyright (C) 2020  Corwin Brust
 40 | 
 41 | ;; Author: Corwin Brust 
 42 | ;; Keywords: games
 43 | 
 44 | ;; This program is free software; you can redistribute it and/or modify
 45 | ;; it under the terms of the GNU General Public License as published by
 46 | ;; the Free Software Foundation, either version 3 of the License, or
 47 | ;; (at your option) any later version.
 48 | 
 49 | ;; This program is distributed in the hope that it will be useful,
 50 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 51 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 52 | ;; GNU General Public License for more details.
 53 | 
 54 | ;; You should have received a copy of the GNU General Public License
 55 | ;; along with this program.  If not, see .
 56 | 
 57 | ;;; Commentary:
 58 | #+end_src
 59 | 
 60 | * Obtaining Project Sources
 61 | 
 62 | The full compliment of available sources including documentation and
 63 | licensing information are not included within this file.
 64 | 
 65 | As noted in the package source:
 66 | 
 67 | #+name: attribution-and-source-pointer
 68 | #+begin_src org :tangle no :padline no
 69 |   This is the main distributable packaged from dungeon-mode `dm' sources
 70 |   and intended to support quick install and boot-strapping of an Emacs
 71 |   environment for game-play or authoring.  If you are packaging your
 72 |   own game (e.g. using `dm-publish') you may remove this paragraph but
 73 |   please retain the following one or include similar pointer back to an
 74 |   authoritative dungeon-mode repository (e.g. linking to your own fork
 75 |   is fine as people can eventually find reference to all contributions
 76 |   this way).
 77 | 
 78 |   Complete and authoritative source materials including issue reporting
 79 |   and status as well as additional documentary/narrative are available
 80 |   from our GitHub repository, which see:
 81 | 
 82 |    https://gibhub.com/dungeon-mode/dm/
 83 | #+END_SRC
 84 | 
 85 | * Contents                                                         :noexport:
 86 | :PROPERTIES:
 87 | :TOC:    this
 88 | :END:
 89 | -  [[#obtaining-project-sources][Obtaining Project Sources]]
 90 | -  [[#features][Features]]
 91 |   -  [[#customization][Customization]]
 92 |   -  [[#other-variables][Other Variables]]
 93 |   -  [[#utilities][Utilities]]
 94 |   -  [[#functions][Functions]]
 95 |   -  [[#class-definitions][Class Definitions]]
 96 |     -  [[#dm-source][dm-source]]
 97 |       -  [[#dont-hard-code-lines-see-httpsorgmodeorgmanualadvanced-configurationhtml][don't hard-code :LINES, see: https://orgmode.org/manual/Advanced-configuration.html]]
 98 |   -  [[#interactive-functions][Interactive Functions]]
 99 |   -  [[#minor-modes][Minor Modes]]
100 |   -  [[#major-modes][Major Modes]]
101 | -  [[#additional-commentary][Additional Commentary]]
102 | -  [[#packaging-configuration][Packaging Configuration]]
103 |   -  [[#file-local-properties][File-local properties]]
104 |   -  [[#file-local-variables][File-local variables]]
105 | 
106 | * Features
107 | 
108 | #+NAME: elisp-body
109 | #+BEGIN_SRC elisp :exports none
110 | ;;; Code:
111 | #+END_SRC
112 | 
113 | ** TODO Customization
114 | 
115 | #+BEGIN_SRC elisp :noweb yes
116 |   ;;; customize
117 | 
118 |   (defgroup dungeon-mode ()
119 |     "<>"
120 |     :group 'games)
121 | 
122 |   (defcustom dm-base-path nil
123 |     "Root folder for all saved game materials."
124 |     :type 'string)
125 | 
126 |   (defcustom dm-dungeon-master-info nil
127 |     "Your identity to players."
128 |     :type 'sexp)
129 | 
130 |   (defcustom dm-player-info-alist nil
131 |     "Your identity as a player.
132 | 
133 |   List cons cells (alist) in the form:
134 |     ( GAME . DM-PLAYER )
135 | 
136 |   Where GAME is a valid symbol name and DM-PLAYER is the
137 |   player-info structure as a vector (e.g. as from (`dm-player')
138 |   or a cloneable instance object of class/super dm-player, or as
139 |   or a string containg either a fully-qualified
140 |   file-name (e.g. \"^/\") or a file-name with a path relititive to
141 |   `dm-base-path' (e.g. \"^[^/]\").")
142 | 
143 |     (defvar dm-pc-alist nil
144 |       "Global auto-complete support for `dm-player-character'.
145 | 
146 |     Entries are similar to, e.g. `dm-table-alist' notwithstanding
147 |     references are to `dm-player-character' and `dm-defpc' vs
148 |     corrisponding table related interfaces mentioned."
149 |     :type 'alist)
150 | #+end_src
151 | 
152 | 
153 | ** TODO Other Variables
154 | 
155 | #+BEGIN_SRC elisp
156 |   ;;; vars
157 | 
158 |   (defvar dm-host-dm nil
159 |     "The identity of your host when playing.
160 | 
161 |   Generally matches `dm-dungeon-master-info' when you are the
162 |   Dungon Master and contains someone else's info otherwise.")
163 | 
164 |   (defvar dm-host nil "The host Emacs server.")
165 | 
166 |   (defvar dm-sources-path "~/games/dungeon/sources"
167 |     "Local save path for source material.")
168 | 
169 |   (defvar dm-notes-path "~/games/dungeon/campaigns"
170 |     "Local save path for player materials.
171 | 
172 |   Any game notes saved localally while playing (not as the DM) are
173 |   by default placed in this folder.")
174 | 
175 |   (defvar dm-journal-path "~/games/dungeon/campaigns"
176 |     "Local save path for game specific DM materials.
177 | 
178 |   The game journal as well as any game specific rules or notes
179 |   while acting as DM are by default placed in this folder.")
180 | 
181 |   (defvar dm-table-alist nil
182 |     "Global auto-complete support for the `dm-table' context.
183 | 
184 |   Entries are in the form ( SYMBOL . TABLE-DEF ) where SYMBOL is a
185 |   valid symbol name and TABLE-DEF is the table structure as a
186 |   vector (e.g. as from `dm-deftable') or a cloneable instance
187 |   object with dm-table as class/super or a string containg either a
188 |   fully-qualified file-name (e.g. \"^/\") or a file-name with a
189 |   path relititive to `dm-journal-path' (e.g. \"^[^/]\").")
190 | 
191 |   (defvar dm-pc-alist nil
192 |     "Global auto-complete support for `dm-player-character'.
193 | 
194 |   Entries are similar to, e.g. `dm-table-alist' notwithstanding
195 |   references are to `dm-player-character' and `dm-defpc' vs
196 |   the corrisponding table related functions mentioned.")
197 | 
198 | #+end_src
199 | 
200 | ** TODO Utilities
201 | 
202 | ** TODO Functions
203 | 
204 | ** TODO Class Definitions
205 | 
206 | #+NAME: elisp-body--defclass :export no
207 | #+BEGIN_SRC elisp :export no
208 | ;;; classes with eieio
209 | 
210 | (require 'eieio)
211 | (require 'eieio-base)
212 | #+END_SRC
213 | 
214 | #+NAME: elisp-body--defclass--dm-source
215 | 
216 | *** dm-source
217 | 
218 |     Generic representation of game source.
219 | 
220 |     DATA may be at any level of abstraction.  In the context of
221 |     `org-mode' this could mean a cell, row, or column within a table,
222 |     an entire table, an hl with or without content and sub-sections,
223 |     or the entire document.  Instance do not retain any association to
224 |     their originating buffers or files -if any- which handling of is
225 |     generally left to modes and otherwise the general behaviors of Emacs.
226 | 
227 |     DOCSTRING is documentation for the Dungeon Master to help
228 |     use/apply and extend the source element. DOCSTRING defaults to the
229 |     value or result of DATA when omitted and given DATA is a raw data
230 |     value, expression, or function receiving no args.
231 | 
232 |     NARRATIVE is an additional doc-string suitable for display to
233 |     players in tool-tips and built in help. E.g. Spoiler free help.
234 | 
235 | 
236 | #+BEGIN_SRC elisp :export no
237 | (defclass dm-source (eieio-named)
238 |   ((data      :initarg :data :docstring
239 | 	      "Raw source data.")
240 |    (docstring :initarg :docstring :docstring
241 | 	      "Help or information for Dungeon Masters.")
242 |    (narrative :initarg :narrative :docstring
243 | 	      "Help or information for players."))
244 |   "<<<[ how-to? this-hl-title ]>>>
245 | 
246 | <<<[ how-to? this-hl-body-first-paragraph ]>>>")
247 | #+END_SRC
248 | 
249 | **** TODO don't hard-code :LINES, see: https://orgmode.org/manual/Advanced-configuration.html
250 | # #+header: :exports code 
251 | # +INCLUDE: "src/classes.el" src elisp :LINES "26-88" :tangle dungeon-game.org append
252 | # #+INCLUDE: "src/classes.el" export :LINES "26-88"
253 | 
254 | # CEZB: can't get it into the tangled? new plan.
255 | # C-c ' then: M-x flycheck-disable-checker RET emacs-lisp-checkdoc RET
256 | # so we'll have to see about all that... :CEZB
257 | 
258 | #+BEGIN_SRC elisp :padline yes
259 |   (defclass dm-player (eieio-named)
260 |     ((host   :initarg :host :docstring
261 | 	     "Remote host/IP and port.")
262 |      (secret :initarg :secret :docstring
263 | 	     "Remote access credential."))
264 |     "Personal information about you or others.
265 | 
266 |   elisp: none")
267 | 
268 |   (defclass dm-player-buffer (dm-source)
269 |     ((player :initarg :player)
270 |      (frame  :initarg :frame)
271 |      (window :initarg :window)
272 |      (buffer :initarg :buffer)
273 |      ;;narrow? transient-mark? either? both?
274 |      (region :initarg :region)
275 |      (buffer-file-p :initarg :savep)
276 | 
277 |      (p-mode :initarg :player-mode
278 | 	     :docstring "Control string for remote user.")
279 |      (mode   :initarg :mode
280 | 	     :docstring "Remote update control string."))
281 |     "Represting a remote buffer.
282 | 
283 |   elisp: region buffer window frame")
284 | 
285 |   (defclass dm-source-ref (dm-source)
286 |     ((file   :initarg :local-working-file)
287 |      (source :initarg :source)
288 |      (buffers :initarg :buffers))
289 |     "Map of source and working file to players' buffers.
290 | 
291 |   elisp: buffer-file buffer-content")
292 | 
293 |   (defclass dm-aspect (dm-source)
294 |     ((kinds :initarg :kinds)
295 |      (sources :initarg :souces))
296 |     "Property sets; E.g. treasure types, character races, etc.
297 | 
298 |   elisp: symbol-properties with pre-set value options")
299 | 
300 |   (defclass dm-unique-aspect (dm-aspect) ((refs :initarg :refs))
301 |     "Global property set, e.g. player characters, uniques, etc.
302 | 
303 |   elisp: globally defined symbols ")
304 | 
305 |   (defclass dm-play-session ()
306 |     ((players :initarg :players)
307 |      (sources :initarg :sources)
308 |      (buffers :initarg :buffers)
309 |      (refs    :initarg :refs)
310 |      (action  :initarg :next-action))
311 |     "Represents a single play session, in progress or after the fect.")
312 | 
313 |   ;; (defclass dm-templateclas ()
314 |   ;;   (())
315 |   ;;   "TODO docstring for dm-templateclas.")
316 | #+END_SRC
317 | 
318 | ** TODO Interactive Functions
319 | 
320 | ** TODO Minor Modes
321 | 
322 | ** TODO Major Modes
323 | 
324 | * Additional Commentary
325 | 
326 | Target specific forms or commentary come just before the elisp footer.
327 | 
328 | # No target dependant forms yet.  Yay!
329 | 
330 | #+NAME: elisp-footer
331 | #+BEGIN_SRC elisp padline:no :exports none
332 | 
333 | (provide 'dungeon-game)
334 | ;;; dungeon-game.el ends here
335 | #+END_SRC
336 | 
337 | * COMMENT Packaging Configuration
338 | 
339 |   Babel setup gratefully snipped from [[https://raw.githubusercontent.com/alphapapa/unpackaged.el/master/README.org][unpackaged.el]].
340 | 
341 | #+BEGIN_QUOTE
342 | 
343 |   I love Emacs and Org mode.  This makes it so easy to make the
344 |   document...alive!  And automated!  Beautiful.
345 | 
346 | #+END_QUOTE
347 | 
348 | ** File-local properties
349 | 
350 | #+PROPERTY: header-args:elisp :tangle dungeon-game.el
351 | #+KEYWORDS: games
352 | #+TAGS: { TODO(t)  INPROGRESS(p) MPTP(c) }
353 | #+TAGS: { Corwin(C)  Erik(E) }
354 | 
355 | ** File-local variables
356 | 
357 | # Local Variables:
358 | # eval: (require 'org-make-toc)
359 | # eval: (unpackaged/org-export-html-with-useful-ids-mode 1)
360 | # before-save-hook: org-make-toc
361 | # after-save-hook: (lambda nil (org-babel-tangle) (org-html-export-to-html))
362 | # org-export-with-properties: ()
363 | # org-export-with-title: t
364 | # org-export-with-broken-links: t
365 | # org-id-link-to-org-use-id: nil
366 | # org-export-initial-scope: buffer
367 | # elisp-format-newline-keyword-except-list: (:initarg)
368 | # End:
369 | 
370 | #  LocalWords:  DOCSTRING
371 | 


--------------------------------------------------------------------------------
/Docs/Maps/Design.org:
--------------------------------------------------------------------------------
  1 | #+TITLE: Map Design
  2 | #+PROPERTIES:
  3 |  :Version: 0.01
  4 |  :Author: Corwin Brust
  5 |  :Created: 2020/01/11
  6 |  :END:
  7 | 
  8 | This file is a part of dungeon-mode.  It is not a part of GNU Emacs.
  9 | This softare is released under the GNU Public Licence version three
 10 | or, at your disgression, any newer version of the GNU Public
 11 | License.  For specific terms please see [[LICENSE]] at end-of-file.
 12 | 
 13 | * Overview
 14 | 
 15 | This file provides drawing instruction sets as a
 16 | for common map features such as corridor, secret doors, standard
 17 | chambers and stairs.
 18 | 
 19 | The first column provides a SYMBOL for referencing the instruction set
 20 | in level designs.  PLAN is a mixed sequence of SVG drawing
 21 | instructions and functions which return lists of SVG drawing
 22 | instructions.  ORIGIN passed to such functions is a cons cell
 23 | containing ( X . Y ) representing the upper-left absolute grid
 24 | position of the upper-most left-most corner of the smallest possible
 25 | top-left justified rectangle completing covering the drawn region in
 26 | the coordinate space of the dungeon level we are rendering.
 27 | 
 28 | DOCUMENTATION provides information for Dungeon Masters and during game
 29 | design.  NARRATIVE provides hints or other information to players via
 30 | emacs interactive help e.g., tooltips, et. all.
 31 | 
 32 | * Implementation
 33 | 
 34 | This section describes and implements the inner-workings of SVG
 35 | rendering of maps.
 36 | 
 37 | ** Cursor Drawing using the [[https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths][SVG path element]]
 38 | 
 39 | Dungeon using the Scalable Vector Graphic (SVG) [[https://www.w3.org/TR/SVG/paths.html][path element]] to
 40 | implement a simple cursor based drawing approach similar to [[https://en.wikipedia.org/wiki/Logo_(programming_language)][Logo]]
 41 | (e.g. [[https://github.com/hahahahaman/turtle-geometry][turtle graphics]]).  By concatenating all of the required draw
 42 | instructions for the elements of the map visible to players (along
 43 | with suitable fixed-address based movement instructions between) we
 44 | can add most non-text elements within a single path.
 45 | 
 46 | This imposes limitations in terms, for example, of individually
 47 | styling elements such as secret doors (drawn in-line, currently) but
 48 | seems a good starting point in terms of establishing a baseline for
 49 | the performance rendering SVG maps on-demand within Emacs.
 50 | 
 51 | * Controls
 52 | 
 53 | These variables will be available (lexically bound) during expansion
 54 | of the SVG path macros below.  They cannot considered global because
 55 | the data representing an individual map may be driving display into
 56 | several different buffers which must retain their own settings
 57 | (e.g. scale and view-box dimensions).
 58 | 
 59 | | Control   | Setting | Documentation                           | Narrative |
 60 | |-----------+---------+-----------------------------------------+-----------|
 61 | | scale     |     100 | Pixels per 10' game space.              |           |
 62 | | view-box  |      16 | List, min-x, min-y, width and height.   |           |
 63 | |-----------+---------+-----------------------------------------+-----------|
 64 | | path-data |         | While rendering, String: main draw path |           |
 65 | | map-data  |         | List, map features to draw              |           |
 66 | 
 67 | # | zoom     |       1 | Zoom, as a number between 0 and 1.      |           |
 68 | 
 69 | #+begin_src elisp
 70 | ;; public vars
 71 | ;; TODO: defcustom these instead?
 72 | (defvar dm-map-scale 100 "Drawing scale; pixles per 10' of map.
 73 | 
 74 | TODO: generate this var from the table above")
 75 | 
 76 | (defvar dm-map-view-box nil "Croping view-box for the SVG tag.
 77 | 
 78 | TODO: see `dm-scale' for detail.")
 79 | 
 80 | ;; private vars
 81 | (defvar dm-map--path-data nil "Main SVG path data as a string.
 82 | 
 83 | TODO: see `dm-scale' for detail.")
 84 | 
 85 | (defvar dm-map--map-data nil "SVG data as a string.
 86 | 
 87 | TODO: see `dm-scale' for detail.")
 88 | #+end_src
 89 | 
 90 | ** SVG path macros
 91 | 
 92 | These macros support noweb syntax with ~org-babel~ to eliminate boilerplate for
 93 | basic cursor based drawing using the [[https://css-tricks.com/svg-path-syntax-illustrated-guide/][SVG path element]].
 94 | 
 95 | #+begin_src emacs-lisp
 96 | 
 97 |   (defvar dm-map--svg-data "Non-path SVG instructions.
 98 | 
 99 |   Filled by `dm-map--append' for `dm-map-append' while appending to
100 |   path data.")
101 |   (defmacro dm-map-append (&rest forms)
102 |     "Add FORMS to map.
103 | 
104 |   Generally meaning, append to the \"d\" attribute value for the primary
105 |   path representing chambers, corridor and secret doors in map.
106 | 
107 |   FORMS may be any of:
108 |    - strings
109 |      - when starting with a \"<\"*, literal SVG source
110 |      - otherwise literal path data
111 |    - keywords
112 |      - taken as SVG basic drawing elements
113 |      - followed by a plist taking the form:
114 |        ( :ATTRIBUTE1 \"value1\" ... )
115 |    - functions
116 |      - called without arguments
117 |      - return treated as per FORMS
118 | 
119 |   Returns a cons cell in the form:
120 |     ( SVG-STRING . PATH-STRING ) Where SVG-STRING is SVG code other
121 |   than the main draw path and PATH-STRING is the path-data for the
122 |   main-draw path."
123 |     ;; TODO put some code here
124 |     (let* (new-svg
125 | 	   (f (apply-partially 'dm-map--append 'new-svg))
126 | 	   (new-path (mapconcat f forms)))
127 |       `(cons (setq dm-map--svg-data
128 | 		   (concat dm-map--svg-data ,new-svg))
129 | 	     (setq dm-map--path-data
130 | 		   (concat dm-map--path-data ,new-path)))))
131 | 
132 |   (defun dm-map--append (svg-elements form)
133 |     "Implemention for `dm-map-append' which see.
134 | 
135 |   Return strings remaining after recursively processing FORM.
136 |   SVG-ELEMENTS are a list to which any SVG (e.g. non-path) elements
137 |   found will be added."
138 |     (cond (nil "nope")
139 | 	  (t "yep")
140 | 	  ))
141 | #+end_src
142 | 
143 | * Features
144 |   :PROPERTIES:
145 |   :map-features: t
146 |   :END:
147 | 
148 | SVG drawing support for map features.
149 | 
150 |  * The first row defines (names) a Feature (e.g. SYMBOL).
151 |  * Additional rows may define a new symbol or continue the draw
152 |    instructions (the "Plan"), or Documentation, or Narrative, or more
153 |    than one these, which are each appended to the most recently
154 |    defined Feature's attributes.
155 |  * Ignore Blank rows and hlines.
156 | 
157 | Note, the UM here is map cells (e.g. ~10'~ in game terms) not pixels.
158 | Macros apply a scale factor during expansion.
159 | 
160 | TODO consider other fields: version, area
161 | ** Features Table
162 |    :PROPERTIES:
163 |    :name: default-map-features
164 |    :MAP-FEATURES: t
165 |    :END:
166 | 
167 | # #+NAME: default-map-features
168 | | Feature  | Plan                               | Documentation                             | Narrative |
169 | |----------+------------------------------------+-------------------------------------------+-----------|
170 | | c-N      | v1 h1 v1                           | North                                     |           |
171 | | c-NS     | v1 m1,0 v-1                        | North/South                               |           |
172 | | c--NSE   | v1                                 | North/South/East                          |           |
173 | | c-NSE    | c--NSE                             | North/South/East                          |           |
174 | |          | m.98,0 h.02 v-.02 m 0,-.96 h-.02   |                                           |           |
175 | | c-NSEW   | m0,.02 v-.02 h2 m.96,0 h2 v.02     | North/South/East/West (four-way)          |           |
176 | |          | m0,.96 v2 h-.02 m-.96,0 h-2 v-.02  | :comment from test.svg                    |           |
177 | | c-NE     | m0,1 v1 h-1                        | North/East                                |           |
178 | | c--NSW   | v1                                 | North/South/West                          |           |
179 | | c-NSW    | c--NSW                             | North/South/West                          |           |
180 | |          | m.98,0 h.02 v.02 m0,.96 v.02 h-.02 |                                           |           |
181 | | c-NW     | v1 h1                              | North/East                                |           |
182 | | c-S      | v1 m0,-1 h1 v1                     | South                                     |           |
183 | | c-SE     | h1 v1                              |                                           |           |
184 | | c--SEW   | h1                                 | South/East/West                           |           |
185 | | c-SEW    | v1 h1 v-1                          | South/East/West                           |           |
186 | | c-SW     | h1 m-1,0 v1                        | South/West                                |           |
187 | | c-E      | h1 v1 h-1                          | East                                      |           |
188 | | c-EW     | h1 m0,1 h-1                        | East/west                                 |           |
189 | | c-W      | v1 h1 m0,-1 h-1                    | East                                      |           |
190 | | sE       | v.43 a.14,.14,0,1,1,0,.14          | North/South/West                          |           |
191 | |          | -.14,-.14,0,1,1,0,-.14 v.43        | :elf secret-door East                     |           |
192 | | sS       | m0,1 h.43 a.14,.14,0,1,1,.14,0     | North/East/West                           |           |
193 | |          | -.14,-.14,0,1,1,-.14,0 h.43        | :elf secret-door South                    |           |
194 | | sW       | m1,0 v.43 a.14,.14,0,1,1,0,.14     | North/South/East                          |           |
195 | | sW       | -.14,-.14,0,1,1,0,-.14 v.43        | :elf secret-door East                     |           |
196 | | c-NS+sE  | c--NSE m-1,0 sE                    | North/South :elf secret-door East         |           |
197 | | c-NS+sEW | c--NSE m-1,0 sEW                   | North/South :elf secret-doors East/West   |           |
198 | | c-NS+sW  | c--NSE m-1,0 sW                    | North/South :elf secret-door West         |           |
199 | | c-EW+sN  | c--NEW m-1,0 sN                    | East/West :elf secret-door North          |           |
200 | | c-EW+sS  | c--SEW m-1,0 sS                    | East/west :elf secret-door South          |           |
201 | | sN       |                                    | South/East/West                           |           |
202 | | :default | h1                                 | :comment no extra doc by default          |           |
203 | | :elf     | -.14,-.14,0,1,1,-.14,0 h.43        | secret-door North :comment elves see this |           |
204 | | 10x10+SN | v1 h1 v-1                          | South/East/West                           |           |
205 | | :default | h1                                 | :comment no extra doc by default          |           |
206 | | :elf     | -.14,-.14,0,1,1,-.14,0 h.43        | secret-door North :comment elves see this |           |
207 | 
208 | TODO update docs to reflect using feature name + keyword selector and not leaving feature name blank
209 | TODO stub for scaling+placement; this should be uniform after dm-svg renders and
210 | TODO reorder clockwise NESW
211 | 
212 | ** Test Map
213 | :PROPERTIES:
214 | :NAME: regression-test-map-level
215 | :END:
216 | 
217 | #+NAME: regression-test-map-level
218 | 
219 | This is a sample map used to develop and test the above.
220 | 
221 |  For each cell:
222 | 
223 |  * If the cell contains a reference follow it
224 |  * With the cell referenced cell content giving X,Y and FEATURES:
225 |    * Setting absolute position to given X,Y
226 |    * Draw FEATURES sequentially
227 |  * Add cell to list of "seen" cells.
228 | 
229 | NOTE: features must cooperate in terms of assumptions in terms of
230 | relative position except for the first named feature.  No movement or
231 | other instructions are added to the path between Features in the same
232 | cell.
233 | 
234 | NOTE: This approach may only work when drawing the whole map.
235 | 
236 | TODO: write test, harness and document here
237 | 
238 | | X | Y | Features       | Documentation                   | Narrative |
239 | |---+---+----------------+---------------------------------+-----------|
240 | | 0 | 0 | m1,0 h-1 v1 h1 | 20x20 area with two exits west. |           |
241 | | 3 | 0 | c-W            | Corridor ends.                  |           |
242 | | 3 | 1 | c-W            | Corridor ends.                  |           |
243 | 
244 | Which should produce something similar to the following:
245 | 
246 | #+begin_src emacs-lisp :tangle design_org--test.svg
247 |   (let ((svg (svg-create 400 400 :stroke-width 10)))
248 |     (dom-append-child svg
249 | 		      (dom-node 'path
250 | 				'((d . "h300,v200,h-300,v-200,m0,-100,v200")
251 | 				  (stroke . "black")
252 | 				  (stroke-weight . 3))))
253 |     ;;(svg-gradient svg "gradient1" 'linear '((0 . "red") (100 . "blue")))
254 |     ;;(svg-circle svg 200 200 100 :gradient "gradient1" :stroke-color "green")
255 |     (with-temp-buffer
256 |       (svg-print svg)
257 |       (buffer-string)))
258 | #+end_src
259 | 
260 | #+RESULTS:
261 | :  
262 | 
263 | #+begin_src text
264 |   +-------+
265 |   |       |
266 |   |  A  --|
267 |   |       |
268 |   +-------+
269 | #+end_src
270 | 
271 | * LICENSE
272 | 
273 | This program is free software; you can redistribute it and/or modify
274 | it under the terms of the GNU General Public License as published by
275 | the Free Software Foundation, either version 3 of the License, or
276 | (at your option) any later version.
277 | 
278 | This program is distributed in the hope that it will be useful,
279 | but WITHOUT ANY WARRANTY; without even the implied warranty of
280 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
281 | GNU General Public License for more details.
282 | 
283 | You should have received a copy of the GNU General Public License
284 | along with this program.  If not, see .
285 | 


--------------------------------------------------------------------------------