3 (defgeneric create-entity (m))
8 :documentation "name of the model, it will be transfered to the entity when generated"
11 (properties :accessor properties
13 :documentation "an a-list of the properties of the entity"
17 :documentation "the size of a model, it will be calculated with the grid for the dimension in board"
20 (interactions :initform '(pokep)
21 :accessor interactions
22 :documentation "interactions are function the entity can use, these are
23 associated with some property"
24 :initarg :interactions)
27 (defmethod create-entity ((m model))
28 "create an entity from the standard model"
29 (let* ((return-entity m))
30 (make-instance 'entity
32 :propreties (propreties m)
34 :interactions (interactions m))))
36 ;; the dice set, this has many uses, it is called by
37 ;; interactions when actions are done, it is called
38 ;; on entity creation for life randomization (the
39 ;; create-entity function eval the supplied data)
40 (defun dice (dice-type number-dices &key (plus 0))
41 "throw the dice-type n times based on number-dices"
42 (+ 1 plus (loop :for i :from 1 :to number-dices
43 :sum (random dice-type))))
45 (defun d4 (number-dices &key (plus 0))
46 "shortcut for the dice function with d4"
47 (dice 4 number-dices :plus plus))
48 (defun d6 (number-dices &key (plus 0))
49 "shortcut for the dice function with d6"
50 (dice 6 number-dices :plus plus))
51 (defun d8 (number-dices &key (plus 0))
52 "shortcut for the dice function with d8"
53 (dice 8 number-dices :plus plus))
54 (defun d10 (number-dices &key (plus 0))
55 "shortcut for the dice function with d10"
56 (dice 10 number-dices :plus plus))
57 (defun d12 (number-dices &key (plus 0))
58 "shortcut for the dice function with d12"
59 (dice 12 number-dices :plus plus))
60 (defun d20 (number-dices &key (plus 0))
61 "shortcut for the dice function with d20"
62 (dice 20 number-dices :plus plus))
63 (defun d100 (number-dices &key (plus 0))
64 "shortcut for the dice function with d100"
65 (dice 100 number-dices :plus plus))
67 (defun dice-from-list (list-dices &key (plus 0))
68 "throw and sums all the dices from a list, the plus modificator
69 is added once at the end of the sum (Xd4+Yd6+Zd8+...+p)"
70 (+ 1 plus (loop :for i :in list-dices