OSDN Git Service

9394540f7d11f4b6533568e2a674a744432f3eef
[nazghul-jp/nazghul-jp.git] / worlds / haxima-1.002 / alchemist.scm
1 ;;----------------------------------------------------------------------------
2 ;; The Alchemist is numbered among the Wise, but he's not a very nice person.
3 ;; He's very clever, very greedy and likes to trick people. He is also very
4 ;; knowledgeable. He knows there is a rune buried in trigrave, and that the
5 ;; enchanter knows what the runes are for. He also knows that one of then
6 ;; entrances to the MAN's hideout is in the northwest.
7 ;;
8 ;; The Alchemist would be very happy to obtain the blood of a hydra, dragon and
9 ;; lich. He will also teach the player how to make potions for gold?
10 ;;----------------------------------------------------------------------------
11 ;;----------------------------------------------------------------------------
12 ;; Constants
13 ;;----------------------------------------------------------------------------
14
15 ;;----------------------------------------------------------------------------
16 ;; Schedule
17 ;; 
18 ;; In Oparine
19 ;;----------------------------------------------------------------------------
20 (kern-mk-sched 'sch_alch
21                (list 0   0  alkemist-shop "idle")
22                (list 2   0  alkemist-bed  "sleeping")
23                (list 8   0  bilge-water-seat-9   "eating")
24                (list 9   0  alkemist-shop "working")
25                (list 12  0  bilge-water-seat-9 "eating")
26                (list 13  0  alkemist-shop "working")
27                (list 17  0  bilge-water-seat-9 "eating")
28                (list 18  0  bilge-water-hall "idle")
29                (list 19  0  sea-witch-shop   "idle")
30                (list 20  0  alkemist-shop "idle")
31                )
32
33 ;;----------------------------------------------------------------------------
34 ;; Gob
35 ;;
36 ;; Quest flags, etc, go here.
37 ;;----------------------------------------------------------------------------
38 (define (alch-mk)
39         (list
40         (mk-quest) ;; dragon
41         #f ;; lich
42         #f ;; hydra
43         ))
44
45
46 (define (alchq-dragon gob) (car gob))
47 (define (alchq-lich? gob) (cadr gob))
48 (define (alchq-hydra? gob) (caddr gob))
49 (define (alchq-lich! gob val) (set-car! (cdr gob) val))
50 (define (alchq-hydra! gob val) (set-car! (cddr gob) val))
51
52 ;;----------------------------------------------------------------------------
53 ;; Conv
54 ;;----------------------------------------------------------------------------
55
56 (define alch-catalog
57   (list
58    (list t_heal_potion             18 "When you run out of Mani or mana in the pitch of battle, these will save your life!")
59    (list t_cure_potion             18 "An Nox may be cheaper, but nothing works better than my cure potions!")
60    (list t_mana_potion             18 "No other potions rejuvenate your mana like mine do!")
61    
62    (list t_poison_immunity_potion  18 "Prevention is better than a cure! With my immunity potions you need never fear poison again!")
63    (list t_invisibility_potion    100 "One quaff of this and your enemies will never find you!")
64    (list t_str_potion             999 "The strength of a troll will be yours with this potion!" )  ;; limited stock would be nice...
65    (list t_dex_potion             999 "Your arrows will fly straight as truth when you drink this potion!")  ;; limited stock would be nice...
66    (list t_int_potion             999 "The wise man seeks more wisdom! With this potion, it can be yours for a very reasonable price!")  ;; limited stock would be nice...
67    (list t_info_potion            150 "The sage said to 'Know thyself'. This potion will help!")
68    
69    (list t_oil                      6 "Hurl fire at your foes! Protect your flanks or cover your retreat with flaming fields of death!")
70    (list t_slime_vial              25 "More fun than a barrel of monkeys! Confound your foes with a multiplying army of slimes!")
71    ))
72
73 (define alch-merch-msgs
74   (list "I'm afraid my shop is closed now. Come by between 9:00AM to 5:00PM."
75         "I'm sure I have something you'll like! [He rubs his hands briskly]"
76         "I sometimes buy used goods... at a discount of course."
77         "Yes, let's get down to business!"
78         "You'll be back for more when you see for yourself how good my potions are!"
79         "I hope you don't regret passing up these fine potions."
80         "I can probably find some use for these."
81         "I doubt you'll find a better offer anywhere else."
82         "A pleasure doing business with you!"
83         "Perhaps next time."
84         ))
85
86 ;; Basics...
87 (define (alch-hail knpc kpc)
88   (say knpc "[You meet a short, fat old man with a long nose] "
89        "Hello and welcome, Traveler!"))
90
91 (define (alch-default knpc kpc)
92   (say knpc "I'm afraid I can't help you with that."))
93
94 (define (alch-name knpc kpc)
95   (say knpc "I'm known as the Alchemist.")
96   (quest-data-update 'questentry-alchemist 'found 1)
97   (quest-data-complete 'questentry-alchemist)
98   )
99
100 (define (alch-join knpc kpc)
101   (say knpc "Too busy! And far too old for adventures."))
102
103 (define (alch-job knpc kpc)
104   (say knpc "I make potions, dabble in mysteries, that sort of thing. "
105        "If you want to buy something just say so!"))
106
107 (define (alch-bye knpc kpc)
108   (say knpc "Farewell! Come back again soon!"))
109
110 ;; Trade...
111 (define (alch-trade knpc kpc) (conv-trade knpc kpc "trade" alch-merch-msgs alch-catalog))
112 (define (alch-buy knpc kpc) (conv-trade knpc kpc "buy" alch-merch-msgs alch-catalog))
113 (define (alch-sell knpc kpc) (conv-trade knpc kpc "sell" alch-merch-msgs alch-catalog))
114
115 ;; Rune...
116 ;; offered: shown k rune
117 ;; accepted: sent to find p rune
118 ;; done: known to have found p rune
119 (define (alch-dragon-reward knpc kpc)
120   (say knpc "Oh, yes, the rune...")
121         (prompt-for-key)
122   (say knpc
123            "The paladins have built several fortifications in the "
124            "deeps of Kurpolis. One of the runes was buried in the "
125            "foundations of the deepest fort.")
126         (prompt-for-key)
127   (say knpc
128            "A pick and shovel may be enough to get it out again, "
129            "but it might be difficult with a dozen paladins breathing "
130            "down your neck.")
131            (quest-data-assign-once 'questentry-rune-p)
132            (quest-rune-p-update)
133            )
134            
135 (define (alch-dragon-done knpc kpc)
136   (say knpc "I am afraid I dont know the locations of the other "
137                                         "runes. Try asking the rest of the Wise."))
138                 
139 (define (alch-dragon-quest knpc kpc qstat)
140         (if (kern-conv-get-yes-no? kpc)
141                 (cond
142                         ((quest-done? qstat)
143                                 (alch-dragon-done knpc kpc)
144                                 )
145                         ((in-inventory? kpc t_rune_p)
146                                 (quest-done! qstat #t)
147                                 (say knpc "I see you have collected the Rune of Power.")
148                                 (alch-dragon-done knpc kpc)
149                                 )
150                         ((quest-accepted? qstat)
151                                 (alch-dragon-reward knpc kpc qstat)
152                                 )
153                         ((in-inventory? kpc t_dragons_blood 1)
154                           (begin
155                                 (say knpc "I know where ones is buried, "
156                                          "and I'll tell you in exchange for that vial of "
157                                          "dragon's blood you're carrying. Deal?")
158                                 (if (kern-conv-get-yes-no? kpc)
159                                         (begin
160                                                   (quest-accepted! qstat #t)
161                                                   (kern-obj-remove-from-inventory kpc 
162                                                                                                                   t_dragons_blood 
163                                                                                                                   1)
164                                                   (kern-obj-add-to-inventory knpc
165                                                                                                          t_dragons_blood
166                                                                                                          1)
167                                                   (say knpc "[He eyes the vial hungrily] "
168                                                            "Yes! It's just what I need!")
169                                                         (quest-data-update 'questentry-dragon 'done 1)
170                                                         (quest-data-complete 'questentry-dragon)
171                                                         (quest-data-assign-once 'questentry-dragon)
172                                                   (alch-dragon-reward knpc kpc))
173                                         (begin
174                                                 (say knpc "Well, I suppose if you dig up the "
175                                                 "whole Shard you'll someday find it without "
176                                                 "my help. Good luck!")
177                                                 (quest-data-assign-once 'questentry-dragon)
178                                         ))
179                                 ))
180                         (#t
181                                 (say knpc "Then perhaps we can exchange favors. "
182                                    "I happen to know where one of these runes "
183                                    "is buried. I'll tell you its location if you "
184                                    "bring me a vial of dragon's blood. ")
185                                 (quest-data-assign-once 'questentry-dragon)))
186                 (say knpc "Well, if you are, I happen to know where one is "
187                    "hidden.")))
188
189 (define (alch-more knpc kpc)
190         (let ((qstat (alchq-dragon (gob knpc))))
191                 (say knpc "Abe knows more about the runes themselves. Are you "
192                         "interested in finding the others?")
193                 (quest-data-update-with 'questentry-runeinfo 'abe 1 (quest-notify nil))
194                 (alch-dragon-quest knpc kpc qstat)
195         ))
196                    
197 (define (alch-rune knpc kpc)
198         (if (not (null? (quest-data-getvalue 'questentry-dragon 'rerune)))
199                 (alch-more knpc kpc)
200                 (begin
201                         (say knpc "[He gets a canny look] Runes, eh? I've seen a few in my time. "
202                            "Have you one to look at?")
203                         (if (kern-conv-get-yes-no? kpc)
204                                 (if (in-inventory? kpc t_rune_k 1)
205                                         (begin
206                                           (say knpc "Yes, I see. This once belonged to the Enchanter, "
207                                                    "I believe. I hope you didn't steal it! "
208                                                    "I have seen several more like it, "
209                                                    "but the person you really should speak to "
210                                                    "is Abe.")
211                                                         (quest-data-update 'questentry-dragon 'rerune 1)
212                                                    (quest-data-update-with 'questentry-runeinfo 'abe 1 (quest-notify nil))
213                                           )
214                                         (say knpc "I don't see it. Perhaps you dropped it?"))
215                                 (say knpc "I might be able to help if you could show me.")))
216                 ))
217
218 (define (alch-abe knpc kpc)
219   (say knpc "An old acquaintance of mine. "
220        "Last I heard he was studying the ruins at Green Tower."))
221
222 (define (alch-drag knpc kpc)
223   (say knpc "I've never done it personally, but if one wants to obtain some "
224        "dragon's blood my understanding is that one must kill a dragon! "
225        "I hear they're common as cows in the regions of the Fire Sea."
226                         )
227         (quest-data-update-with 'questentry-dragon 'sea 1 (quest-notify nil)))
228
229
230 ;; The Wise...
231 (define (alch-necr knpc kpc)
232   (say knpc "The Necromancer is an old acquaintance of mine. "
233        "Since the razing of Absalot he's retired to the underworld. "
234        "'Tis a pity, but we've lost touch."))
235
236 (define (alch-ench knpc kpc)
237   (say knpc "The Enchanter is a great and knowledgable Wizard. "
238        "I'm afraid we don't always see eye-to-eye. "
239        "Lately he's been pre-occupied with the Accursed."
240        ))
241
242 (define (alch-man-reward knpc kpc)
243         (say knpc "In the mountains of "
244            "the northeast, along their southern face, "
245            "there is a secret passage. It is near coordinates "
246            "[92 10]."))
247
248 (define (alch-man knpc kpc)
249   (let ((qstat (gob knpc)))
250           (say knpc "I've never met the MAN. "
251                    "Being the most accomplished of Wrogues, "
252                    "he probably has a fortune stashed in his hideout. "
253                    "If I were the adventurous type I might go seek it out myself. "
254                    "What about you?")
255           (if (kern-conv-get-yes-no? kpc)
256                 (cond
257                         ((alchq-hydra? qstat)
258                                 (say knpc "I've heard, from a reliable source, of an entrance "
259                                         "to the MAN's secret hideout.")
260                                 (alch-man-reward knpc kpc))
261                         ((in-inventory? kpc t_hydras_blood 1)
262                                 (begin
263                                         (say knpc "I've heard, from a reliable source, of an entrance "
264                                                 "to the MAN's secret hideout. I'll tell you in exchange "
265                                                 "for that vial of hydra's blood in your pack. Yes?")
266                                         (if (kern-conv-get-yes-no? kpc)
267                                                 (begin
268                                                         (alchq-hydra! qstat #t)
269                                                         (kern-obj-remove-from-inventory kpc 
270                                                                 t_hydras_blood 
271                                                                 1)
272                                                         (kern-obj-add-to-inventory knpc
273                                                                 t_hydras_blood
274                                                                 1)
275                                                         (say knpc "[He fairly drools over the noxious stuff] "
276                                                                 "Oh, lovely... lovely!")
277                                                         (say knpc "Ahem.")
278                                                         (alch-man-reward knpc kpc))
279                                                 (say knpc "'Tis a pity. You have no use for the "
280                                                         "vial, and I am too old to go treasure-hunting."))))
281                         (#t 
282                                 (say knpc "Well, I do hear many things, many of which are only "
283                                         "rumour. But a reliable source has told me of where to find "
284                                         "an entrance to the MAN's hideout. If you bring me a vial of "
285                                         "hydra's blood I'll disclose it to you.")))
286            (say knpc "For fie, Wanderer! "
287                         "I thought you were the adventurous type."))))
288
289 (define (alch-hydr knpc kpc)
290   (say knpc "The hydra is a most difficult foe. "
291        "I understand that striking them only increases their strength! "
292        "But if you do succeed in killing one their blood is quite useful "
293        "to the arcane arts."))
294
295 (define (alch-warr knpc kpc)
296   (say knpc "On a few occasions I have met the Warritrix. "
297        "Her ferocity is legendary, "
298        "but I found her to be very calm and gracious in her demeanor. "
299        "I understand she refused to take part in the destruction of "
300        "Absalot."))
301
302 (define (alch-engi knpc kpc)
303   (say knpc "I've never met the Engineer, "
304        "I understand he is quite the recluse."))
305
306 (define (alch-alch knpc kpc)
307   (say knpc "Yes, that's me. I am the Alchemist.")
308   (quest-data-update 'questentry-alchemist 'found 1)
309   (quest-data-complete 'questentry-alchemist)
310   )
311
312
313 ;; Absalot...
314 (define (alch-absa-reward knpc kpc)
315         (say knpc "There was a fortress overlooking a river of fire. "
316                  "Pity it wasn't manned, it might have turned Glasdrin's invasion. "
317                  "It will make a perilous crossing if monsters have taken it over.")
318         (prompt-for-key)
319         (say knpc 
320                  "There is, however, an older route that bypasses the fortress. "
321                  "Probe the east wall of the first cavern, "
322                  "you will find a hidden passage.")
323         (prompt-for-key)
324         (say knpc
325                  "You will still need to cross the river of fire. "
326                  "There is a statue upon the river. Speak the password 'ONUS' to pass unharmed. "
327                  "Write that password down!")
328         (prompt-for-key)
329         (say knpc
330                  "The passage rejoins the main route near the stairway which leads up to "
331                  "the lost city. You won't escape all the hazards of the journey, "
332                  "but it should make your life somewhat easier."))
333
334 (define (alch-absa knpc kpc)
335   (let ((qstat (gob knpc)))
336     (say knpc "The passage to Absalot was always dangerous even when it was maintained. "
337          "You wouldn't happen to be thinking of going there?")
338     (if (kern-conv-get-yes-no? kpc)
339         (cond
340          ((alchq-lich? qstat)
341           (alch-absa-reward knpc kpc))
342          ((in-inventory? kpc t_lichs_blood 1)
343           (say knpc "In exchange for that vial of lich's blood I'd be "
344                "happy to tell you of a back door. What do you say?")
345           (if (kern-conv-get-yes-no? kpc)
346               (begin
347                 (alchq-lich! qstat #t)
348                 (kern-obj-remove-from-inventory kpc 
349                                                 t_lichs_blood 
350                                                 1)
351                 (kern-obj-add-to-inventory knpc
352                                            t_lichs_blood
353                                            1)
354                 (say knpc "[He grins and winks] Just the stuff I need!")
355                 (alch-absa-reward knpc kpc))
356               (say knpc "I see. No doubt you have IMPORTANT plans for "
357                    "that lich's blood. I can always get some from "
358                    "another adventurer.")))
359          (else
360           (say knpc "Bring me a vial of lich's blood and I'll tell you "
361                "a secret way.")))
362         (say knpc "It's just a ruin now anyways. Everything was destroyed "
363              "when it was sacked."))))
364
365 (define (alch-sack knpc kpc)
366   (say knpc "Oh yes, didn't you know? Absalot was sacked by the armies "
367        "of Glasdrin, Green Tower and Oparine. Destroyed for its wickedness, "
368        "they say. [He chuckles without humour]"))
369
370 (define (alch-esca knpc kpc)
371   (say knpc "Er... did I say that? I can't imagine why. Anyone who escaped "
372        "from Absalot would have the death sentence on their head."))
373
374 (define (alch-wick knpc kpc)
375   (say knpc "Yes, Absalot was so wicked that every man, woman and child "
376        "who dwelt there had to be put to the sword. Lucky for us to have "
377        "paladins willing to carry out this righteous work! "
378        "[You detect a hint of irony in his raised eyebrows and innocent "
379        "expression]"))
380
381 (define (alch-lich knpc kpc)
382   (say knpc "A lich is an undead wizard. This foul thing corrupts all it "
383        "touches and commands armies of the dead. Its blood has many uses "
384        "in necromancy, which is not my specialty."))
385
386 ;; The Accursed...
387 (define (alch-accu knpc kpc)
388   (say knpc "The so-called Accursed are a secret society blamed for "
389        "many heinous deeds, but who can say how much of that is rumour?"))
390
391 ;; Townsfolk
392 (define (alch-lia knpc kpc)
393   (say knpc "A bewitching creature! "
394        "If I could, I would break her curse. In fact, I would do it for free. "
395        "Call me an old fool!"))
396
397 (define alch-conv
398   (ifc basic-conv
399        (method 'default alch-default)
400        (method 'hail alch-hail)
401        (method 'bye alch-bye) 
402        (method 'job alch-job)
403        (method 'name alch-name)
404        (method 'join alch-join)
405
406        (method 'trad alch-trade)
407        (method 'buy  alch-buy)
408        (method 'sell alch-sell)
409        (method 'poti alch-buy)
410
411        (method 'rune alch-rune)
412        (method 'more alch-more)
413        (method 'drag alch-drag)
414
415        (method 'necr alch-necr)
416        (method 'ench alch-ench)
417        (method 'man  alch-man)
418        (method 'hydr alch-hydr)
419        (method 'warr alch-warr)
420        (method 'engi alch-engi)
421        (method 'alch alch-alch)
422
423        (method 'absa alch-absa)
424        (method 'sack alch-sack)
425        (method 'esca alch-esca)
426        (method 'wick alch-wick)
427        (method 'lich alch-lich)
428
429        (method 'accu alch-accu)
430
431        (method 'lia alch-lia)
432        (method 'abe alch-abe)
433
434        ))
435
436 ;;----------------------------------------------------------------------------
437 ;; First-time constructor
438 ;;----------------------------------------------------------------------------
439 (define (mk-alchemist)
440   (bind 
441    (kern-char-arm-self
442     (kern-mk-char 
443      'ch_alchemist ;;.....tag
444      "Alchemist" ;;.......name
445      sp_human ;;.....species
446      oc_wright ;;...occupation
447      s_companion_tinker ;;......sprite
448      faction-men ;;..faction
449      0 ;;............custom strength modifier
450      4 ;;............custom intelligence modifier
451      1 ;;............custom dexterity modifier
452      0 ;;............custom base hp modifier
453      0 ;;............custom hp multiplier (per-level)
454      0 ;;............custom base mp modifier
455      0 ;;............custom mp multiplier (per-level)
456      max-health ;;..current hit points
457      -1  ;;...........current experience points
458      max-health ;;..current magic points
459      0
460      8  ;;..current level
461      #f ;;...........dead?
462      'alch-conv ;;...conversation (optional)
463      sch_alch ;;.....schedule (optional)
464      'townsman-ai ;;..........custom ai (optional)
465      nil ;;..........container (and contents)
466      (list t_dagger
467                                 t_armor_leather
468                                 )  ;;......... readied arms (in addition to the container contents)
469      nil ;;..........hooks in effect
470      ))
471    (alch-mk)))