OSDN Git Service

Nazghul-0.7.1
[nazghul-jp/nazghul-jp.git] / worlds / haxima-1.002 / mouse.scm
1 ;;----------------------------------------------------------------------------
2 ;; Constants
3 ;;----------------------------------------------------------------------------
4 (define mouse-start-lvl 8)
5
6 ;;----------------------------------------------------------------------------
7 ;; Schedule
8 ;;----------------------------------------------------------------------------
9
10 ;;----------------------------------------------------------------------------
11 ;; Gob
12 ;;
13 ;; Quest flags, etc, go here.
14 ;;----------------------------------------------------------------------------
15 (define (mouse-mk) (list #t))
16 (define (mouse-first-meeting? mouse) (car mouse))
17 (define (mouse-set-first-meeting! mouse val) (set-car! mouse val))
18 (define (mouse-talked)
19         (quest-data-update-with 'questentry-thiefrune 'talked 1 (quest-notify (grant-party-xp-fn 10)))
20         )
21
22
23 (define (mouse-meet-first-time knpc kpc)
24
25   (define (mouse-disappear)
26     (say knpc "Oh, bother. Not again!")
27     (kern-obj-add-effect knpc ef_invisibility nil)
28     (kern-conv-end kpc)
29     )
30
31   (define (mouse-query)
32     (say knpc "Hi. You weren't sent by the Red Lady, were you?")
33     (if (yes? kpc)
34         (mouse-disappear)
35         (begin
36                 (say knpc "Whew! You scared me for a minute.")
37                 (mouse-talked)
38         )
39     ))
40
41   (define (mouse-gratitude)
42     (say knpc "Praise be to Alopex! The Red Lady is dead! "
43          "You've done me a great favor.")
44          (mouse-talked)
45          )
46
47   (define (kathryn-speech)
48     (say ch_kathryn "Fool, you have led me right to the thief!")
49     (kern-obj-set-conv ch_kathryn nil)
50     (kern-being-set-base-faction ch_kathryn faction-monster))
51
52   (define (thud-speech)
53     (say ch_thud "Thief here! Kill! Kill! Kill!")
54     (kern-obj-set-conv ch_thud nil)
55     (kern-being-set-base-faction ch_thud faction-monster))
56
57   (define (open-gate)
58     (open-moongate (mk-loc (loc-place (kern-obj-get-location knpc)) 7 2)))
59   
60   (define (warp-in-kathryn kgate)
61     (warp-in ch_kathryn 
62              (kern-obj-get-location kgate)
63              south
64              faction-monster))
65
66   (define (warp-in-thud kgate)
67     (warp-in ch_thud 
68              (kern-obj-get-location kgate)
69              west
70              faction-monster))
71
72   (mouse-set-first-meeting! (kobj-gob-data knpc) #f)
73   (if (defined? 'ch_kathryn)
74       (if (is-alive? ch_kathryn)
75           (if (is-player-party-member? ch_kathryn)
76
77               ;; kathryn is alive in the party (if thud is defined then he must
78               ;; be in the party, too; see kathryn.scm)
79               (begin
80                 (kern-char-leave-player ch_kathryn)
81                 (kathryn-speech)
82                 (if (defined? 'ch_thud)
83                     (begin
84                       (if (is-alive? ch_thud)
85                           (thud-speech))
86                       (kern-char-leave-player ch_thud)))
87                 (mouse-disappear))
88
89               ;; kathryn is alive but not in the party so gate her in, and
90               ;; thud, too, if he's alive
91               (let ((kgate (open-gate))
92                     (use-thud? (and (defined? 'ch_thud)
93                                     (is-alive? ch_thud))))
94                 (kern-sleep 1000)
95                 (warp-in-kathryn kgate)
96                 (if use-thud?
97                     (warp-in-thud kgate))
98                 (kathryn-speech)
99                 (if use-thud?
100                     (thud-speech))
101                 (kern-sleep 1000)
102                 (close-moongate kgate)
103                 (mouse-disappear)))
104
105           ;; kathryn is dead
106           (if (is-player-party-member? ch_kathryn)
107
108               ;; but in the party so remove her and thud, too, if he's defined
109               (begin
110                 (kern-char-leave-player ch_kathryn)
111                 (if (defined? 'ch_thud)
112                     (if (is-alive? ch_thud)
113                         (begin
114                           (thud-speech)
115                           (kern-char-leave-player ch_thud)
116                           (mouse-disappear))
117                         (begin
118                           (kern-char-leave-player ch_thud)
119                           (mouse-gratitude)))
120                     (mouse-gratitude)))
121
122               ;; kathryn is dead but not in the party (since she is not in the
123               ;; party, thud cannot be either)
124               (mouse-query)))
125
126       ;; kathryn is undefined (so she could never have been in the party, and
127       ;; thus neither could thud)
128       (mouse-query)))
129
130 ;;----------------------------------------------------------------------------
131 ;; Conv
132 ;;----------------------------------------------------------------------------
133 (define (mouse-hail knpc kpc)
134   (let ((mouse (kobj-gob-data knpc)))
135     (if (mouse-first-meeting? mouse)
136         (mouse-meet-first-time knpc kpc)
137         (begin
138                 (say knpc "Ah, hello. Heh.")
139                 (mouse-talked)
140             )
141         )))
142
143 (define (mouse-default knpc kpc)
144   (say knpc "Got me there."))
145
146 (define (mouse-name knpc kpc)
147   (say knpc "I'm the Mouse."))
148
149 (define (mouse-join knpc kpc)
150   (say knpc "Sorry, I'm not a team player. Heh."))
151
152 (define (mouse-job knpc kpc)
153   (say knpc "I... uh... collect things."))
154
155
156 (define (mouse-coll knpc kpc)
157   (say knpc "Some might even call me a thief."))
158
159 (define (mouse-thie knpc kpc)
160   (say knpc "Until recently it was a good business. Somebody wants "
161        "something, they pay me to get it. But then I was hired by this "
162        "strange lady in red."))
163
164 (define (mouse-lady knpc kpc)
165   (say knpc "The lady hired me to get something and then meet her to "
166        "exchange it for payment. All very typical, you know? But instead "
167        "of paying me, she tried to kill me!"))
168
169 (define (mouse-kill knpc kpc)
170   (say knpc "That red lady and her brute were relentless! I can't thank you "
171        "enough for getting rid of them, but I have a bad feeling they weren't "
172        "working alone. I'll be hunted for the rest of my life unless I can "
173        "get rid of this stupid rune!"))
174
175 (define (mouse-rune knpc kpc)
176   (if (not (in-inventory? knpc t_rune_k))
177       (say knpc "It's your problem now, buddy!")
178       (begin
179
180         (define (give-rune gold)
181           (let* ((pgold (kern-player-get-gold)))
182             (if (> pgold gold)
183                 (kern-obj-add-gold kpc (- 0 gold))
184                 (let ((price (min pgold gold)))
185                   (say knpc "You don't have enough! Oh well, I'll just take "
186                        "whatever you can give me for it.")
187                   (kern-obj-add-gold kpc (- 0 price)))))
188           (kern-obj-remove-from-inventory knpc t_rune_k 1)
189           (kern-obj-add-to-inventory kpc t_rune_k 1)
190           (quest-data-update-with 'questentry-thiefrune 'recovered 1 (quest-notify (grant-party-xp-fn 50)))
191           )
192         
193         (say knpc "This rune I got for the red lady has been nothing but "
194              "trouble since I first heard of it. I don't even know what "
195              "it's good for! I'll give you a really good deal on it. Say, "
196              "500 gold?")
197         (if (kern-conv-get-yes-no? kpc)
198             (give-rune 500)
199             (begin
200               (say knpc "Well, I guess I do owe you for saving me from "
201                    "that red lady. How about 250 gold?")
202               (if (kern-conv-get-yes-no? kpc)
203                   (give-rune 250)
204                   (begin
205                     (say knpc "You drive a hard bargain, buddy. 100 gold?")
206                     (if (kern-conv-get-yes-no? kpc)
207                         (give-rune 100)
208                         (begin
209                           (say knpc "50?")
210                           (if (kern-conv-get-yes-no? kpc)
211                               (give-rune 50)
212                               (begin
213                                 (say knpc "Look, just take it ok?")
214                                 (if (kern-conv-get-yes-no? kpc)
215                                     (give-rune 0)
216                                     (begin
217                                       (say knpc "I'm desperate! Here, "
218                                            "I'll pay YOU to take it! "
219                                            "Just get it away from me!")
220                                       (give-rune (- 0 100))))))
221                           )))))))))
222       
223 (define (mouse-bye knpc kpc)
224   (say knpc "No offense, but I hope we never meet again."))
225
226 (define (mouse-alopex knpc kpc)
227   (say knpc "Alopex? Oh, the old god of thieves. "
228        "Or so I've heard."))
229
230 (define mouse-conv
231   (ifc nil
232        (method 'default mouse-default)
233        (method 'hail mouse-hail)
234        (method 'bye mouse-bye)
235        (method 'job mouse-job)
236        (method 'name mouse-name)
237        (method 'join mouse-join)
238
239        (method 'coll mouse-coll)
240        (method 'kill mouse-kill)
241        (method 'lady mouse-lady)
242        (method 'rune mouse-rune)
243        (method 'thie mouse-thie)
244        (method 'alop mouse-alopex)
245        ))
246
247 ;;----------------------------------------------------------------------------
248 ;; First-time constructor
249 ;;----------------------------------------------------------------------------
250 (define (mk-mouse)
251   (bind 
252    (kern-char-force-drop
253     (kern-char-arm-self
254      (kern-mk-char 
255       'ch_mouse ;;..tag
256       "Mouse" ;;....name
257       sp_human ;;.....species
258       nil ;;..........occupation
259       s_brigand ;;.....sprite
260       faction-men ;;..faction
261       0 ;;............custom strength modifier
262       0 ;;............custom intelligence modifier
263       6 ;;............custom dexterity modifier
264       2 ;;............custom base hp modifier
265       2 ;;............custom hp multiplier (per-level)
266       1 ;;............custom base mp modifier
267       1 ;;............custom mp multiplier (per-level)
268       max-health ;;..current hit points
269       -1 ;;...........current experience points
270       max-health ;;..current magic points
271       0
272       mouse-start-lvl  ;;..current level
273       #f ;;...........dead?
274       'mouse-conv ;;...conversation (optional)
275       nil ;;..........schedule (optional)
276       nil ;;..........custom ai (optional)
277       
278       ;;..........container (and contents)
279       (mk-inventory
280        (list
281         (list 1 t_rune_k)
282         (list 1 t_armor_leather)
283         (list 1 t_leather_helm)
284         (list 1 t_sword)
285         (list 1 t_bow)
286         (list 50 t_arrow)))
287       
288       nil ;;..........readied arms (in addition to the container contents)
289       nil ;;..........hooks in effect
290       ))
291     #t)
292    (mouse-mk)))