OSDN Git Service

fddaa07bea2427471e266adccc96335317c60a56
[nazghul-jp/nazghul-jp.git] / worlds / haxima-1.002 / bart.scm
1 ;;----------------------------------------------------------------------------
2 ;; Constants
3 ;;----------------------------------------------------------------------------
4
5 ;;----------------------------------------------------------------------------
6 ;; Schedule
7 ;; 
8 ;; In Oparine.
9 ;;----------------------------------------------------------------------------
10 (kern-mk-sched 'sch_bart
11                (list 0  0  black-barts-bed      "sleeping")
12                (list 11 0  black-barts-ship     "working")
13                (list 18 0  bilge-water-hall     "idle")
14                (list 23 0  black-barts-bed      "sleeping")
15                )
16
17 ;;----------------------------------------------------------------------------
18 ;; Gob
19 ;;----------------------------------------------------------------------------
20 (define (bart-mk) nil)
21
22 ;;----------------------------------------------------------------------------
23 ;; Conv
24 ;; 
25 ;; Bart is a hard-drinking goblin shipwright who dwells in Oparine.
26 ;;----------------------------------------------------------------------------
27
28 ;; Basics...
29 (define (bart-hail knpc kpc)
30   (say knpc "[You meet a taciturn goblin who smells of whiskey] "
31        "Unh."))
32
33 (define (bart-default knpc kpc)
34   (say knpc "Eh?"))
35
36 (define (bart-name knpc kpc)
37   (say knpc "Bart."))
38
39 (define (bart-join knpc kpc)
40   (say knpc "[He looks at you oddly and shakes his head]"))
41
42 (define (bart-job knpc kpc)
43   (say knpc "Bart make ship. Good ship."))
44
45 (define (bart-bye knpc kpc)
46   (say knpc "Ja."))
47
48 ;; Trade...
49 (define (bart-trade knpc kpc)
50
51   (define (buy-ship)
52     (let* ((town (loc-place (kern-obj-get-location knpc)))
53            (town-loc (kern-place-get-location town))
54            (ship-loc (loc-offset town-loc east)))
55       (if (ship-at? ship-loc)
56           (say knpc "Hunh. No room at dock. Somebody need move ship first.")
57           (begin
58             (kern-obj-relocate (mk-ship) ship-loc nil)
59             (take-player-gold oparine-ship-price)
60             (say knpc "Ship ready ready outside town.")
61             ))))
62
63   (define (sell-ship)
64     (let* ((town (loc-place (kern-obj-get-location knpc)))
65            (town-loc (kern-place-get-location town))
66            (ship-loc (loc-offset town-loc east))
67            (kship (kern-place-get-vehicle ship-loc)))
68       (if (null? kship)
69           (say knpc "Bart no see ship. Park at dock, come back.")
70           (begin
71             (say knpc "You want sell that junk ship? Bart give " 
72                  oparine-ship-tradein-price
73                  ". Ok?")
74             (if (kern-conv-get-yes-no? kpc)
75                 (begin
76                   (say knpc "Bart too generous, you lucky.")
77                   (kern-obj-remove kship)
78                   (give-player-gold oparine-ship-tradein-price))
79                 (say knpc "Hunh. That ship sink soon."))))))
80
81   (if (not (string=? "working" (kern-obj-get-activity knpc)))
82       (say knpc "Not work now. Now drink!")
83       (begin
84         (say knpc "You want buy ship?")
85         (if (yes? kpc)
86             (begin
87               (say knpc "Ship " oparine-ship-price " gold. Want ship?")
88               (if (kern-conv-get-yes-no? kpc)
89                   (if (player-has-gold? oparine-ship-price)
90                       (buy-ship)
91                       (begin
92                         (say knpc "You not have gold! You try cheat Bart? "
93                              "[He spits on the ground]")
94                         (kern-conv-end)))
95                   (say knpc "Fine. You swim.")))
96             (begin
97               (say knpc "You want sell ship?")
98               (if (yes? kpc)
99                   (sell-ship)
100                   (begin
101                     (say knpc "Then what hell you bother Bart for?")
102                     (kern-conv-end))))))))
103
104 ;; Drink...
105 (define (bart-drink knpc kpc)
106   (if (not (string=? "working" (kern-obj-get-activity knpc)))
107       (say knpc "Let's drink!")
108       (say knpc "Work now. Drink later.")))
109
110
111 ;; Townspeople...
112 (define (bart-opar knpc kpc)
113   (say knpc "Smells like fish."))
114
115 (define (bart-gher knpc kpc)
116   (say knpc "Tu-gu. Bad ghost.[He makes a strange sign in the air]"))
117
118 (define (bart-alch knpc kpc)
119   (say knpc "Hi-lu-to. He take low road from burning city. "
120        "Goblins cousins remember."))
121
122 (define (bart-seaw knpc kpc)
123   (say knpc "She smell like fish."))
124
125 (define (bart-osca knpc kpc)
126   (say knpc "Tu-to. Bart not know man-words."))
127
128 (define (bart-henr knpc kpc)
129   (say knpc "Bart friend. Make good drink! Bart love drink."))
130
131 (define bart-conv
132   (ifc basic-conv
133
134        ;; basics
135        (method 'default bart-default)
136        (method 'hail bart-hail)
137        (method 'bye bart-bye)
138        (method 'job bart-job)
139        (method 'name bart-name)
140        (method 'join bart-join)
141        
142        ;; drink
143        (method 'drin bart-drink)
144
145        ;; trade
146        (method 'trad bart-trade)
147        (method 'ship bart-trade)
148        (method 'buy bart-trade)
149        (method 'sell bart-trade)
150
151        ;; town & people
152        (method 'opar bart-opar)
153        (method 'alch bart-alch)
154        (method 'gher bart-gher)
155        (method 'witc bart-seaw)
156        (method 'osca bart-osca)
157        (method 'henr bart-henr)
158        (method 'ja   bart-bye)
159
160        ))
161
162 (define (mk-bart)
163   (bind 
164    (kern-mk-char 'ch_bart           ; tag
165                  "Bart"             ; name
166                  sp_forest_goblin    ; species
167                  nil                 ; occ
168                  s_fgob_civilian     ; sprite
169                  faction-men         ; starting alignment
170                  0 0 0               ; str/int/dex
171                  0 0                 ; hp mod/mult
172                  0 0                 ; mp mod/mult
173                  max-health -1 max-health 0 1  ; hp/xp/mp/AP_per_turn/lvl
174                  #f                  ; dead
175                  'bart-conv         ; conv
176                  sch_bart           ; sched
177                  'townsman-ai                 ; special ai
178                  (mk-inventory (list (list 1 t_axe)))                 ; container
179                  nil                 ; readied
180                  )
181    (bart-mk)))