1;;----------------------------------------------------------------------------
2;; Constants
3;;----------------------------------------------------------------------------
4(define necr-lvl 8)
5(define necr-species sp_human)
6(define necr-occ oc_wizard)
7
8;;----------------------------------------------------------------------------
9;; Schedule
10;;----------------------------------------------------------------------------
11(define necr-bed nl-bed)
12(define necr-mealplace nl-tbl)
13(define necr-workplace nl-lab)
14(define necr-leisureplace nl-lib)
15(kern-mk-sched 'sch_necr
16               (list 0  0 necr-bed          "sleeping")
17               (list 7  0 necr-mealplace    "eating")
18               (list 8  0 necr-workplace    "working")
19               (list 12 0 necr-mealplace    "eating")
20               (list 13 0 necr-workplace    "working")
21               (list 18 0 necr-mealplace    "eating")
22               (list 19 0 necr-leisureplace "idle")
23               (list 22 0 necr-bed          "sleeping")
24               )
25
26;;----------------------------------------------------------------------------
27;; Gob
28;;----------------------------------------------------------------------------
29(define (necr-mk)
30  (mk-quest))
31(define (necr-quest gob) gob)
32
33;;----------------------------------------------------------------------------
34;; Conv
35;;----------------------------------------------------------------------------
36
37;; Basics...
38(define (necr-hail knpc kpc)
39  (let ((quest (necr-quest (kobj-gob-data knpc))))
40    (if (and (quest-offered? quest)
41             (not (quest-done? quest))
42             (in-inventory? kpc t_lich_skull)
43             )
44        (necr-meet-lich knpc kpc)
45        (say knpc "[You meet a thin, pale wizard dressed all in black] "
46             "(COUGH) Hello, Wanderer."))))
47
48(define (necr-default knpc kpc)
49  (say knpc "[He is seized by a fit of coughing]"))
50
51(define (necr-heal knpc kpc)
52  (begin
53    (say knpc "\n[He is seized by a fit of coughing]\n"
54	 "I'm fine [COUGH] [WHEEZE]")
55    (prompt-for-key)
56
57    (say knpc "Really.\n")
58    (prompt-for-key)
59
60    (say knpc "\nI am quite wel...[COUGH]")
61    (prompt-for-key)
62
63    (say knpc "\n  [WHEEZE]...")
64    (prompt-for-key)
65
66    (say knpc "[CHOKE]")
67    (kern-sleep 100)
68    (say knpc "[the slight figure slumps]")
69    (kern-sleep 100)
70    (say knpc "[GASP]")
71    (kern-sleep 3000)
72    (say knpc " ...")
73    (prompt-for-key)
74
75    (say knpc "\n[All is silence]")
76    (prompt-for-key)
77
78    (if (in-player-party? 'ch_mesmeme)
79	(begin
80	  (say knpc "\n[The silence stretches on...]")
81	  (kern-sleep 3000)
82	  (aside kpc 'ch_mesmeme "[Looks at the slumped figure]\nFood now?")
83	  (aside kpc 'ch_amy "EEEWWW!  Bad Gazer!")
84	  (prompt-for-key)
85	  )
86	)
87
88    (if (in-player-party? 'ch_nate)
89	(begin
90	  (say knpc "\n[The dead sound of the crypt presses on]")
91	  (kern-sleep 3000)
92	  (aside kpc 'ch_nate "Erm...")
93	  (kern-sleep 100)
94	  (aside kpc 'ch_nate "  should we maybe...")
95	  (kern-sleep 1000)
96	  (aside kpc 'ch_nate "  take his stuff?")
97	  (kern-sleep 500)
98	  (aside kpc 'ch_roland "Nay!  'Twould be dishonour!")
99	  (prompt-for-key)
100	  )
101	)
102
103    (if (in-player-party? 'ch_amy)
104	(begin
105	  (aside kpc 'ch_amy "I could maybe...dig a hole, somewhere?")
106	  (prompt-for-key)
107	  )
108	)
109
110    (kern-sleep 3000)
111    (say knpc
112	 "\n[His still form twitches]\n"
113	 "[His arm gropes for his chest]\n"
114	 "  ^c+bIN VAS MANI CORP XEN^c-\n"
115	 "")
116    ;; (vas-mani knpc)  ;; SAM: Alas, this invoked UI, and emitted extra messages
117    (say knpc
118	 "\n[He straightens, and breathes deeply]\n"
119	 "As I was saying, I am quite well, thank you.")
120    ))
121
122(define (necr-name knpc kpc)
123  (say knpc "I am the Necromancer."))
124
125(define (necr-join knpc kpc)
126  (say knpc "I am not an adventurer."))
127
128(define (necr-job knpc kpc)
129  (say knpc "I investigate the secrets of the dead."))
130
131(define (necr-bye knpc kpc)
132  (say knpc "[He waves you off in a fit of coughing]"))
133
134;; L2
135(define (necr-dead knpc kpc)
136  (say knpc "Dead? No, not yet. You?")
137  (if (yes? knpc)
138      (say knpc "You look a bit firm for a spirit.")
139      (say knpc "I didn't think so, but I talk to so many spirits I can't "
140           "really tell any more.")))
141
142(define (necr-coug knpc kpc)
143  (say knpc "I smoked a pipe for years. Still do, sometimes."))
144
145(define (necr-spir knpc kpc)
146  (say knpc "Some spirits are so old they remember things before recorded "
147       "history. (COUGH) If you want to know something, there's a spirit "
148       "somewhere that knows it."))
149
150;; Quest-related
151(define (necr-meet-lich knpc kpc)
152  (if (quest-done? (necr-quest (kobj-gob-data knpc)))
153      (begin
154        (say knpc "Ask the spirit of King Luximene! Can't you see him?")
155        (if (no? kpc)
156            (begin
157              (say knpc "Oh, sorry. Let me fix that:\n"
158		   "[He intones words of magic]"
159		   "  ^c+bWIS QUAS^c-!")
160              (wis-quas knpc))
161            (say knpc "Well...")))
162      (begin
163        (say knpc "Ah! You have the skull of King Luximene! "
164             "No doubt there's a good story to go along with this, "
165             "but let's hear about that later. For now...")
166        (kern-obj-remove-from-inventory kpc t_lich_skull 1)
167        (say knpc "\n[He intones words of magic]\n"
168	     "  ^c+bKAL AN XEN CORP^c-!\n"
169	     "Luximene, come forth!")
170        (kern-obj-put-at (mk-luximene)
171                         (loc-offset (kern-obj-get-location knpc)
172                                     south))
173        (quest-done! (necr-quest (kobj-gob-data knpc)) #t)
174        (say knpc "There! Do you see him?")
175        (if (no? kpc)
176            (begin
177              (say knpc "Of course, his spirit is invisible to the uninitiated.\n"
178                   "Let me fix that:\n"
179		   "[He intones words of magic]"
180		   "  ^c+bWIS QUAS^c-!")
181              (wis-quas knpc))
182            (say knpc "Ask him of the rune now.")))))
183
184(define (necr-rune knpc kpc)
185  (let ((quest (necr-quest (kobj-gob-data knpc))))
186    (if (quest-offered? quest)
187        (if (in-inventory? kpc t_lich_skull)
188            (necr-meet-lich knpc kpc)
189            (if (quest-done? quest)
190                (begin
191                  (say knpc "Ask the spirit of King Luximene! Can't you see him?")
192                  (if (no? kpc)
193                      (begin
194                        (say knpc "Try a Reveal spell...\n"
195			     "[He intones words of magic]\n"
196			     "  ^c+bWIS QUAS^c-\n"
197			     "Speak to his shade, ask of the RUNE.")
198			(wis-quas knpc)
199			(kern-conv-end)
200			)
201                      (begin
202			(say knpc "Well then, ask his shade.")
203			(kern-conv-end)
204		      )
205		  ))
206                (say knpc "Bring me the skull of King Luximene the lich "
207                     "and we can learn more.")))
208        (if (not (any-in-inventory? kpc rune-types))
209            (say knpc "I've encountered many runes. (COUGH) Bring me an example "
210                 "of one and perhaps I can tell you of it.")
211            (begin
212              (say knpc "Hm. Yes. This rune reminds me of writings I once saw in "
213                   "the tomb of King Luximene. (COUGH) If I could speak to his "
214                   "spirit perhaps it would tell us more. Are you brave, Wanderer?")
215              (if (no? kpc)
216                  (say knpc "Me neither. More's the pity, for I am most curious "
217                       "now about this rune. (COUGH)")
218                  (begin
219                    (say knpc "I thought so. King Luximene is a lich nowadays. "
220                         "Most unruly! His tomb is in a crypt beneath Green Tower. "
221                         "If you bring me his skull I can tame his spirit and speak "
222                         "with him. (COUGH) You'll have to defeat him first, "
223                         "of course, as well as his undead army. "
224                         "Do you know how to repel the undead?")
225                    (quest-offered! quest #t)
226                    (if (yes? kpc)
227                        (say knpc "A most useful spell when dealing with the angry dead.")
228                        (say knpc "Learn ye [An Xen Corp].\n"
229			     "A most useful spell.\n"
230			     "Mix ^c+ggarlic^c- and ^c+gsulphurous ash^c-\n"
231			     "to make it.\n"
232                             "(COUGH)\n"
233			     "I probably have some "
234                             "around here.\n"
235			     "You may borrow it."))
236		    )))))))
237
238(define (necr-absa knpc kpc)
239  (say knpc "Ah, Absalot, ancient city of Wisdom, now fallen. "
240       "Have you been there?")
241  (if (yes? kpc)
242      (say knpc "It is only a shameful ruin now.")
243      (begin
244        (say knpc "Are you an ally of Glasdrin?")
245        (if (yes? kpc)
246            (say knpc "[He coughs and mutters] Well, "
247                 "there is nothing to see there now.")
248            (say knpc "There is a secret way in. Ask the Alchemist, he knows.")))))
249
250;; the wise
251(define (necr-ench knpc kpc)
252  (say knpc "The old fool thinks me one of the Accursed! "
253       "He does not understand that his ways are not the only ways.")
254       )
255
256(define (necr-man knpc kpc)
257  (say knpc "She comes to me sometimes when she needs information... "
258       "and in return she sometimes... acquires things for me.")
259  (quest-data-update 'questentry-the-man 'common 1)
260  )
261
262(define (necr-alch knpc kpc)
263  (say knpc "A clever man. A deep man, good in his own way.")
264  (quest-data-update 'questentry-alchemist 'common 1)
265  )
266
267(define (necr-engi knpc kpc)
268  (say knpc "Smart fellow, and very curious, "
269       "but always has to be making something. "
270       "And as soon as he's done, he starts on another! "
271       "(COUGH) Never time to reflect on anything worthy.")
272       (quest-data-update 'questentry-engineer 'common 1)
273       )
274
275(define (necr-warr knpc kpc)
276	(if (quest-data-assigned? 'questentry-wise)
277		(begin
278		  (say knpc "Alas, she is fallen. I have met her spirit in the void. "
279		       "She was betrayed by the leadership of Glasdrin. "
280		       "Would that the gods had not abandoned us, "
281		       "and Vale, lord of vengeance, still stalked the Shard!")
282		       (quest-data-update 'questentry-warritrix 'slain 1)
283		 )
284		 (say knpc "The hasn't been another knight so noble and so strong in "
285		 "a long, long time.")
286       ))
287
288(define (necr-vale knpc kpc)
289  (say knpc "An ancient god, known only to the dead now."))
290
291(define (necr-wise knpc kpc)
292  (say knpc "It is an ancient and worthy tradition that those "
293       "who have mastered the ways of Warrior, Wizard, Wright "
294       "and Wrogue should influence the affairs of the Shard. "
295       "Long is the chain of that tradition, "
296       "back to the oldest spirits in the void."))
297
298(define (necr-accu knpc kpc)
299  (say knpc "They are a wretched abomination! (COUGH) Their order "
300       "began about 500 years ago, or at least those are the oldest "
301       "spirits that speak of them. But I do not know their secrets "
302       "because their spirits do not return to the void!")
303  (prompt-for-key)
304  (say knpc "[He looks troubled] "
305       "I cannot find any among the dead who were Accursed in life. "
306       "It is a most disturbing conundrum."))
307
308(define (necr-gate knpc kpc)
309  (say knpc "Ah, the fabled Demon Gate. I thought it was only a legend. "
310       "Ask the Enchanter, he surely knows more of it than I. "
311       "Meanwhile I will confer with the dead to see what I can discover."))
312
313(define (necr-necr knpc kpc)
314  (say knpc "[Cough] I specialize in magic relating to the dead."))
315
316(define necr-conv
317  (ifc basic-conv
318
319       ;; basics
320       (method 'default necr-default)
321       (method 'hail necr-hail)
322       (method 'bye necr-bye)
323       (method 'job necr-job)
324       (method 'name necr-name)
325       (method 'join necr-join)
326       (method 'heal necr-heal)
327
328       (method 'dead necr-dead)
329       (method 'coug necr-coug)
330       (method 'spir necr-spir)
331       (method 'rune necr-rune)
332       (method 'absa necr-absa)
333       (method 'ench necr-ench)
334       (method 'man necr-man)
335       (method 'alch necr-alch)
336       (method 'engi necr-engi)
337       (method 'warr necr-warr)
338       (method 'vale necr-vale)
339       (method 'wise necr-wise)
340       (method 'accu necr-accu)
341       (method 'gate necr-gate)
342       (method 'demo necr-gate)
343       (method 'necr necr-necr)
344       ))
345
346(define (mk-necromancer)
347  (bind
348   (kern-mk-char
349    'ch_necr           ; tag
350    "Necromancer"    ; name
351    necr-species         ; species
352    necr-occ              ; occ
353    s_necromancer     ; sprite
354    faction-men      ; starting alignment
355    1 6 0            ; str/int/dex
356    0 0              ; hp mod/mult
357    0 0              ; mp mod/mult
358    max-health ; hp
359    -1                   ; xp
360    max-health ; mp
361    0
362    necr-lvl
363    #f               ; dead
364    'necr-conv         ; conv
365    sch_necr         ; sched
366    'townsman-ai              ; special ai
367    nil              ; container
368    (list t_staff)              ; readied
369    )
370   (necr-mk)))
371