forked from StrmSrfr/mum
/
player.lisp
45 lines (40 loc) · 1.17 KB
/
player.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
;;;; player.lisp
(in-package #:mum)
(defclass player (damage-mixin icon-mixin)
(;name inherited from icon-mixin
(icon; inherited from icon-mixin
:accessor icon
:initarg :icon
:initform +player-icon+)
(coordinates; inherited from position-mixin
:initform (list (1+ (random 79)) (1+ (random 23)) 0))
(prompt
:accessor prompt
:initarg :prompt
:initform nil
:type list
:documentation "The current prompt (if any). TODO: this better")
(weapons
:accessor weapons
:initarg :weapons
:initform (list (make-instance 'puny-fists))
:type list)
(level
:accessor level
:initarg :level
:initform 1
:type integer)
(turns
:accessor turns
:initarg :turns
:initform nil
:type list
:documentation "Turns this player hasn't seen yet. The last turn in
the list is the turn currently being taken.")))
(defmethod print-object ((player player) stream)
(print-unreadable-object (player stream :type t :identity t)
(format stream "~S" (name player))))
(defmethod clock ((player player))
(clock (first (last (turns player)))))
(defmethod arena ((player player))
(arena (first (last (turns player)))))