-
Notifications
You must be signed in to change notification settings - Fork 1
/
alistair.lisp
148 lines (120 loc) · 4.29 KB
/
alistair.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
133
134
135
136
137
138
139
140
141
142
143
(in-package :cypress)
(defthing (alistair monk)
:met-player nil
:next-target nil
:given-letter nil
:description "Alistair")
(defparameter *alistair-walk*
'(:repeat t
:scale 1080
:frames (("alistair-walk-1.png" 4)
("alistair-walk-2.png" 4)
("alistair-walk-3.png" 4)
("alistair-walk-4.png" 4))))
(defmethod walking-animation ((self alistair))
*alistair-walk*)
(defparameter *alistair-stand*
'(:scale 1080
:frames (("alistair-stand-1.png" 19)
("alistair-stand-2.png" 16)
("alistair-stand-3.png" 24))))
(defmethod standing-animation ((self alistair))
*alistair-stand*)
(defparameter *alistair-cast*
'(:scale 1080
:frames (("alistair-stand-1.png" 19)
("alistair-stand-2.png" 16)
("alistair-stand-3.png" 24))))
(defmethod casting-animation ((self alistair))
*alistair-cast*)
(defmethod choose-target ((self alistair))
(setf (field-value :next-target self)
(let ((targets (find-instances (current-scene) 'ruined-book)))
(when targets (random-choose targets)))))
(defmethod run ((self alistair))
(with-fields (next-target given-letter met-player gump waypoints) self
(call-next-method)
(choose-target self)
(let ((distance (distance-to-cursor self)))
(cond
((or given-letter gump (<= distance 200))
(setf waypoints nil))
((and (< distance 220) (> distance 200))
(show-hint "Double-click Alistair to talk.")
(walk-to-thing self (geoffrey)))
(t (percent-of-time 4 (walk-to-thing self next-target)))))))
(defmethod activate ((self alistair))
(destroy-gump self)
(setf (field-value :gump self) nil)
(play-talk-sound self)
(with-fields (met-player given-letter) self
(if (not met-player)
(progn (setf met-player t)
(discuss self :hello))
(if given-letter
(discuss self :busy)
(discuss self :hello)))))
(define-topic hello alistair
"Greetings!" :name)
(define-topic name alistair
"I am Alistair, a mechanical monk imbued
with Spirit. A Spirit I must work hard
to maintain, seeing as my creators are
long-gone, and my fellow mecha-monks are
all so busy studying in other caves."
:mecha :creators)
(defmethod discuss :after ((alistair alistair) (topic (eql :name)))
(setf (field-value :met-player alistair) t))
(define-topic mecha alistair
"The crafting and animation of
mechanical men came from the alliance of
the Black Wizards and the
Industrialists, ages ago. While the
Empire used such mecha for violence and
domination, we mecha-monks of the
Quinian Order are sworn to preserve the
knowledge of the peaceful Ages in the
recesses of our clock-work minds. And of
course, in the books you see around here
everywhere. I'm always re-organizing
them!" :quine :wizards :creators)
(define-topic wizards alistair
"You shall undoubtedly encounter the
lying Black Wizards on your journey. You
cannot trust them! While I cannot jump
ahead of the tale for Quine's sake, I
must warn you of at least that." :quine :creators :mecha)
(define-topic creators alistair
"Oh, that's a tricky one. I'll let
Quine's letter explain the situation.
As I said---I'm not allowed to jump
ahead of the tale." :quine :wizards :mecha)
(define-topic quine alistair
"I hold here a letter for Geoffrey of
Valisade, from the famous Dr. Quine
himself! To be delivered upon his
arrival through the gate of the Southern
Cave." :letter)
(define-topic letter alistair
"Here's the letter.
I will also bestow upon you the language
of the Ancients, by means of their Spell
of Translation. If you focus the mind by
means of this spell, you will be able to
read the ancient's writings for a short
time.
And that finishes my duties for now. I'm
quite busy, actually, organizing all
these books. So.. umm...." :bye :talk-more)
(defmethod discuss :after ((alistair alistair) (topic (eql :letter)))
(when (not (field-value :given-letter alistair))
(drop alistair (make-scroll "Letter from Dr. Quine" *first-quine-letter* *after-quine-letter*)
(units 3) (units 3))
(learn-spell (geoffrey) (new 'translation))
(set-objective "Find the Screech Owl in the forests to the North.")
(setf (field-value :given-letter alistair) t)))
(define-topic talk-more alistair
"Very well, what would you like to talk
about?" :mecha :creators :wizards :quine :bye)
(define-topic busy alistair
"I'm very busy! I don't have time to talk." :bye :talk-more)