1;;----------------------------------------------------------------------------
2;; Constants
3;;----------------------------------------------------------------------------
4
5;;----------------------------------------------------------------------------
6;; Schedule
7;;
8;; In Glasdrin.
9;;----------------------------------------------------------------------------
10(kern-mk-sched 'sch_ches
11               (list 0  0  gc-bed       "sleeping")
12               (list 7  0  ghg-s3       "eating")
13               (list 8  0  gas-counter "working")
14               (list 11 0  ghg-s3       "eating")
15               (list 12 0  gas-counter "working")
16               (list 18 0  ghg-s3       "eating")
17               (list 19 0  ghg-hall     "idle")
18               (list 21 0  gc-bed       "sleeping")
19               )
20
21;;----------------------------------------------------------------------------
22;; Gob
23;;----------------------------------------------------------------------------
24(define (ches-mk) (list 'townsman))
25
26;;----------------------------------------------------------------------------
27;; Conv
28;;
29;; Chester is a burly weaponsmith who lives in Glasdrin.
30;;----------------------------------------------------------------------------
31
32;; Basics...
33(define (ches-hail knpc kpc)
34  (say knpc "[You meet an enormous man with arms like tree trunks] "
35       "Hail, warrior!"))
36
37(define (ches-default knpc kpc)
38  (say knpc "'Tis beyond my ken."))
39
40(define (ches-name knpc kpc)
41  (say knpc "I'm Chester, of the Axe and Shield. "
42       "You look like a serious character, "
43       "in need of some serious weaponry. "
44       "Perhaps I can interest you in something?")
45  (if (kern-conv-get-yes-no? kpc)
46      (ches-trade knpc kpc)))
47
48(define (ches-join knpc kpc)
49  (say knpc "Nay, friend, somebody has to keep you adventurers provisioned!"))
50
51(define (ches-job knpc kpc)
52  (say knpc "I sell the finest weapons and armor in the land. "
53       "Care to have a look?")
54       (if (kern-conv-get-yes-no? kpc)
55           (ches-trade knpc kpc)
56           (say knpc "As you like it. You'll find none better, "
57                "I assure you.")))
58
59(define (ches-bye knpc kpc)
60  (say knpc "Farewell, and tell your friends about my shop!"))
61
62(define ches-catalog
63  (list
64   (list t_staff            20 "Equip your mages with staffs so they can feel useful.")
65   (list t_dagger           65 "Always keep an extra dagger or two in your boots.")
66   (list t_mace             80 "The mace is a fine weapon for crushing skulls and breaking bones.")
67   (list t_axe              85 "That axe is just the thing for splitting shields.")
68   (list t_sword            85 "The sword is the workhorse of the fighting class.")
69   (list t_2H_axe           90 "You'll mow down your enemies like grass with my two-handed axes.")
70   (list t_2H_sword        100 "Ah yes, my personal favorite is the mighty the two-handed sword.")
71   (list t_morning_star    105 "Your foes will give you plenty of room when you whip out a morning star.")
72   (list t_halberd         150 "With the halberd your back ranks can reinforce your front.")
73
74   (list t_sling            50 "If you have any children a sling will make a fine starter weapon.")
75   (list t_spear            15 "The spear is quite popular with goblins and other savages.")
76
77   (list t_self_bow        120 "These little bows are perfect for hunting small animals.")
78   (list t_bow             200 "The rangers like to skulk about in the woods with bows like this.")
79   (list t_arrow             1 "If you don't wish to face your enemies in manly combat, be sure to carry plenty of arrows.")
80
81   (list t_crossbow        380 "When your enemies flee from your blade, drop them with a crossbow.")
82   (list t_hvy_crossbow    600 "When besieged, the manly warrior turns to one of these beauties.")
83   (list t_bolt              1 "The Glasdrin militia demands the best arms, and I am their sole supplier for bolts.")
84
85   (list t_leather_helm     50 "The light helm is perfect for any pencil-necked wrogues in your party.")
86   (list t_chain_coif      100 "The chain coif will protect your neck without obstructing your vision.")
87   (list t_iron_helm       150 "With an iron helm you can charge head first into the thickest melee.")
88   (list t_armor_leather   150 "Leather armour won't slow you down, but it only gives minimal protection.")
89   (list t_armor_chain     330 "Chain is the preferred armour of paladins, and they know their stuff.")
90   (list t_armor_plate    1000 "With plate armour you will be invincible in battle.")
91
92   (list t_shield           30 "A sturdy shield will save you from craven foes who shoot from afar.")
93
94   (list t_spiked_helm     250 "The best defense is a good offense! This spiked helm will prove my point. No pun intended.")
95   (list t_spiked_shield   250 "With the spiked shield you practically don't need a weapon.")
96   ))
97
98(define ches-merch-msgs
99  (list "Come by the Axe and Shield when I'm working, and I'll ply you with the best weapons and armor money can buy between 9:00AM and 6:00PM."
100        "Come have a look at my armory!" ;; buy
101        "I'll offer you some trade-in value on your used arms." ;; sell
102        "I equip the finest warriors in the land. What can I do for you?" ;; trade
103        "Now go bash some skulls! And come back when you need an upgrade." ;; sold-something
104        "Your equipment is looking a bit shabby, you should reconsider." ;; sold-nothing
105        "Now you should buy something to replace that old junk." ;; bought-something
106        "I was only trying to help. I don't think anyone else will want that rubbish." ;; bought-nothing
107        "Now you're ready to storm Gintspar!" ;; traded-something
108        "Browse all you like." ;; traded-nothing
109        ))
110
111;; Trade...
112(define (ches-trade knpc kpc) (conv-trade knpc kpc "trade" ches-merch-msgs ches-catalog))
113(define (ches-buy knpc kpc) (conv-trade knpc kpc "buy" ches-merch-msgs ches-catalog))
114(define (ches-sell knpc kpc) (conv-trade knpc kpc "sell" ches-merch-msgs ches-catalog))
115
116;; Paladins...
117(define (ches-pala knpc kpc)
118  (say knpc "I served several tours with the paladins, but that's no way "
119       "to make a fortune, so I retired and opened my shop."))
120
121;; Townspeople...
122(define (ches-glas knpc kpc)
123  (say knpc "Not a bad town. Business is good here, "
124       "with the paladins and all."))
125
126(define (ches-ange knpc kpc)
127  (say knpc "Nice-looking woman. But I prefer them a bit more wild."))
128
129(define (ches-patc knpc kpc)
130  (say knpc "I've never been sick, but word is he's a good healer."))
131
132(define (ches-jess knpc kpc)
133  (say knpc "Now there's a fine piece of woman flesh! "
134       "Too bad about that scar, "
135       "but in the dark it's all the same, eh?"))
136
137(define ches-conv
138  (ifc glasdrin-conv
139
140       ;; basics
141       (method 'default ches-default)
142       (method 'hail ches-hail)
143       (method 'bye ches-bye)
144       (method 'job ches-job)
145       (method 'name ches-name)
146       (method 'join ches-join)
147
148       ;; trade
149       (method 'trad ches-trade)
150       (method 'buy ches-buy)
151       (method 'sell ches-sell)
152
153       ;; paladin
154       (method 'pala ches-pala)
155
156       ;; town & people
157       (method 'glas ches-glas)
158       (method 'ange ches-ange)
159       (method 'patc ches-patc)
160       (method 'jess ches-jess)
161
162       ))
163
164(define (mk-chester)
165  (bind
166   (kern-mk-char 'ch_chester         ; tag
167                 "Chester"           ; name
168                 sp_human            ; species
169                 oc_warrior          ; occ
170                 s_townsman          ; sprite
171                 faction-glasdrin         ; starting alignment
172                 5 0 2               ; str/int/dex
173                 0 0                 ; hp mod/mult
174                 0 0                 ; mp mod/mult
175                 max-health -1 max-health 0 3  ; hp/xp/mp/AP_per_turn/lvl
176                 #f                  ; dead
177                 'ches-conv          ; conv
178                 sch_ches            ; sched
179                 'townsman-ai                 ; special ai
180                 (mk-inventory (list (list 1 t_mace)
181                                     (list 1 t_armor_chain))) ; container
182                 nil ;;  readied
183                 )
184   (ches-mk)))
185