OSDN Git Service

f7e4eb52f7ea5b2673ca5c121030ff0ed118e95d
[nazghul-jp/nazghul-jp.git] / worlds / haxima-1.002 / shroom.scm
1 ;; shroom.scm - an old hag with an interesting history who lives in the
2 ;; northeast corner of green tower.
3
4 ;;----------------------------------------------------------------------------
5 ;; Schedule
6 ;; 
7 ;; In Green Tower.
8 ;;----------------------------------------------------------------------------
9 (define (mk-zone x y w h) (list 'p_green_tower x y w h))
10 (kern-mk-sched 'sch_shroom
11                (list 0  0  (mk-zone 51 9  1  1)  "sleeping")
12                (list 5  0  (mk-zone 40 11 3  3)  "idle")
13                (list 6  0  (mk-zone 49 6  7  1)  "working")
14                (list 12 0  (mk-zone 50 9  1  1)  "eating")
15                (list 13 0  (mk-zone 49 6  7  1)  "working")
16                (list 18 0  (mk-zone 56 54 1  1)  "eating")
17                (list 19 0  (mk-zone 53 50 4  7)  "idle")
18                (list 21 0  (mk-zone 51 9  1  1)  "sleeping"))
19
20 ;;----------------------------------------------------------------------------
21 ;; Gob
22 ;;----------------------------------------------------------------------------
23 (define (shroom-mk gave-quest? finished-quest?) (list gave-quest? 
24                                                       finished-quest?))
25 (define (shroom-gave-quest? shroom) (car shroom))
26 (define (shroom-quest-done? shroom) (cadr shroom))
27 (define (shroom-give-quest shroom) (set-car! shroom #t))
28 (define (shroom-set-quest-done! shroom) (set-car! (cdr shroom) #t))
29
30 ;;----------------------------------------------------------------------------
31 ;; Conv
32 ;; 
33 ;; Shroom is a female hedge-witch, who sells reagents and potions 
34 ;; in Green Tower.  She was once a battle-maiden fighting for 
35 ;; the forces of King Clovis in the Goblin Wars.
36 ;;----------------------------------------------------------------------------
37
38 (define shroom-merch-msgs
39   (list "Yes, I trade in mushrooms and the like. Come by my shop in the northeast corner when I'm open."
40         "I know where to find the best in the forest."
41         "If you have something worthwhile perhaps I may be interested."
42         "I have mushrooms and other reagents to trade. Would you care to buy or sell?"
43         "Be careful with those."
44         "Don't try to pick your own. Kill you, the bad ones will!"
45         "Come back when you have more to sell."
46         "Have it your way."
47         "That was a pleasant little bit of business."
48         "I see. Perhaps you'd rather just chat with an old woman."
49    ))
50
51 (define shroom-catalog
52   (list
53    (list sulphorous_ash (*  2 reagent-price-mult) "I have to travel far into the hills to find these foul-smelling clods.")
54    (list garlic         (*  3 reagent-price-mult) "This comes from my own garden. The cook in Bole loves my garlic.")
55    (list ginseng        (*  3 reagent-price-mult) "The forest folk have shown me where to gather wild ginseng.")
56    (list blood_moss     (*  4 reagent-price-mult) "The rare blood moss grows on dead wood in the deep forest.")
57    (list spider_silk    (*  5 reagent-price-mult) "Spider silk is common enough, but dangerous to gather.")
58    (list nightshade     (* 10 reagent-price-mult) "I must search near the rivers of the south to find the deadly nightshade.")
59    (list mandrake       (*  8 reagent-price-mult) "The mandrake root grows wild in these woods, but few know where to find it!")
60    
61    (list t_heal_potion  20 "Most dangerous, the woods are. Take some of these in case you have an accident.")
62    (list t_mana_potion  20 "One of these will refresh me enough to cast a light spell on the way home from a long day of picking.")
63    (list t_cure_potion  20 "If you're careless enough to get poisoned this will cure you.")
64    (list t_poison_immunity_potion 20 "I always drink one of these before gathering reagents in noxious bogs.")
65    (list t_slime_vial   20 "Lazy adventurers like these, so I carry them. As if there aren't enough slimes in the world.")
66    ))
67
68 ;; Shroom's merchant procedure
69 (define (shroom-trade knpc kpc) (conv-trade knpc kpc "trade" shroom-merch-msgs shroom-catalog))
70
71 ;; Shroom's mushroom quest
72 (define (shroom-wards knpc kpc)
73   (let ((shroom (kobj-gob-data knpc)))
74     (if (shroom-gave-quest? shroom)
75         ;; gave quest
76         (if (shroom-quest-done? shroom)
77             ;; quest already done
78             (say knpc "I've forgotten all the others.")
79             ;; quest NOT yet done
80             (begin
81               (say knpc "Bring me the mushrooms and I will teach ye the ward "
82                    "of fire. "
83                    "Do ye remember where they are?")
84               (if (kern-conv-get-yes-no? kpc)
85                   (say knpc "Well...")
86                   (say knpc "[sigh] Perhaps ye should write this down. "
87                        "Leave town and go south to the mountains by the sea. "
88                        "There you will find the cave entrance."))))
89         (begin
90           (say knpc "In my time I knew many battle wards. "
91                "Be wanting me to teach ye, now, won't ye?")
92           (if (kern-conv-get-yes-no? kpc)
93               (begin
94                 (say knpc "I know a battle ward that will render fire harmless. "
95                      "But perhaps ye can do me a favor first, yes?")
96                 (if (kern-conv-get-yes-no? kpc)
97                     (begin
98                       (say knpc "In a cave to the south grows "
99                            "a purple mushroom. Bring me one. Agreed?")
100                       (if (kern-conv-get-yes-no? kpc)
101                           (begin
102                             (say knpc "Good. A colony of slimes infests that "
103                                  "cave, so take plenty of flaming oil!")
104                             (shroom-give-quest shroom))
105                           (say knpc "Yes, perhaps ye are afraid.")))
106                     (say knpc "Naught for naught, youngling!")))
107               (say knpc "Of course, a skillful warrior such as you has "
108                    "nothing to learn from an old witch like me."))))))
109                                
110 (define (shroom-hail knpc kpc)
111   (let ((shroom (kobj-gob-data knpc)))
112     (display "shroom: ")
113     (display shroom)(newline)
114     (if (shroom-gave-quest? shroom)
115         ;; gave quest
116         (if (shroom-quest-done? shroom)
117             ;; quest done
118             (say knpc "Hello again, young wanderer. Come visit a bit with old "
119                "Shroom.")
120             ;; quest not done yet
121             (if (in-inventory? kpc t_royal_cape)
122                 (begin
123                   ;; player has shrooms
124                   (say knpc "Ah, ye have the mushroom, as I requested!")
125                   (kern-obj-remove-from-inventory kpc t_royal_cape 1)
126                   (shroom-set-quest-done! shroom)
127                   (say knpc "Now for your reward. The ward is called "
128                        "In Flam Sanct, of the first circle. Mix royal cape, "
129                        "sulphurous ash and garlic. Cast it on yourself or a companion "
130                        "and fire will not harm!"))
131                 ;; player does NOT have shrooms yet
132                 (say knpc "No purple mushroom yet, I see. No rush, dear. "
133                       "But I would like it before I die.")))
134         ;; has NOT given quest yet
135         (say knpc "Hello and well met."))))
136
137 (define (shroom-thie knpc kpc)
138   (say knpc "I've seen no one strange about here."))
139
140 (define (shroom-roya knpc kpc)
141   (say knpc "Do you know what the royal cape mushroom is for?")
142   (if (yes? kpc)
143       (say knpc "Very rare it is, but often found with yellow slimes.")
144       (say knpc "It is used in spells which absorb effects!")))
145
146 (define (shroom-band knpc kpc)
147   (say knpc "Bandits? Yes, an old woman must be careful in the woods."))
148
149 (define shroom-conv
150   (ifc basic-conv
151        ;; default if the only "keyword" which may (indeed must!) be longer than
152        ;; 4 characters. The 4-char limit arises from the kernel's practice of
153        ;; truncating all player queries to the first four characters. Default,
154        ;; on the other hand, is a feature of the ifc mechanism (see ifc.scm).
155        (method 'default (lambda (knpc kpc) (say knpc "Long ago I might have "
156                                                 "known about that.")))
157        (method 'hail shroom-hail)
158        (method 'bye (lambda (knpc kpc) (say knpc "Toodaloo!")))
159        (method 'job (lambda (knpc kpc) (say knpc "I sell potions, reagents "
160                                             "and the like.")))
161        (method 'name (lambda (knpc kpc) (say knpc "I'm known as Shroom. At "
162                                                 "your service.")))
163        (method 'cape shroom-roya)
164        (method 'roya shroom-roya)
165        (method 'shro (lambda (knpc kpc) (say knpc "Mushrooms are my "
166                                                 "specialty. That's why they "
167                                                 "call me Shroom.")))
168        (method 'maid (lambda (knpc) (say knpc "[she grins with crooked "
169                                            "teeth] Is it so hard to believe I "
170                                            "was once a fair war-maiden? [she "
171                                            "cackles obscenely]")))
172        (method 'mush shroom-trade)
173        (method 'buy (lambda (knpc kpc) (conv-trade knpc kpc "buy" shroom-merch-msgs shroom-catalog)))
174        (method 'trad shroom-trade)
175        (method 'sell (lambda (knpc kpc) (conv-trade knpc kpc "sell" shroom-merch-msgs shroom-catalog)))
176        (method 'reag shroom-trade)
177        (method 'poti shroom-trade)
178        (method 'join (lambda (knpc) (say knpc "You're too young for me, "
179                                          "sweetie!")))
180        (method 'gen (lambda (knpc) (say knpc "Aye, a handsome young man he "
181                                         "was, once. He could stay up all night"
182                                         " in bed! But gone a bit strange, he "
183                                         "has, befriending the goblins and all "
184                                         "that.")))
185        (method 'stra (lambda (knpc) (say knpc "He meets them in the forest "
186                                             "and runs with their hunts. "
187                                             "Half-goblin he nearly is; "
188                                             "learned their ways he has. But "
189                                             "ye could never tell him what to "
190                                             "do, the silly man.")))
191        (method 'gobl (lambda (knpc) (say knpc "I trade with them now and "
192                                             "then. Their shamans know well "
193                                             "the plants in these woods. I "
194                                             "even speak a little. Know some "
195                                             "of their magic. But I never "
196                                             "trust them.")))
197        (method 'thie shroom-thie)
198        (method 'trus (lambda (knpc) (say knpc "The goblins will turn on us "
199                                           "when their opportunity comes. I "
200                                           "would do the same in their "
201                                           "place!")))
202        (method 'wars (lambda (knpc) (say knpc "Ha! Yes, I fought the goblins. "
203                                          "Long ago that was. People forget.")))
204        (method 'ward shroom-wards)
205        (method 'band shroom-band)
206        ))
207
208 ;;----------------------------------------------------------------------------
209 ;; First-time constructor
210 ;;----------------------------------------------------------------------------
211 (define (mk-shroom tag)
212   (bind 
213    (kern-mk-char tag                 ; tag
214                  "Shroom"            ; name
215                  sp_human            ; species
216                  nil                 ; occ
217                  s_companion_druid   ; sprite
218                  faction-men         ; starting alignment
219                  1 6 1               ; str/int/dex
220                  0 0                 ; hp mod/mult
221                  0 0                 ; mp mod/mult
222                  max-health -1 max-health 0 3  ; hp/xp/mp/AP_per_turn/lvl
223                  #f                  ; dead
224                  'shroom-conv        ; conv
225                  sch_shroom          ; sched
226                  'townsman-ai                 ; special ai
227                  (mk-inventory (list (list 1 t_sword)))                 ; container
228                  (list t_armor_leather)                 ; readied
229                  )
230    (shroom-mk #f #f)))