1;;----------------------------------------------------------------------------
2;; Constants
3;;----------------------------------------------------------------------------
4
5;;----------------------------------------------------------------------------
6;; Schedule
7;;
8;; In Glasdrin.
9;;----------------------------------------------------------------------------
10(kern-mk-sched 'sch_ini
11               (list 0  0  gi-bed      "sleeping")
12               (list 5  0  gs-altar    "idle")
13               (list 6  0  gc-train    "working")
14               (list 12 0  ghg-s2      "eating")
15               (list 13 0  gc-hall     "working")
16               (list 18 0  ghg-s2      "eating")
17               (list 19 0  ghg-hall    "idle")
18               (list 21 0  gi-bed      "sleeping")
19               )
20
21;;----------------------------------------------------------------------------
22;; Gob
23;;----------------------------------------------------------------------------
24(define (ini-mk) (list 'townsman #f))
25(define (ini-will-join? ini) (cadr ini))
26(define (ini-will-join! ini) (set-car! (cdr ini) #t))
27
28;;----------------------------------------------------------------------------
29;; Conv
30;;
31;; Ini is a dispirited paladin, dwelling in Glasdrin.
32;; He is loyal to the ideals lived by the Warritrix,
33;; and offended by the corruption which produced her
34;; assassination.
35;; Ini is a potential party member.
36;;----------------------------------------------------------------------------
37
38;; Basics...
39(define (ini-hail knpc kpc)
40  (say knpc "[You meet a morose paladin] Hi."))
41
42(define (ini-default knpc kpc)
43  (say knpc "I can't help you with that."))
44
45(define (ini-notyet knpc kpc)
46  (say knpc "I probably shouldn't talk to civilians about that."))
47
48(define (ini-name knpc kpc)
49  (say knpc "I am Inago, but everyone calls me Ini."))
50
51(define (ini-join knpc kpc)
52  (if (is-player-party-member? knpc)
53      (say knpc "I already joined you. Now let's go!")
54      (let ((ini (kobj-gob-data knpc)))
55        (if (ini-will-join? ini)
56            (begin
57              (say knpc "I thank you! Let's not waste any time finding "
58                   "the Warritrix!")
59              (kern-conv-end)
60              (join-player knpc))
61            (say knpc "[Sigh] My duty is with the paladins.")
62            ))))
63
64(define (ini-lost knpc kpc)
65   (let ((ini (kobj-gob-data knpc)))
66     (if (ini-will-join? ini)
67			(begin
68  			(say knpc "The entrance to the Lost Halls is a cavern far to the southwest. "
69  				"Find a ship and sail to ["
70           (loc-x lost-halls-loc) ","
71           (loc-y lost-halls-loc) "].")
72			(quest-data-update-with 'questentry-rune-l 'know-hall 1 (quest-notify nil))
73			(quest-data-update 'questentry-warritrix 'lost-hall-loc 1)
74			)
75  			(say knpc "The Lost Halls are very dangerous. I'd advise you to stay clear!"))))
76
77(define (ini-cave knpc kpc)
78   (let ((ini (kobj-gob-data knpc)))
79     (if (ini-will-join? ini)
80     		(begin
81     			(say knpc "The Lost Halls themselves are deep within the caverns.")
82     			(say knpc (if (is-player-party-member? knpc) "We" "You") " will need to look for the great stairs, in the northern part of the caves.")
83     			(say knpc "Beware of the dungeon's inhabitants!")
84     			)
85     		(ini-notyet knpc kpc))))
86
87(define (ini-inha knpc kpc)
88   (let ((ini (kobj-gob-data knpc)))
89     (if (ini-will-join? ini)
90     		(begin
91     			(say knpc "Everytime we try to clear the place out, another band of gints or trolls decides to move in.")
92     			(say knpc (if (is-player-party-member? knpc) "We" "You") "'d best be prepared for a long, hard battle.")
93     			)
94     		(ini-notyet knpc kpc))))
95
96(define (ini-stair knpc kpc)
97   (let ((ini (kobj-gob-data knpc)))
98     (if (ini-will-join? ini)
99     		(begin
100     			(say knpc "I know the stairs are somewhere in the north, but I'm afraid I've never been that far, so I don't know their precise location.")
101     			)
102     		(ini-notyet knpc kpc))))
103
104(define (ini-job knpc kpc)
105  (say knpc "I'm a paladin. But I don't like it very much."))
106
107(define (ini-bye knpc kpc)
108  (say knpc "So long."))
109
110(define (ini-warr knpc kpc)
111  (cond ((player-stewardess-trial-done?)
112                (say knpc "Justice has been served, and now I can grieve her loss." ))
113	((player-found-warritrix?)
114                (if (ask? knpc kpc "The Stewardess is powerful, but there is a way to see that justice is done. An ancient way. A dangerous way. Will you hear me?")
115                    (say knpc "There is a statue in the center of Glasdrin. "
116                         "If you strike it with your sword, you will invoke the oldest law of the city, and a trial will be held. "
117                         "But we dare not strike it until we have convincing evidence against the Stewardess, because if our evidence is lacking then judgment will be passed on us instead!")
118                    (say knpc "We can't let the Stewardess get away with this. Someone must call her to account!")))
119	((quest-data-assigned? 'questentry-wise)
120		 (say knpc "[He straightens up a bit] Something is amiss! The Warritrix has "
121		      "been gone too long with no word. The Commander should have sent out "
122		      "search parties by now. Instead he sits idly by, pretending to be "
123		      "distracted by other problems. I sense foul play. Will you search for "
124		      "her?")
125		 (if (kern-conv-get-yes-no? kpc)
126		     (begin
127		       (say knpc "I would join you! I know the deeps well, and though my "
128			    "duty is here, I won't obey an order that leaves her to die.")
129		       (ini-will-join! (kobj-gob-data knpc)))
130		     (say knpc "Someone must do something! The realm owes her a great "
131			  "debt.")))
132	(else
133		(say knpc "Are you looking for the Warritrix?")
134		(if (kern-conv-get-yes-no? kpc)
135			(begin
136				(say knpc "She can be hard to find. I believe she is out on patrol right now. ")
137				(say knpc "If you want come back later, I'll keep an eye out and let you know if she's back")
138			)
139		))
140	))
141
142;; Paladin...
143(define (ini-pala knpc kpc)
144  (say knpc "I've been a paladin my whole life. I'm not very good at it; "
145       "I get sick before and after every battle. I'm surprised they "
146       "let me stay in, but I guess they need the warm bodies. "
147       "I would have quit long ago but I don't know what else to do."
148       ))
149
150(define (ini-quit knpc kpc)
151  (say knpc "I've managed to save some pay. I'll retire soon, buy a farm "
152       "near Trigrave, get away from this place. Just think: no more long "
153       "marches, no more sleeping on stony ground in the lightless deep, "
154       "no more waking up to monsters eating your squad for breakfast."
155       ))
156
157;; Townspeople...
158(define (ini-glas knpc kpc)
159  (say knpc "Kind of a dreary place, don't you think?")
160  (kern-conv-get-yes-no? kpc)
161  (say knpc "I've always wanted to visit Green Tower, see the trees."))
162
163(define (ini-ange knpc kpc)
164  (say knpc "A modest lady. I once saw her spit a cave goblin with a dagger."))
165
166(define (ini-spit knpc kpc)
167  (say knpc "She was assigned to my squad on a standard patrol in the "
168       "hills. We'd just barely survived an encounter with gints when some "
169       "cave goblins decided we looked like easy pickings. "
170       "It was dicey there for a while."))
171
172(define (ini-patc knpc kpc)
173  (say knpc "I owe him my life."))
174
175(define (ini-life knpc kpc)
176  (say knpc "I was killed once. We were in the deeps on patrol, dead tired "
177       "after fleeing a party of death knights that killed our medik, "
178       "and we camped right in the middle of a party of sleeping trolls. ")
179  (prompt-for-key)
180  (say knpc
181       "They woke up first. One minute I was fighting for my life, "
182       "and the next I was in the hospital looking up at Doc Patch. "
183       "Nobody else survived from my squad."
184       ))
185
186(define ini-conv
187  (ifc glasdrin-conv
188
189       ;; basics
190       (method 'default ini-default)
191       (method 'hail ini-hail)
192       (method 'bye  ini-bye)
193       (method 'job  ini-job)
194       (method 'name ini-name)
195       (method 'join ini-join)
196
197       (method 'warr ini-warr)
198       (method 'pala ini-pala)
199       (method 'quit ini-quit)
200       (method 'glas ini-glas)
201       (method 'ange ini-ange)
202       (method 'spit ini-spit)
203       (method 'dagg ini-spit)
204       (method 'patc ini-patc)
205       (method 'life ini-life)
206
207       (method 'lost ini-lost)
208       (method 'hall ini-lost)
209       (method 'cave ini-cave)
210       (method 'entr ini-cave)
211       (method 'stai ini-stair)
212       (method 'nort ini-stair)
213       (method 'deep ini-stair)
214       (method 'grea ini-stair)
215       (method 'inha ini-inha)
216       (method 'bewa ini-inha)
217       (method 'dung ini-inha)
218
219       ))
220
221(define (mk-ini)
222  (bind
223   (kern-mk-char 'ch_ini           ; tag
224                 "Ini"             ; name
225                 sp_human            ; species
226                 oc_warrior          ; occ
227                 s_companion_paladin ; sprite
228                 faction-glasdrin         ; starting alignment
229                 5 0 5               ; str/int/dex
230                  pc-hp-off  ; hp bonus
231                  pc-hp-gain ; hp per-level bonus
232                  0 ; mp off
233                  0 ; mp gain
234                 max-health -1 max-health 0 3  ; hp/xp/mp/AP_per_turn/lvl
235                 #f                  ; dead
236                 'ini-conv         ; conv
237                 sch_ini           ; sched
238                 'townsman-ai                 ; special ai
239                 nil                 ; container
240                 (list t_armor_chain
241                       t_chain_coif
242                       t_halberd
243                       ))         ; readied
244   (ini-mk)))
245