1;;----------------------------------------------------------------------------
2;; Constants
3;;----------------------------------------------------------------------------
4
5;;----------------------------------------------------------------------------
6;; Schedule
7;;
8;; In Oparine
9;;----------------------------------------------------------------------------
10(kern-mk-sched 'sch_ghertie
11               (list 0  0  cheerful-room-3      "idle")
12               )
13
14;;----------------------------------------------------------------------------
15;; Gob
16;;----------------------------------------------------------------------------
17(define (ghertie-mk)
18  (list (mk-quest)))
19
20(define (ghertie-quest gob) (car gob))
21
22
23
24;;----------------------------------------------------------------------------
25;; Conv
26;;
27;; Ghertie is the vengeful ghost of a murdered female pirate captain.
28;; She haunts an inn room in Oparine.
29;;----------------------------------------------------------------------------
30
31;; Quest...
32(define (ghertie-give-instr knpc kpc)
33  (say knpc "Each member of my crew wears a "
34       "cursed ring, with a skull for a signet. It cannot be "
35       "removed without the finger. Jorn, Gholet and Meaney still "
36       "live. Bring me their rings to fulfil your part of the "
37       "bargain, and I will then fulfill mine.")
38	(quest-data-update-with 'questentry-ghertie 'questinfo 1 (quest-notify nil))
39)
40
41(define (ghertie-update-quest knpc kpc)
42  (let ((nrem (- 3 (num-in-inventory kpc t_skull_ring))))
43    (if (= nrem 0)
44        (begin
45          (say knpc "I am avenged! Now I can rest... the Merciful "
46               "Death lies at [" merciful-death-x ", " merciful-death-y
47               "] by the sextant. But how you will pillage her when "
48               "she lies at the bottom of the sea is your problem! "
49               "[She vanishes with a cruel laugh]")
50			(quest-data-update-with 'questentry-rune-c 'shiploc 1 (quest-notify nil))
51			(quest-data-assign-once 'questentry-ghertie)
52			(quest-data-update-with 'questentry-ghertie 'done 1 (grant-party-xp-fn 20))
53			 (kern-conv-end)
54          (kern-obj-remove knpc)
55          (kern-map-set-dirty))
56        (begin
57          (say knpc "You still have " nrem " rings to collect. "
58               "Have you forgotten my instructions?")
59           (if (kern-conv-get-yes-no? kpc)
60               (begin
61                 (say knpc "If you were one of my crew I would have you "
62                      "flogged for your carelessness!")
63                 (ghertie-give-instr knpc kpc))
64               (say knpc "Then why have you returned empty-handed? "
65                    "If you fail in your oath I will flog your soul with my "
66                    "own hand!"))))))
67
68;; Basics...
69(define (ghertie-hail knpc kpc)
70  (let ((quest (ghertie-quest (kobj-gob-data knpc))))
71		(quest-data-update 'questentry-ghertie 'ghertieloc 1)
72		(quest-data-assign-once 'questentry-ghertie)
73    (display "quest:")(display quest)(newline)
74    (if (quest-accepted? quest)
75        (ghertie-update-quest knpc kpc)
76        (say knpc "[You meet the ghost of a wild-looking woman] "
77             "You dare disturb me? Be wary, I am in a black mood."))))
78
79(define (ghertie-default knpc kpc)
80  (say knpc "I care not for this line of talk."))
81
82(define (ghertie-name knpc kpc)
83	(quest-data-update 'questentry-ghertie 'ghertieid 1)
84  (say knpc "I am Ghertrude."))
85
86(define (ghertie-join knpc kpc)
87  (say knpc "I am anchored here for eternity."))
88
89(define (ghertie-job knpc kpc)
90  (say knpc "I was a pirate when I was alive. Now I haunt this room."))
91
92(define (ghertie-bye knpc kpc)
93  (if (quest-accepted? (ghertie-quest (kobj-gob-data knpc)))
94      (say knpc "Avenge me without delay!")
95      (say knpc "Trust not your crew!")))
96
97;; Pirate...
98(define (ghertie-pira knpc kpc)
99  (say knpc "I plunderd this coastline for years and amassed a fortune. "
100       "Then, on the eve of my retirement, my crew betrayed me. "
101       "They were like sons to me, the wretches!"))
102
103(define (ghertie-betr knpc kpc)
104  (say knpc "The cowards slew me in my sleep and stole my ship."))
105
106(define (ghertie-ship knpc kpc)
107  (say knpc "The Merciful Death was fast, limber and mean. "
108       "I could not wish for a finer ship. My treasure was nothing, "
109       "my life was doomed, but for stealing my ship I will never "
110       "forgive my crew!"))
111
112(define (ghertie-haun knpc kpc)
113  (say knpc "I am bound to this spot. My first mate knew I would not rest "
114       "in my grave, and with a curse he fixed me here so I could not "
115       "pursue them with my vengeance! Ha! He did not know "
116       "about the curse upon my ship!"))
117
118(define (ghertie-curs knpc kpc)
119  (say knpc "I had a curse put upon my ship. Should it ever be stolen it "
120       "would steer itself to a particular place and sink! I alone know "
121       "of its watery grave..."))
122
123(define (ghertie-grav knpc kpc)
124  (say knpc "Why should I tell you?"))
125
126(define (ghertie-reve knpc kpc)
127  (let ((quest (ghertie-quest (kobj-gob-data knpc))))
128    (if (quest-accepted? quest)
129        (say knpc "Yes, you have sworn to avenge me, "
130             "why are you prattling?")
131        (begin
132          (say knpc "[She fixes you with an icy glare] "
133               "You speak the word dearest to my dead heart. "
134               "Are you offering to avenge me?")
135	(quest-data-update 'questentry-ghertie 'revenge 1)
136          (if (kern-conv-get-yes-no? kpc)
137              (begin
138                (say knpc "Not all of my crew went down with the ship. "
139                     "I have searched among the dead and found some missing. "
140                     "Find and punish the survivors, "
141                     "and I will tell you where my ship lies. "
142                     "Do we have an oath?")
143                (if (kern-conv-get-yes-no? kpc)
144                    (begin
145                      (say knpc "Agreed then, mortal. ")
146                      (quest-accepted! quest #t)
147                      (ghertie-give-instr knpc kpc))
148                    (say knpc "It is wise you do not take such an oath "
149                         "lightly, for I await oath-breakers on this side "
150                         "of the divide.")))
151              (begin
152                (say knpc "Then do not toy with me, fool!")
153                (kern-conv-end)))))))
154
155(define (ghertie-fort knpc kpc)
156  (say knpc "Gold, gems, magical items, weapons armor and runes.")
157	(quest-data-assign-once 'questentry-rune-c)
158	)
159
160(define ghertie-conv
161  (ifc basic-conv
162
163       ;; basics
164       (method 'default ghertie-default)
165       (method 'hail ghertie-hail)
166       (method 'bye ghertie-bye)
167       (method 'job ghertie-job)
168       (method 'name ghertie-name)
169       (method 'join ghertie-join)
170
171       ;; special
172       (method 'pira ghertie-pira)
173       (method 'betr ghertie-betr)
174       (method 'crew ghertie-betr)
175       (method 'ship ghertie-ship)
176       (method 'haun ghertie-haun)
177       (method 'curs ghertie-curs)
178       (method 'grav ghertie-grav)
179       (method 'fort ghertie-fort)
180       (method 'reve ghertie-reve)
181
182       ))
183
184(define (mk-ghertie)
185  (bind
186   (kern-mk-char 'ch_ghertie           ; tag
187                 "Ghertie"             ; name
188                 sp_ghast            ; species
189                 oc_warrior                 ; occ
190                 s_ghost               ; sprite
191                 faction-men         ; starting alignment
192                 0 0 0               ; str/int/dex
193                 0 0                 ; hp mod/mult
194                 0 0                 ; mp mod/mult
195                 max-health -1 max-health 0 6  ; hp/xp/mp/AP_per_turn/lvl
196                 #f                  ; dead
197                 'ghertie-conv         ; conv
198                 sch_ghertie           ; sched
199                 nil                 ; special ai
200                 nil                 ; container
201                 nil                 ; readied
202                 )
203   (ghertie-mk)))
204