1;;---------------------------------------------------------------------------- 2;; Constants 3;;---------------------------------------------------------------------------- 4(define jake-lvl 2) 5(define jake-species sp_gint) 6(define jake-occ nil) 7 8;;---------------------------------------------------------------------------- 9;; Schedule 10;; 11;; In Kun. 12;;---------------------------------------------------------------------------- 13(define jake-bed ) 14(kern-mk-sched 'sch_jake 15 (list 0 0 cantina-counter-zzz "sleeping") 16 (list 9 0 cantina-counter "working") 17 ) 18 19;;---------------------------------------------------------------------------- 20;; Gob 21;;---------------------------------------------------------------------------- 22(define (jake-mk) (list #t)) 23(define (jake-left? gob) (car gob)) 24(define (jake-left! gob val) (set-car! gob val)) 25 26;;---------------------------------------------------------------------------- 27;; Conv 28;; 29;; Jake / Percy is a gint (two-headed giant) 30;; who lives in the monster village of Kun. 31;; 32;; Jake is the brutish left head, 33;; who acts as the bouncer for the tavern there. 34;; 35;; Percy is the refined right head, 36;; who is the barkeep and proprietor of the tavern there. 37;;---------------------------------------------------------------------------- 38 39(define (left-head? knpc) 40 (jake-left? (gob knpc))) 41(define (left-head! knpc) 42 (jake-left! (gob knpc) #t) 43 (say knpc "RIGHT HERE!")) 44(define (right-head! knpc) 45 (jake-left! (gob knpc) #f) 46 (say knpc "How may I be of service?")) 47 48;; Basics... 49(define (jake-hail knpc kpc) 50 (kern-log-msg "You meet an enormous figure with two heads. One is rough-looking, the other somewhat... " 51 "well, prissy is probably not too strong a word.") 52 (if (left-head? knpc) 53 (say knpc "HAIL, MANLING!") 54 (say knpc "Well met, little sir.") 55 )) 56 57(define (jake-default knpc kpc) 58 (if (left-head? knpc) 59 (say knpc "HELL, I DON'T KNOW! ASK PERCY!") 60 (say knpc "A conundrum, to be sure.") 61 )) 62 63(define (jake-name knpc kpc) 64 (if (left-head? knpc) 65 (say knpc "I'M JAKE! AND THIS OTHER IS PERCY! [The left head jerks to indicate the right]") 66 (say knpc "I am Percival. And my constant companion here likes to be called 'Jake'. [The left head nods to the right]") 67 )) 68 69(define (jake-join knpc kpc) 70 (if (left-head? knpc) 71 (say knpc "HAR! HAR! HAR!") 72 (say knpc "Oh, I'm afraid not. A most gracious offer, though, and all that.") 73 )) 74 75(define (jake-job knpc kpc) 76 (if (left-head? knpc) 77 (say knpc "I'M THE BOUNCER, OF COURSE! NOW DRINK SOMETHING OR GET OUT!") 78 (begin 79 (say knpc "I am the proprieter and bartender. Would you care for a drink?") 80 (if (yes? kpc) 81 (jake-trade knpc kpc) 82 (say knpc "Please reconsider, I offer the finest.") 83 )))) 84 85(define (jake-bye knpc kpc) 86 (if (left-head? knpc) 87 (say knpc "BYE!") 88 (say knpc "Farewell, do come again.") 89 )) 90 91(define (jake-jake knpc kpc) 92 (if (left-head? knpc) 93 (say knpc "YEAH? WHADDAYA WANT?") 94 (begin 95 (say knpc "Do you actually WANT to talk to Jake?") 96 (if (yes? kpc) 97 (left-head! knpc))) 98 )) 99 100(define (jake-perc knpc kpc) 101 (if (left-head? knpc) 102 (begin 103 (say knpc "WHA? YOU WANNA TALK TO PERCY NOW?") 104 (if (yes? kpc) 105 (right-head! knpc) 106 )) 107 (say knpc "Yes, that's me. Can I help you?") 108 )) 109 110(define (jake-drin knpc kpc) 111 (if (left-head? knpc) 112 (say knpc "TALK TO PERCY!") 113 (jake-trade knpc kpc))) 114 115 116;; Trade... 117(define jake-merch-msgs 118 (list nil ;; closed 119 "Let me show you a menu." ;; buy 120 nil ;; sell 121 nil ;; trade 122 "I'm delighted I could be of assistance." ;; bought-something 123 "[sniff] Well, I shan't be offended." ;; bought-nothing 124 nil 125 nil 126 nil 127 nil 128 )) 129 130(define jake-catalog 131 (list 132 (list t_food 7 "My roast lamb is to die for! I'm afraid it's quite wasted on the usual riff-raff.") 133 (list t_beer 4 "I import casks of lager all the way from the famous brewers of Gintspar.") 134 (list t_wine 6 "We get some very good wine from a wrogue who specializes in pilfering wine cellars. I hope you don't recognize any of these bottles... Ahem") 135 )) 136 137(define (jake-trade knpc kpc) (conv-trade knpc kpc "buy" jake-merch-msgs jake-catalog)) 138 139;; Town & Townspeople 140 141;; Quest-related 142 143(define jake-conv 144 (ifc basic-conv 145 146 ;; basics 147 (method 'default jake-default) 148 (method 'hail jake-hail) 149 (method 'bye jake-bye) 150 (method 'job jake-job) 151 (method 'name jake-name) 152 (method 'join jake-join) 153 154 ;; trade 155 (method 'drin jake-drin) 156 (method 'trad jake-trade) 157 (method 'buy jake-trade) 158 159 ;; town & people 160 (method 'jake jake-jake) 161 (method 'perc jake-perc) 162 )) 163 164(define (mk-jake) 165 (bind 166 (kern-mk-char 167 'ch_jake ; tag 168 "Jake&Percival" ; name 169 jake-species ; species 170 jake-occ ; occ 171 s_gint ; sprite 172 faction-men ; starting alignment 173 0 0 0 ; str/int/dex 174 0 0 ; hp mod/mult 175 0 0 ; mp mod/mult 176 max-health ; hp 177 -1 ; xp 178 max-health ; mp 179 0 180 jake-lvl 181 #f ; dead 182 'jake-conv ; conv 183 sch_jake ; sched 184 'townsman-ai ; special ai 185 nil ; container 186 nil ; readied 187 ) 188 (jake-mk))) 189