1;;----------------------------------------------------------------------------
2;; Constants
3;;----------------------------------------------------------------------------
4(define zane-start-lvl 8)
5
6;;----------------------------------------------------------------------------
7;; Schedule
8;;
9;; The schedule below is for the place "Enchanter's Tower Ground Floor"
10;;----------------------------------------------------------------------------
11(kern-mk-sched 'sch_zane
12               (list 0  0  enchtwr-zane-bed        "sleeping")
13               (list 6  0  enchtwr-campsite        "idle")
14               (list 8  0  enchtwr-dining-room-1   "eating")
15               (list 9  0  enchtwr-campsite        "idle")
16               (list 12 0  enchtwr-dining-room-1   "eating")
17               (list 13 0  enchtwr-hall            "idle")
18               (list 19 0  enchtwr-dining-room-1   "eating")
19               (list 20 0  enchtwr-dining-room     "idle")
20               (list 21 0  enchtwr-campsite        "idle")
21               (list 22 0  enchtwr-zane-bed        "sleeping")
22               )
23
24;;----------------------------------------------------------------------------
25;; Gob
26;;
27;; Quest flags, etc, go here.
28;;----------------------------------------------------------------------------
29(define (zane-mk) nil)
30
31;;----------------------------------------------------------------------------
32;; Conv
33;;
34;; Zane is a ranger of the Fens. He camps at the Enchanter's Tower,
35;; where he sells various outdoorsman gear needful for questing among
36;; the poisonous swamps of the region.
37;;----------------------------------------------------------------------------
38(define zane-merch-msgs
39  (list nil ;; closed
40        "I don't trust those town armories. I make my own equipment. Lemme show you what I got." ;; buy
41        nil ;; sell
42        nil ;; trade
43        "Watch your step out there." ;; bought-something
44        "Suit yourself, bub." ;; bought-nothing
45        nil
46        nil
47        nil
48        nil
49        ))
50
51(define zane-catalog
52  (list
53   ;; reagents
54   (list ginseng        (* 5 reagent-price-mult) "This stuffs good for healing.")
55   (list garlic         (* 4 reagent-price-mult) "You gotta have garlic for warding.")
56   (list blood_moss     (* 6 reagent-price-mult) "Hard to find this stuff.")
57   (list nightshade     (* 8 reagent-price-mult) "This only grows in really damp places.")
58   (list mandrake       (* 10 reagent-price-mult) "All the powerful spells require these guys.")
59
60   ;; potions
61   (list t_heal_potion            21 "This stuff really helps in emergencies.")
62   (list t_cure_potion            21 "Even the best get poisoned sometimes. You gotta carry extra of these guys.")
63   (list t_poison_immunity_potion 21 "If you know you have to cross poisonous terrain, drink one of these first.")
64
65   ;; bows, arrows and bolts
66   ;; (as an accomplished Ranger, he is also a bowyer and fletcher)
67   (list t_self_bow    30 "This little guy is lightweight and rapid fire.")
68   (list t_bow         90 "The basic bow is the perfect all-around weapon. Cheap, light, with good range.")
69   (list t_long_bow   300 "These are perfect for hunting fast game in the open.")
70   (list t_great_bow  700 "The paladin's worst nightmare. This baby will take out armored troops at long range.")
71
72   (list t_arrow        2 "I make these special, but I can part with a quiverful.")
73   (list t_bolt         2 "I make crossbow bolts to trade with town militias.")
74   ))
75
76(define (zane-trade knpc kpc) (conv-trade knpc kpc "buy" zane-merch-msgs zane-catalog))
77
78(define (zane-ench knpc kpc)
79  (say knpc "Yeah, he's locked himself inside, see. "
80       "He doesn't need people interrupting "
81       "him all the time. If you're serious, you'll find a way in."))
82
83(define (zane-fens knpc kpc)
84  (say knpc "You're right in the middle of 'em, bub. They can be dangerous, "
85       "so watch yourself."))
86
87(define zane-conv
88  (ifc ranger-conv
89       ;; default if the only "keyword" which may (indeed must!) be longer than
90       ;; 4 characters. The 4-char limit arises from the kernel's practice of
91       ;; truncating all player queries to the first four characters. Default,
92       ;; on the other hand, is a feature of the ifc mechanism (see ifc.scm).
93       (method 'default (lambda (knpc kpc) (say knpc "Ask somebody else.")))
94       (method 'hail (lambda (knpc kpc) (say knpc "[He nods]")))
95       (method 'bye (lambda (knpc kpc) (say knpc "Be seeing ya, buddy")))
96       (method 'job (lambda (knpc kpc)
97                      (say knpc "I'm a Ranger. I patrol the Fens.")))
98       (method 'name (lambda (knpc kpc) (say knpc "Zane.")))
99       (method 'join (lambda (knpc kpc)
100                       (say knpc "Sorry, bub, I already got a job to do.")))
101       (method 'ench zane-ench)
102       (method 'fens zane-fens)
103       (method 'dang
104               (lambda (knpc kpc)
105                 (say knpc "Poisonous and teeming with monsters. "
106                      "You planning to spend much time in them?")
107                 (if (kern-conv-get-yes-no? kpc)
108                     (begin
109                       (say knpc "You'll want the poison immunity spell. "
110                            "You know it?")
111                       (if (kern-conv-get-yes-no? kpc)
112                           (say knpc "Good. I can sell you the fixin's.")
113                           (say knpc "Mix Nightshade and Garlic and chant "
114                                "Sanct Nox. I've got extra reagents I can "
115                                "sell you.")
116                           ))
117                     (say knpc "Ok")
118                     )))
119       (method 'pois
120               (lambda (knpc kpc)
121                 (say knpc "A green potion or the An Nox spell will cure "
122                      "poison.")))
123       (method 'poti
124               (lambda (knpc kpc)
125                 (say knpc "I got some extra I can sell you.")))
126       (method 'mons
127               (lambda (knpc kpc)
128                 (say knpc "Slimes, bandits and undead mostly.")))
129       (method 'reag
130               (lambda (knpc kpc)
131                 (say knpc "I collect 'em where I can. "
132                      "I can sell you my extras.")))
133       (method 'buy zane-trade)
134       (method 'sell zane-trade)
135       (method 'trad zane-trade)
136       ))
137
138;;----------------------------------------------------------------------------
139;; First-time constructor
140;;----------------------------------------------------------------------------
141(define (mk-zane-first-time tag)
142  (bind
143   (kern-char-arm-self
144    (kern-mk-char
145     tag ;;..........tag
146     "Zane" ;;.......name
147     sp_human ;;.....species
148     oc_ranger ;;.. .occupation
149     s_companion_ranger ;;..sprite
150     faction-men ;;..faction
151     +1 ;;...........custom strength modifier
152     0 ;;...........custom intelligence modifier
153     +1 ;;...........custom dexterity modifier
154     +1 ;;............custom base hp modifier
155     +1 ;;............custom hp multiplier (per-level)
156     0 ;;............custom base mp modifier
157     0 ;;............custom mp multiplier (per-level)
158     max-health ;;..current hit points
159     -1  ;;...........current experience points
160     max-health ;;..current magic points
161     0 ;; AP_per_turn
162     zane-start-lvl  ;;..current level
163     #f ;;...........dead?
164     'zane-conv ;;...conversation (optional)
165     sch_zane ;;.....schedule (optional)
166     'townsman-ai ;;..........custom ai (optional)
167
168     ;;..............container (and contents)
169     (mk-inventory
170      (list
171       (list 10  t_food)
172       (list 100 t_arrow)
173       (list 1   t_great_bow)
174       (list 1   t_dagger)
175       (list 1   t_sword)
176       (list 1   t_leather_helm)
177       (list 1   t_armor_leather)
178       (list 5   t_torch)
179       (list 5   t_cure_potion)
180       (list 5   t_heal_potion)
181       ))
182
183     nil ;;.........readied arms (in addition to the container contents)
184     nil ;;..........hooks in effect
185     ))
186   (zane-mk)))
187