1;;---------------------------------------------------------------------------- 2;; Constants 3;;---------------------------------------------------------------------------- 4(define engineer-start-lvl 8) 5 6(define voidship-parts 7 (list 8 (list t_power_core 1) 9 (list sulphorous_ash 20) 10 (list t_gem 10) 11 )) 12 13(define voidship-loc (mk-loc 'p_shard 50 3)) 14 15;;---------------------------------------------------------------------------- 16;; Schedule 17;; 18;; The schedule below is for the place "Engineer's Tower Ground Floor" 19;;---------------------------------------------------------------------------- 20(kern-mk-sched 'sch_engineer 21 (list 0 0 eng-workshop "working") 22 (list 1 0 eng-bed "sleeping") 23 (list 10 0 eng-workshop "working") 24 ) 25 26;;---------------------------------------------------------------------------- 27;; Gob 28;; 29;; Quest flags, etc, go here. 30;;---------------------------------------------------------------------------- 31(define (engineer-mk) 32 (list #f 33 (mk-quest))) 34(define (eng-met? gob) (car gob)) 35(define (eng-quest gob) (cadr gob)) 36(define (eng-met! gob val) (set-car! gob val)) 37 38;; ---------------------------------------------------------------------------- 39;; Voidship plans 40;; ---------------------------------------------------------------------------- 41(mk-reusable-item 42 't_voidship_plans "Voidship Plans" s_lexicon norm 43 (lambda (klexicon kuser) 44 (kern-ui-page-text 45 "Voidship Plans" 46 "Parts List:" 47 " Sulphurous Ash (20)" 48 " Gems (10)" 49 " Power Core (1)" 50 ))) 51 52;;---------------------------------------------------------------------------- 53;; Conv 54;; 55;; The Engineer is a Wright of great knowledge, and one of the Wise. 56;; He dwells in an isolated workshop on a nearly inaccessible 57;; void-mesa (or void-island) off the edge of the Shard. 58;;---------------------------------------------------------------------------- 59(define (eng-hail knpc kpc) 60 (say knpc "[You meet a thin man with wild, white hair. " 61 "He doesn't seem to notice you at first] Oh, hello.")) 62 63(define (eng-name knpc kpc) 64 (say knpc "Rudolph. I'm better known as the Engineer.")) 65 66(define (eng-job knpc kpc) 67 (say knpc "Oh, this and that. I like to make things.")) 68 69(define (eng-default knpc kpc) 70 (say knpc "I don't know. Ask the Enchanter.")) 71 72(define (eng-bye knpc kpc) 73 (say knpc "[He seems to have forgotten about you already]")) 74 75(define (eng-join knpc kpc) 76 (say knpc "Too busy. Try the Warritrix, she likes adventures.")) 77 78(define (eng-warr knpc kpc) 79 (say knpc "I understand she's one of the finest warriors to ever live, " 80 "but I know for a fact she's one of the most noble. When she isn't " 81 "off doing something incredibly brave and stupid you can find her " 82 "at Glasdrin.") 83 (quest-wise-subinit 'questentry-warritrix) 84 (quest-data-update 'questentry-warritrix 'general-loc 1) 85 ) 86 87(define (eng-make knpc kpc) 88 (say knpc "I work on all kinds of different things. Lately I've been " 89 "interested in devices for traveling: gates, voidships, etc. " 90 "Inventing is an obsession of mine.")) 91 92(define (eng-wand knpc kpc) 93 (say knpc "You're a Wanderer? I've always wanted to meet one. " 94 "Did you build your own gate?") 95 (kern-conv-get-reply kpc) 96 (say knpc "I've always wondered how it could be done. " 97 "I have some theories, and I've designed a voidship " 98 "to test some of them, but it isn't finished yet.")) 99 100(define (eng-void knpc kpc) 101 (let* ((eng (kobj-gob-data knpc)) 102 (quest (eng-quest eng))) 103 104 (define (remove-stuff) 105 (map (lambda (ktype) 106 (kern-obj-remove-from-inventory kpc (car ktype) (cadr ktype))) 107 voidship-parts)) 108 109 ;;FIXME: the grammer here needs work 110 111 (define (really-has-parts?) 112 (display "really-has-parts?")(newline) 113 (let ((missing (filter 114 (lambda (ktype) 115 (let ((nrem (- (cadr ktype) (num-in-inventory kpc (car ktype))))) 116 (cond 117 ((> nrem 1) 118 (begin 119 (say knpc "We still need " nrem " " (kern-type-get-name (car ktype)) "s") 120 #t)) 121 ((> nrem 0) 122 (begin 123 (say knpc "We still need the " (kern-type-get-name (car ktype))) 124 #t)) 125 (else #f)))) 126 voidship-parts))) 127 128 (if (null? missing) 129 #t 130 #f))) 131 132 (define (build-ship) 133 (say knpc "Yes, it looks like you have everything. " 134 "Well, let's get to work...") 135 (remove-stuff) 136 (kern-log-msg "[After a good deal of effort, cursing, trying, failing...]") 137 (prompt-for-key) 138 (kern-log-msg "[retrying, refailing, pacing up and down, tearing out " 139 "fistfuls of hair...]") 140 (prompt-for-key) 141 (kern-log-msg "[more cursing, arguing, starting over, failing again...]") 142 (prompt-for-key) 143 (kern-log-msg "[retrying, refailing, weeping, gnashing of teeth...]") 144 (prompt-for-key) 145 (kern-log-msg "[...and so on and so forth...]") 146 (prompt-for-key) 147 (kern-log-msg "[...finally...]") 148 (prompt-for-key) 149 (kern-log-msg "[...oh, hell, now what?...]") 150 (prompt-for-key) 151 (kern-log-msg "[...but then...]") 152 (kern-obj-relocate (mk-voidship) (eval-loc voidship-loc) nil) 153 (kern-log-msg "[You both collapse with exhaustion] ") 154 (say knpc 155 "Well. That wasn't so bad. She's all yours now, waiting " 156 "for you outside at the end of the dock. Good luck! ") 157 (kern-log-msg "[He starts to snore]") 158 (kern-obj-add-effect knpc ef_sleep nil) 159 (quest-done! quest #t) 160 (kern-conv-end)) 161 162 (define (missing-power-core?) 163 (not (in-inventory? kpc t_power_core))) 164 165 (define (has-plans) 166 (say knpc "Ah, you've found the plans for my voidship! " 167 "Do you have all the parts we need?") 168 (if (kern-conv-get-yes-no? kpc) 169 (if (really-has-parts?) 170 (build-ship)) 171 (if (missing-power-core?) 172 (say knpc "Somewhere across the chasm to the south lies a wrecked voidship. " 173 "If you can find a way to cross the chasm it might have a power core " 174 "you can salvage.") 175 (say knpc "Well, what are you waiting for? Go get them.") 176 ))) 177 178 (define (no-plans) 179 (say knpc "A great void surrounds the Shard. I've designed a ship " 180 "which should be able to cross the void, but it isn't " 181 "finished yet. I've got the plans around here someplace. " 182 "If you find them let me know.") 183 (quest-data-update 'questentry-whereami 'shard 2) 184 ) 185 186 (if (quest-done? quest) 187 (say knpc "It's all finished.") 188 (if (in-inventory? kpc t_voidship_plans) 189 (has-plans) 190 (no-plans))))) 191 192(define (eng-gate knpc kpc) 193 (say knpc "The moongates and Shrine Gate are a mystery. I'd love to figure " 194 "them out. You know about the Demon Gate, right?") 195 (if (kern-conv-get-yes-no? kpc) 196 (say knpc "I wish I knew if it really existed or not.") 197 (say knpc "It's a legend. The Demon Gate opened from this world to " 198 "others. Then somebody got paranoid, locked it shut, and " 199 "threw away the key. Pity if it's true."))) 200 201(define (eng-key knpc kpc) 202 (say knpc "Supposedly the key is a set of Runes that were subsequently " 203 "lost or scattered. Typical fairy-tale nonsense. But there may be " 204 "a kernel of truth to it.")) 205 206(define (eng-wise knpc kpc) 207 (say knpc "Anyone with the arrogance to call themselves Wise is probably " 208 "an ass. Take the Stewardess of Glasdrin, for example.")) 209 210(define (eng-stew knpc kpc) 211 (say knpc "She longs to be counted among the Wise, and doesn't care how " 212 "much blood she has to spill to do it. You've heard of Absalot, I " 213 "assume?") 214 (if (kern-conv-get-yes-no? kpc) 215 (say knpc "A perfect example of abusive power. Sad.") 216 (say knpc "The Stewardess conned the other cities and the Enchanter " 217 "into massacring the citizens of Absalot. " 218 "Supposedly Absalot was a hotbed of Accursed insurgency. If there " 219 "was any evidence of the Accursed being there, they burned it to " 220 "the ground with the rest of the city."))) 221 222(define (eng-accu knpc kpc) 223 (say knpc "Supposedly they're a cult of some sort engaging in evil " 224 "practices. People who make it their business to meddle are very " 225 "upset about them. I don't really give a fig.")) 226 227(define (eng-shri knpc kpc) 228 (say knpc "I've studied the records about the Shrine Gate and investigated " 229 "the site, of course. But there's nothing to indicate how it works or " 230 "how to control it. I think the last time it opened was over one " 231 "hundred years ago.")) 232 233(define (eng-rune knpc kpc) 234 (say knpc "The legend of the Demon Gate insists that it was locked by a set " 235 "of Runes. Some versions say the Runes were scattered so they could " 236 "not be reassambled to open the Gate, others say they were lost " 237 "through simple incompetence and bad luck. Of course, there's no " 238 "telling if the Runes or even the Gate ever existed!")) 239 240(define (eng-wiza knpc kpc) 241 (say knpc "Wizards as a rule tend to be obsessed with power.")) 242 243(define (eng-wrog knpc kpc) 244 (say knpc "Mosts Wrogues are simply pests. They're into everything.")) 245 246(define (eng-wrig knpc kpc) 247 (say knpc "Wrights are my kind of people. They like to make things, to " 248 "figure out how things work, and just want the freedom to follow " 249 "their own interests.")) 250 251(define (eng-necr knpc kpc) 252 (say knpc "Not a bad sort. I've conferred with him a time or two.") 253 (quest-data-update 'questentry-necromancer 'nonevil 1) 254 ) 255 256(define (eng-alch knpc kpc) 257 (say knpc "A tricky bastard but I have to respect him.")) 258 259(define (eng-man knpc kpc) 260 (say knpc "A Wrogue, but a helpful one. We get along.")) 261 262(define (eng-ench knpc kpc) 263 (say knpc "Bit of a fanatic if you ask me. But it takes all kinds.")) 264 265(define eng-merch-msgs 266 (list "Not now." 267 "Let me show you some of my inventions..." 268 nil 269 nil 270 "Always glad to help out a fellow tinkerer." 271 "No problem." 272 )) 273 274(define eng-catalog 275 (list 276 ;; Various tools and devices 277 (list t_picklock 10 "I happen to have some spare picklocks. They're handy for all kinds of things.") ;; high prices, not his specialty 278 (list t_shovel 100 "I hate to part with my shovel, you never know when it might come in handy.") ;; high prices, not his specialty 279 (list t_pick 100 "I've actually used this pick. Once. I suppose I can part with it.") ;; high prices, not his specialty 280 (list t_sextant 200 "This is one of my most successful inventions. With this sextant you don't neet the In Wis spell to find your location on the surface.") 281 (list t_chrono 200 "It's a little PORTABLE CLOCK! Isn't it amazing? [He giggles with glee]") 282 283 ;; A bit of oil and grease, for a grease-monkey: 284 (list t_grease 20 "I've got plenty of grease. I use it for everything.") 285 (list t_oil 10 "If I could figure out how to harness the explosive power of this oil, I'm sure I could make a useful engine.") ;; high prices, not his specialty 286 287 ;; Crossbows and bolts, as he likes intricate devices 288 (list t_lt_crossbow 50 "Isn't this little crossbow cute? The little levers and actions are quite clever.") 289 (list t_crossbow 100 "I'm a terrible shot, but I wanted to study crossbows to see if I could figure out how to shoot myself safely across the void.") 290 (list t_hvy_crossbow 300 "I couldn't help making some improvements on the standard crossbow. This one works best if you mount it on something first.") 291 (list t_trpl_crossbow 500 "What if a crossbow could fire more than one bolt at a time? I had to try it out, so I made this.") ;; a mechanism of his devising 292 (list t_bolt 2 "I went through a lot of bolts while testing crossbows modifications, and I have a few crates left over.") 293 )) 294 295(define (eng-trade knpc kpc) (conv-trade knpc kpc "buy" eng-merch-msgs eng-catalog)) 296 297(define engineer-conv 298 (ifc nil 299 (method 'default eng-default) 300 (method 'hail eng-hail) 301 (method 'name eng-name) 302 (method 'bye eng-bye) 303 (method 'job eng-job) 304 (method 'join eng-join) 305 306 (method 'trad eng-trade) 307 (method 'buy eng-trade) 308 (method 'inve eng-trade) 309 310 (method 'make eng-make) 311 (method 'thin eng-make) 312 (method 'wand eng-wand) 313 (method 'void eng-void) 314 (method 'gate eng-gate) 315 (method 'key eng-key) 316 (method 'wise eng-wise) 317 (method 'stew eng-stew) 318 (method 'accu eng-accu) 319 (method 'shri eng-shri) 320 (method 'rune eng-rune) 321 (method 'wiza eng-wiza) 322 (method 'wrog eng-wrog) 323 (method 'wrig eng-wrig) 324 (method 'necr eng-necr) 325 (method 'alch eng-alch) 326 (method 'man eng-man) 327 (method 'ench eng-ench) 328 )) 329 330(define (mk-engineer) 331 (bind 332 (kern-char-arm-self 333 (kern-mk-char 334 'ch_engineer ;;..........tag 335 "Engineer" ;;.......name 336 sp_human ;;.....species 337 oc_wright ;;.. .occupation 338 s_companion_tinker ;;..sprite 339 faction-men ;;..faction 340 2 ;;...........custom strength modifier 341 10 ;;...........custom intelligence modifier 342 2 ;;...........custom dexterity modifier 343 10 ;;............custom base hp modifier 344 2 ;;............custom hp multiplier (per-level) 345 20 ;;............custom base mp modifier 346 5 ;;............custom mp multiplier (per-level) 347 max-health ;;..current hit points 348 -1 ;;...........current experience points 349 max-health ;;..current magic points 350 0 351 engineer-start-lvl ;;..current level 352 #f ;;...........dead? 353 'engineer-conv ;;...conversation (optional) 354 sch_engineer ;;.....schedule (optional) 355 'townsman-ai ;;..........custom ai (optional) 356 ;;..............container (and contents) 357 (mk-inventory 358 (list 359 (list 1 t_dagger) 360 (list 1 t_doom_staff) 361 (list 1 t_trpl_crossbow) 362 (list 100 t_bolt) 363 (list 5 t_cure_potion) 364 (list 5 t_heal_potion) 365 )) 366 nil ;;.........readied arms (in addition to the container contents) 367 nil ;;..........hooks in effect 368 )) 369 (engineer-mk))) 370