advent.zil 178 KB
Newer Older
1 2 3
;"Main file for ADVENTURE"
;"Ported to ZIL by Jesse McGrew, July 2015"

Jesse McGrew's avatar
Jesse McGrew committed
4 5 6
;"TODO: DESCRIBE-OBJECTS should mention special LOCAL-GLOBALS?"
;"TODO: Add CANT-GO property?"

7 8 9 10
;----------------------------------------------------------------------
"General directives"
;----------------------------------------------------------------------

Jesse McGrew's avatar
Jesse McGrew committed
11
<VERSION ZIP>
Jesse McGrew's avatar
Jesse McGrew committed
12
<CONSTANT RELEASEID 0>
Jesse McGrew's avatar
Jesse McGrew committed
13
<CONSTANT IFID-ARRAY <PTABLE (STRING) "UUID://0E123F50-20A2-4F5B-8F01-264678ED419D//">>
Jesse McGrew's avatar
Jesse McGrew committed
14

15
<COMPILATION-FLAG DEBUG <>>
16
<COMPILATION-FLAG DEBUGGING-VERBS T>
17

18 19 20 21
;"BETA and DBMAZE are defined by this game. Do not comment out these lines -- that will
  leave the options stuck *on*."
<COMPILATION-FLAG BETA T>      ;"Transcript prompt, lucky number, beta title/credits"
<COMPILATION-FLAG DBMAZE <>>   ;"Gives the maze rooms unique names"
Jesse McGrew's avatar
Jesse McGrew committed
22

23 24 25 26
<CONSTANT GAME-BANNER
    <STRING
        <IFFLAG (BETA "ADVENTURE (beta)|") (ELSE "ADVENTURE|")>
        "A Modern Classic|
Jesse McGrew's avatar
Jesse McGrew committed
27
Based on Adventure by Willie Crowther and Don Woods (1977)|
28
And prior adaptations by David M. Baggett (1993), Graham Nelson (1994), and others|
Jesse McGrew's avatar
Jesse McGrew committed
29
Adapted once more by Jesse McGrew (2015)">>
Jesse McGrew's avatar
Jesse McGrew committed
30

31 32 33 34
;----------------------------------------------------------------------
"Main entry point"
;----------------------------------------------------------------------

Jesse McGrew's avatar
Jesse McGrew committed
35 36 37
<ROUTINE GO ()
    <SETG HERE ,AT-END-OF-ROAD>
    <SETG SCORE 36>
38
    <INIT-STATUS-LINE>
39
    <IF-BETA <SEED-RANDOM>>
40 41 42 43 44
    <SETG MODE ,VERBOSE>
    <CRLF> <CRLF>
    <TELL "Welcome to Adventure! Do you need instructions?">
    <COND (<YES?> <CRLF> <SHOW-HINT ,HNT?INSTRUCTIONS> <CRLF>)>
    <CRLF>
45
    <SETG PREV-SCORE ,SCORE>
46
    <V-VERSION> <CRLF>
Jesse McGrew's avatar
Jesse McGrew committed
47 48 49
    <QUEUE I-DWARF -1>
    <QUEUE I-PIRATE -1>
    <QUEUE I-CAVE-CLOSER -1>
50
    <QUEUE I-OFFER-HINT -1>
Jesse McGrew's avatar
Jesse McGrew committed
51
    <MOVE ,PLAYER ,HERE>
Jesse McGrew's avatar
Jesse McGrew committed
52
    <PUTP ,PLAYER ,P?CAPACITY 35> ;"7 objects at default size 5"
53
    <PUTP ,PLAYER ,P?ACTION ,ADVENT-PLAYER-F>
Jesse McGrew's avatar
Jesse McGrew committed
54 55 56 57 58 59
    <V-LOOK>
    <REPEAT ()
        <COND (<PARSER>
               <PERFORM ,PRSA ,PRSO ,PRSI>
               <COND (<NOT <GAME-VERB?>>
                      <APPLY <GETP ,HERE ,P?ACTION> ,M-END>
60 61 62 63 64 65
                      <CLOCKER>)>
               ;"UPDATE-SCORE-AND-NOTIFY is called explicitly instead of using the interrupt
                 queue: first, because we need to make sure it runs after all other interrupts,
                 since they might affect the score. Second, because we want it to run even on
                 GAME-VERB turns, since debugging verbs can move treasures and affect the score."
               <UPDATE-SCORE-AND-NOTIFY>)>
Jesse McGrew's avatar
Jesse McGrew committed
66 67
        <SETG HERE <LOC ,WINNER>>>>

Jesse McGrew's avatar
Jesse McGrew committed
68 69 70 71 72 73 74 75 76 77
<IF-BETA
    <CONSTANT FORTUNES
        <PLTABLE "Watch out for bugs!"
                 "Full batteries make empty pits."
                 "A bearded man will steal your treasure."
                 "A savage beast will become your friend."
                 "A group of visitors will surprise you with shiny gifts."
                 "Not all questions are rhetorical.">>

    <ROUTINE SEED-RANDOM ("AUX" S)
78 79
        <TELL "Hello, beta tester! Do you want to start transcripting now?">
        <COND (<YES?> <V-SCRIPT>)>
Jesse McGrew's avatar
Jesse McGrew committed
80 81 82
        <SET S <RANDOM 32767>>
        <TELL "[Your fortune for today: \""
              <PICK-ONE-R ,FORTUNES>
83 84
              " Lucky number " N .S ".\"" CR
              "Use XLUCKY " N .S " to replay this game next time.]" CR>
Jesse McGrew's avatar
Jesse McGrew committed
85 86
        <RANDOM <- .S>>>>

87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
<ROUTINE ADVENT-PLAYER-F (ARG "AUX" F)
    <COND (<=? .ARG ,M-WINNER>
           <COND (<VERB? SWIM>
                  ;"Change the default response, but give the location a chance to override it."
                  <COND (<NOT <AND <SET F <GETP ,HERE ,P?ACTION>>
                                   <APPLY .F ,M-BEG>>>
                         <TELL "You don't know how." CR>)>
                  <RTRUE>)
                 (<AND <VERB? CLIMB> <NOT ,PRSO>>
                  <COND (<OR <VISIBLE? <SET F ,PLANT>>
                             <VISIBLE? <SET F ,PLANT-STICKING-UP>>
                             <VISIBLE? <SET F ,SMALL-CLIMBABLE-PIT>>
                             <VISIBLE? <SET F ,MASSIVE-ORANGE-COLUMN>>
                             <VISIBLE? <SET F ,PIT>>>
                         <SETG PRSO .F>
                         <RFALSE>)>)
                 (<AND <VERB? DROP>
                       <=? ,HERE ,INSIDE-BUILDING>
                       <FSET? ,PRSO ,TREASUREBIT>>
                  <COND (<PRE-DROP>)
                        (<AND <SET F <GETP ,PRSO ,P?ACTION>> <APPLY .F>>)
108 109
                        (ELSE
                         <MOVE ,PRSO ,HERE>
110 111
                         <FSET ,PRSO ,TOUCHBIT>
                         <FCLEAR ,PRSO ,WORNBIT>
112 113
                         <COND (<SHORT-REPORT?> <TELL "Safely deposited." CR>)
                               (ELSE <TELL "You safely deposit " T ,PRSO "." CR>)>)>
114 115 116 117 118 119 120
                  <RTRUE>)
                 (<VERB? QUIT>
                  <V-SCORE T>
                  <CRLF>
                  <V-QUIT>
                  <RTRUE>)
                 (<AND <VERB? DROP>
121 122 123 124 125 126 127
                       <OR <AND <PRSO? ,LITTLE-BIRD>
                                <IN? ,LITTLE-BIRD ,WICKER-CAGE>
                                <HELD? ,WICKER-CAGE>>
                           <AND <PRSO? ,BEAR>
                                ,BEAR-FOLLOWING>>>
                  ;"DROP BIRD/BEAR is normally blocked by PRE-DROP, so we intercept it here
                    and redirect to RELEASE BIRD/BEAR."
128
                  <PERFORM ,V?RELEASE ,PRSO>
129 130 131
                  <RTRUE>)
                 (<AND <VERB? THINK-ABOUT>
                       <RESPOND-TO-HINT-REQUEST?>>
132
                  <RTRUE>)>)>
133 134 135
    ;"Fall back to the library's handler."
    <PLAYER-F>>

136 137 138 139 140
;----------------------------------------------------------------------
"Include the standard library"
;----------------------------------------------------------------------

;"This affects the definition of GAME-VERB?."
141
<SETG EXTRA-GAME-VERBS '(SCORE HELP INFO CREDITS)>
142
<IF-BETA <SETG EXTRA-GAME-VERBS (!,EXTRA-GAME-VERBS XLUCKY XLOOT)>>
143

144 145
;"This is used by the debugging verbs.
  Note: TREASUREBIT isn't listed because it's a bit synonym."
146
<SETG EXTRA-FLAGS
147
    '(SACREDBIT MULTITUDEBIT SPRINGBIT LIQUIDBIT SPONGEBIT)>
148

149 150 151 152
;"Override the HAVE check to allow PUT, HAVE, and DROP in a few special situations."
<REPLACE-DEFINITION FAILS-HAVE-CHECK?
    <ROUTINE FAILS-HAVE-CHECK? (OBJ)
        <NOT <OR <HELD? .OBJ>
153 154
                 ;"Allow PUT BIRD IN CAGE, PUT BOTTLED WATER/OIL ON <any>, or
                   PUT [POOL OF] WATER/OIL IN BOTTLE."
155 156
                 <AND <VERB? PUT-IN>
                      <OR <PRSO? ,WATER-IN-BOTTLE ,OIL-IN-BOTTLE>
157 158
                          <AND <PRSO? ,LITTLE-BIRD> <PRSI? ,WICKER-CAGE>>
                          <AND <PRSO? ,STREAM ,OIL> <PRSI? ,BOTTLE>>>>
159 160 161 162 163
                 ;"Allow DROP BIRD and DROP BEAR."
                 <AND <VERB? DROP>
                      <PRSO? ,LITTLE-BIRD ,BEAR>>>>>>

;"We replace a few more library sections below."
164
<DELAY-DEFINITION DARKNESS-F>
165 166
<DELAY-DEFINITION PRINT-GAME-OVER>
<DELAY-DEFINITION RESURRECT?>
167

Jesse McGrew's avatar
Jesse McGrew committed
168 169
<INSERT-FILE "parser">

170 171 172 173
;----------------------------------------------------------------------
"Utilities, properties, globals, and constants"
;----------------------------------------------------------------------

Jesse McGrew's avatar
Jesse McGrew committed
174 175 176 177 178 179 180
;"Utility macro for randomness"
<DEFMAC PROB ('N)
    <FORM L=? '<RANDOM 100> .N>>

;"Properties"
<PROPDEF DEPOSIT-POINTS 10>

181 182 183 184 185 186
;"We're almost over the limit of flags for Z-machine version 3, but we
  can save one flag by making TREASUREBIT a synonym of SACREDBIT. This
  works because SACREDBIT is only for rooms and TREASUREBIT is only for
  things."
<BIT-SYNONYM SACREDBIT TREASUREBIT>

187 188 189 190 191 192 193 194 195 196 197 198 199
;----------------------------------------------------------------------
"Scoring and treasure counting"
;----------------------------------------------------------------------

;"Treasures"
<CONSTANT MAX-TREASURES 15>

<CONSTANT TR-UNFOUND 0>
<CONSTANT TR-TOUCHED 1>
<CONSTANT TR-CARRIED 2>
<CONSTANT TR-DEPOSITED 3>

<CONSTANT ALL-TREASURES
200
    <TABLE %<VERSION? (ZIP '(BYTE)) (ELSE #SPLICE ())>
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
        LARGE-GOLD-NUGGET TR-UNFOUND
        DIAMONDS          TR-UNFOUND
        BARS-OF-SILVER    TR-UNFOUND
        PRECIOUS-JEWELRY  TR-UNFOUND
        RARE-COINS        TR-UNFOUND
        PERSIAN-RUG       TR-UNFOUND
        TREASURE-CHEST    TR-UNFOUND
        GOLDEN-EGGS       TR-UNFOUND
        TRIDENT           TR-UNFOUND
        MING-VASE         TR-UNFOUND
        EGG-SIZED-EMERALD TR-UNFOUND
        PLATINUM-PYRAMID  TR-UNFOUND
        PEARL             TR-UNFOUND
        RARE-SPICES       TR-UNFOUND
        GOLDEN-CHAIN      TR-UNFOUND>>
        
<CONSTANT MAX-SCORE 350>
<GLOBAL PREV-SCORE 0>

<CONSTANT RANKS
    <PLTABLE
        349 "All of adventuredom gives tribute to you, Adventurer Grandmaster!"
        330 "Your score puts you in Master Adventurer Class A."
        300 "Your score puts you in Master Adventurer Class B."
        250 "Your score puts you in Master Adventurer Class C."
        200 "You have reached \"Junior Master\" status."
        130 "You may now consider yourself a \"Seasoned Adventurer\"."
        100 "You have achieved the rating: \"Experienced Adventurer\"."
        35  "Your score qualifies you as a Novice Class Adventurer."
        10  "You are obviously a Rank Amateur. Better luck next time.">>

<SYNTAX SCORE = V-SCORE>

234
<ROUTINE V-SCORE ("OPT" DEAD "AUX" MAX NR)
235
    <TELL "In ">
236
    <COND (<1? ,MOVES> <TELL "1 turn">) (ELSE <TELL N ,MOVES " turns">)>
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
    <TELL ", you">
    <COND (<NOT .DEAD> <TELL "'ve">)>
    <TELL " scored ">
    <COND (<1? ,SCORE> <TELL "1 point">) (ELSE <TELL N ,SCORE " points">)>
    <TELL " out of a possible " N ,MAX-SCORE "." CR>
    <COND (.DEAD
           ;"Announce the player's rating based on their score."
           <SET MAX <GET ,RANKS 0>>
           <DO (I 1 .MAX 2)
               (END ;"Too low for any rating."
                <TELL "Wow." CR>
                <SET NR <- .MAX 1>>)
               <COND (<G? ,SCORE <GET ,RANKS .I>>
                      <TELL <GET ,RANKS <+ .I 1>> CR>
                      <SET I <- .I 2>>
                      <COND (<L? .I 1> <SET NR 0>)
                            (ELSE <SET NR .I>)>
                      <RETURN>)>>
           <TELL "To achieve the next higher rating">
           <COND (.NR
                  <SET NR <+ <- <GET ,RANKS .NR> ,SCORE> 1>>
                  <TELL ", you need " N .NR " more point">
                  <COND (<1? .NR> <TELL "." CR>) (ELSE <TELL "s." CR>)>)
                 (ELSE
                  <TELL " would be a neat trick!|Congratulations!!" CR>)>)>>

263
<ROUTINE UPDATE-SCORE-AND-NOTIFY ("AUX" D T OS NS)
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
    ;"Note any changes in treasure status"
    <DO (I 0 %<* <- ,MAX-TREASURES 1> 2> 2)
        <SET T <GET/B ,ALL-TREASURES .I>>
        <SET OS <GET/B ,ALL-TREASURES <+ .I 1>>>
        <COND (<IN? .T ,INSIDE-BUILDING> <SET NS ,TR-DEPOSITED>)
              (<IN? .T ,WINNER> <SET NS ,TR-CARRIED>)
              (<FSET? .T ,TOUCHBIT> <SET NS ,TR-TOUCHED>)
              (ELSE <SET NS ,TR-UNFOUND>)>
        <COND (<N=? .OS .NS>
               ;"A permanent 2 points for taking it in the first place"
               <COND (<=? .OS ,TR-UNFOUND> <SETG SCORE <+ ,SCORE 2>>)>
               ;"A revocable 5 points for carrying it"
               <COND (<=? .NS ,TR-CARRIED> <SETG SCORE <+ ,SCORE 5>>)
                     (<=? .OS ,TR-CARRIED> <SETG SCORE <- ,SCORE 5>>)>
               ;"A revocable ${DEPOSIT-POINTS} points for placing it in INSIDE-BUILDING"
               <COND (<=? .NS ,TR-DEPOSITED>
                      <SETG SCORE <+ ,SCORE <GETP .T ,P?DEPOSIT-POINTS>>>)
                     (<=? .OS ,TR-DEPOSITED>
                      <SETG SCORE <- ,SCORE <GETP .T ,P?DEPOSIT-POINTS>>>)>
               <PUT/B ,ALL-TREASURES <+ .I 1> .NS>)>>
    ;"Notify player if score has changed"
    <SET D <- ,SCORE ,PREV-SCORE>>
    <COND (.D
           <TELL CR "[Your score has gone">
           <COND (<G? .D 0>
                  <TELL " up">)
                 (ELSE
                  <SET D <- .D>>
                  <TELL " down">)>
           <TELL " by " N .D " point">
           <COND (<NOT <1? .D>> <TELL !\s>)>
           <TELL ".]" CR>)>
    <SETG PREV-SCORE ,SCORE>
    <T? .D>>

Jesse McGrew's avatar
Jesse McGrew committed
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
;----------------------------------------------------------------------
"The outside world"
;----------------------------------------------------------------------

<ROOM AT-END-OF-ROAD
    (DESC "At End Of Road")
    (IN ROOMS)
    (GLOBAL WELL-HOUSE STREAM ROAD FOREST)
    (LDESC "You are standing at the end of a road before a small brick building.
Around you is a forest.
A small stream flows out of the building and down a gully.")
    (WEST TO AT-HILL-IN-ROAD)
    (UP TO AT-HILL-IN-ROAD)
    (EAST TO INSIDE-BUILDING)
    (DOWN TO IN-A-VALLEY)
    (SOUTH TO IN-A-VALLEY)
    (NORTH PER RANDOM-FOREST)
    (IN TO INSIDE-BUILDING)
    (FLAGS LIGHTBIT SACREDBIT)>

<OBJECT WELL-HOUSE
    (DESC "well house")
    (IN LOCAL-GLOBALS)
    (SYNONYM WELL HOUSE BUILDING WELLHOUSE)
    (ADJECTIVE WELL BRICK SMALL)
    (TEXT "It's a small brick building. It seems to be a well house.")
    (ACTION WELL-HOUSE-F)>

<ROUTINE WELL-HOUSE-F ()
    <COND (<VERB? ENTER>
           <COND (<AND <IN? ,WINNER ,AT-HILL-IN-ROAD>
                       <NOT <FSET? ,INSIDE-BUILDING ,TOUCHBIT>>>
                  <TELL "It's too far away." CR>)
                 (ELSE <GOTO ,INSIDE-BUILDING>)>)>>

<OBJECT STREAM
    (DESC "stream")
    (IN LOCAL-GLOBALS)
337
    (SYNONYM STREAM WATER ;BROOK ;RIVER LAKE RESERVOIR)
Jesse McGrew's avatar
Jesse McGrew committed
338
    (ADJECTIVE SMALL TUMBLING SPLASHING BABBLING RUSHING)
339
    (ACTION STREAM-F)
340
    (GENERIC WATER-GENERIC)
341
    (FLAGS SPRINGBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
342

343
<ROUTINE STREAM-F ("AUX" ENDS-HERE? OUTSIDE?)
Jesse McGrew's avatar
Jesse McGrew committed
344
    <COND (<VERB? DRINK>
345
           <TELL "The water tastes strongly of ">
346 347 348 349 350
           ;"Inspired by a typo that was too amusing to take out..."
           <COND (<PROB 95> <TELL "minerals">)
                 (<PROB 50> <TELL "animals">)
                 (ELSE <TELL "vegetables">)>
           <TELL ", but is not unpleasant. It is extremely cold." CR>)
Jesse McGrew's avatar
Jesse McGrew committed
351 352
          (<VERB? TAKE>
           <COND (<HELD? ,BOTTLE>
353
                  <PERFORM ,V?FILL-WITH ,BOTTLE ,STREAM>
Jesse McGrew's avatar
Jesse McGrew committed
354 355 356
                  <RTRUE>)
                 (ELSE <TELL "You have nothing in which to carry the water." CR>)>)
          (<AND <VERB? PUT-IN> <PRSI? ,STREAM>>
357 358
           <SET ENDS-HERE? <=? ,HERE ,IN-PIT ,AT-SLIT-IN-STREAMBED>>
           <SET OUTSIDE? <AND <FSET? ,HERE ,LIGHTBIT> <FSET? ,HERE ,SACREDBIT>>>
Jesse McGrew's avatar
Jesse McGrew committed
359 360
           <COND (<PRSO? ,MING-VASE>
                  <REMOVE ,PRSO>
361 362 363 364 365 366 367
                  <TELL "The sudden change in temperature has delicately shattered the vase">
                  <COND (.ENDS-HERE?
                         <MOVE ,SHARDS ,HERE>
                         <TELL "." CR>)
                        (ELSE
                         <COND (.OUTSIDE? <MOVE ,SHARDS ,AT-SLIT-IN-STREAMBED>)>
                         <TELL ", and the shards wash away with the stream." CR>)>)
Jesse McGrew's avatar
Jesse McGrew committed
368
                 (<PRSO? ,BOTTLE>
369
                  <PERFORM ,V?FILL-WITH ,BOTTLE ,STREAM>
Jesse McGrew's avatar
Jesse McGrew committed
370
                  <RTRUE>)
371 372 373 374
                 (<PRSO? ,LITTLE-BIRD>
                  <FSET ,WICKER-CAGE ,OPENBIT>
                  <MOVE ,LITTLE-BIRD ,HERE>
                  <TELL CT ,LITTLE-BIRD " splashes cheerfully, then flies out of the water." CR>)
375 376 377
                 (.ENDS-HERE?
                  <PERFORM ,V?DROP ,PRSO>
                  <RTRUE>)
Jesse McGrew's avatar
Jesse McGrew committed
378
                 (ELSE
379 380
                  <COND (.OUTSIDE? <MOVE ,PRSO ,AT-SLIT-IN-STREAMBED>)
                        (ELSE <REMOVE ,PRSO>)>
381 382 383 384 385
                  <COND (<SHORT-REPORT?> <TELL "Washed away." CR>)
                        (ELSE
                         <TELL CT ,PRSO " wash">
                         <COND (<NOT <FSET? ,PRSO ,PLURALBIT>> <TELL "es">)>
                         <TELL " away with the stream." CR>)>)>)
386 387
          (<VERB? ENTER>
           <TELL "Your feet are now wet." CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420

<OBJECT ROAD
    (DESC "road")
    (IN LOCAL-GLOBALS)
    (SYNONYM ROAD STREET PATH DIRT)
    (TEXT "The road is dirt, not yellow brick.")>

<OBJECT FOREST
    (DESC "forest")
    (IN LOCAL-GLOBALS)
    (SYNONYM FOREST TREE TREES ;OAK ;MAPLE ;GROVE ;PINE ;SPRUCE ;BIRCH ;ASH
             ;SAPLINGS ;BUSHES ;LEAVES ;BERRY ;BERRIES ;HARDWOOD)
    (TEXT "The trees of the forest are large hardwood oak and maple, with an
occasional grove of pine or spruce.
There is quite a bit of undergrowth, largely birch and ash saplings plus
nondescript bushes of various sorts.
This time of year visibility is quite restricted by all the leaves, but travel
is quite easy if you detour around all the spruce and berry bushes.")
    (FLAGS MULTITUDEBIT)>

;----------------------------------------------------------------------

<ROOM AT-HILL-IN-ROAD
    (DESC "At Hill In Road")
    (IN ROOMS)
    (GLOBAL WELL-HOUSE ROAD FOREST)
    (LDESC "You have walked up a hill, still in the forest.
The road slopes back down the other side of the hill.
There is a building in the distance.")
    (EAST TO AT-END-OF-ROAD)
    (NORTH TO AT-END-OF-ROAD)
    (DOWN TO AT-END-OF-ROAD)
    (SOUTH PER RANDOM-FOREST)
421 422
    (THINGS <>    (HILL BUMP INCLINE) "It's just a typical hill."
            OTHER SIDE                "Why not explore it yourself?")
Jesse McGrew's avatar
Jesse McGrew committed
423 424 425 426 427 428 429
    (FLAGS LIGHTBIT SACREDBIT)>

;----------------------------------------------------------------------

<ROOM INSIDE-BUILDING
    (DESC "Inside Building")
    (IN ROOMS)
430
    (GLOBAL WELL-HOUSE STREAM)
Jesse McGrew's avatar
Jesse McGrew committed
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
    (LDESC "You are inside a building, a well house for a large spring.")
    (ACTION INSIDE-BUILDING-F)
    (WEST TO AT-END-OF-ROAD)
    (OUT TO AT-END-OF-ROAD)
    (IN SORRY "The pipes are too small.")
    (FLAGS LIGHTBIT SACREDBIT)>

<CONSTANT STREAM-FLOWS-OUT
    "The stream flows out through a pair of 1 foot diameter sewer pipes.">

<ROUTINE INSIDE-BUILDING-F (RARG)
    <COND (<=? .RARG ,M-BEG>
           <COND (<AND <VERB? WALK> <0? <GETPT ,HERE ,PRSO>>>
                  <TELL ,STREAM-FLOWS-OUT CR "The only exit is to the west." CR>)
                 (<AND <VERB? ENTER> <PRSO? ,SPRING ,SEWER-PIPES>>
                  <TELL ,STREAM-FLOWS-OUT CR "It would be advisable to use the exit." CR>)
                 (<VERB? XYZZY>
                  <GOTO ,IN-DEBRIS-ROOM>
                  <RTRUE>)
                 (<VERB? PLUGH>
                  <GOTO ,AT-Y2>
                  <RTRUE>)>)>>

<OBJECT SPRING
    (DESC "spring")
    (IN INSIDE-BUILDING)
457
    (SYNONYM SPRING)
Jesse McGrew's avatar
Jesse McGrew committed
458 459
    (ADJECTIVE LARGE)
    (TEXT ,STREAM-FLOWS-OUT)
460
    (FLAGS NDESCBIT SPRINGBIT)
461 462 463 464
    (ACTION SPRING-F)>

<ROUTINE SPRING-F ()
    <COND (<VERB? DRINK> <TELL ,STREAM-FLOWS-OUT CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
465 466 467 468

<OBJECT SEWER-PIPES
    (DESC "pair of 1 foot diameter sewer pipes")
    (IN INSIDE-BUILDING)
469
    (SYNONYM PAIR PIPES PIPE)
Jesse McGrew's avatar
Jesse McGrew committed
470
    (ADJECTIVE PAIR FOOT DIAMETER SEWER)
471 472
    (TEXT "Too small to fit inside.")
    (ACTION SEWER-PIPES-F)
Jesse McGrew's avatar
Jesse McGrew committed
473 474
    (FLAGS NDESCBIT)>

475 476 477 478 479
<ROUTINE SEWER-PIPES-F ()
    <COND (<AND <VERB? PUT-IN> <PRSI? ,SEWER-PIPES>>
           <PERFORM ,V?PUT-IN ,PRSO ,STREAM>
           <RTRUE>)>>

Jesse McGrew's avatar
Jesse McGrew committed
480 481 482 483
<OBJECT SET-OF-KEYS
    (DESC "set of keys")
    (SYNONYM KEY KEYS KEYRING SET)
    (ADJECTIVE SET)
484
    (PRONOUN IT THEM)
Jesse McGrew's avatar
Jesse McGrew committed
485 486 487 488
    (IN INSIDE-BUILDING)
    (FDESC "There are some keys on the ground here.")
    (TEXT "It's just a normal-looking set of keys.")
    (ACTION SET-OF-KEYS-F)
489
    (FLAGS TAKEBIT TOOLBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
490 491 492 493 494 495 496

<ROUTINE SET-OF-KEYS-F ()
    <COND (<VERB? COUNT> <TELL "A dozen or so keys." CR>)>>

<OBJECT TASTY-FOOD
    (DESC "tasty food")
    (IN INSIDE-BUILDING)
497
    (SYNONYM FOOD RATION TRIPE RATIONS)
Jesse McGrew's avatar
Jesse McGrew committed
498
    (ADJECTIVE YUMMY TASTY DELICIOUS SCRUMPTIOUS)
Jesse McGrew's avatar
Jesse McGrew committed
499
    (ARTICLE "some")
Jesse McGrew's avatar
Jesse McGrew committed
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
    (FDESC "There is tasty food here.")
    (TEXT "Sure looks yummy!")
    (ACTION TASTY-FOOD-F)
    (FLAGS TAKEBIT EDIBLEBIT)>

<ROUTINE TASTY-FOOD-F ()
    <COND (<VERB? EAT>
           <TELL "Delicious!" CR>
           <REMOVE ,TASTY-FOOD>)>>

<OBJECT BRASS-LANTERN
    (DESC "brass lantern")
    (IN INSIDE-BUILDING)
    (SYNONYM LAMP HEADLAMP LANTERN LIGHT)
    (ADJECTIVE SHINY BRASS)
    (DESCFCN BRASS-LANTERN-DESCFCN)
    (ACTION BRASS-LANTERN-F)
    (FLAGS TAKEBIT DEVICEBIT)>

<ROUTINE BRASS-LANTERN-DESCFCN (ARG)
    <COND (<=? .ARG ,M-OBJDESC?> <RTRUE>)
          (<FSET? ,BRASS-LANTERN ,LIGHTBIT>
522 523
           <TELL "Your lamp is here, gleaming brightly." CR>)
          (ELSE <TELL "There is a shiny brass lamp nearby." CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
524 525 526 527

<ROUTINE BRASS-LANTERN-F ()
    <COND (<VERB? EXAMINE>
           <TELL "It is a shiny brass lamp">
528
           <COND (<NOT <FSET? ,PRSO ,LIGHTBIT>>
Jesse McGrew's avatar
Jesse McGrew committed
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
                  <TELL ". It is not currently lit." CR>)
                 (<L? ,LANTERN-POWER 30>
                  <TELL ", glowing dimly." CR>)
                 (ELSE <TELL ", glowing brightly." CR>)>)
          (<VERB? BURN>
           <PERFORM ,V?TURN-ON ,PRSO>
           <RTRUE>)
          (<VERB? RUB>
           <TELL "Rubbing the electric lamp is not particularly rewarding.
Anyway, nothing happens." CR>)
          (<VERB? TURN-ON>
           <COND (<L=? ,LANTERN-POWER 0>
                  <TELL "Unfortunately, the batteries seem to be dead." CR>
                  <RTRUE>)>
           <FSET ,PRSO ,LIGHTBIT>
           <OR <RUNNING? ,I-BRASS-LANTERN> <QUEUE I-BRASS-LANTERN -1>>
           <V-TURN-ON>
           <NOW-LIT?>
           <RTRUE>)
          (<VERB? TURN-OFF>
           <FCLEAR ,PRSO ,LIGHTBIT>
           <V-TURN-OFF>
           <NOW-DARK?>
           <RTRUE>)
          (<AND <VERB? PUT-IN> <PRSI? ,BRASS-LANTERN>>
           <COND (<PRSO? ,OLD-BATTERIES>
                  <TELL "Those batteries are dead; they won't do any good at all." CR>)
                 (<PRSO? ,FRESH-BATTERIES>
                  <REPLACE-LANTERN-BATTERIES>
                  <RTRUE>)
                 (ELSE
                  <TELL "The only thing you might successfully put in the lamp is a fresh pair of batteries." CR>)>)>>

<GLOBAL LANTERN-POWER 330>

<ROUTINE REPLACE-LANTERN-BATTERIES ()
    <COND (<OR <IN? ,FRESH-BATTERIES ,HERE> <HELD? ,FRESH-BATTERIES>>
           <REMOVE ,FRESH-BATTERIES>
           <SETG FRESH-BATTERIES-USED T>
           <MOVE ,OLD-BATTERIES ,HERE>
           <SETG LANTERN-POWER 2500>
           <TELL "I'm taking the liberty of replacing the batteries." CR>)>>

<ROUTINE I-BRASS-LANTERN ()
    ;"Dequeue the event if the lantern is off"
    <COND (<NOT <FSET? ,BRASS-LANTERN ,LIGHTBIT>>
           <DEQUEUE I-BRASS-LANTERN>
           <RFALSE>)>
    ;"Drain power and turn lamp off if dead"
    <COND (<DLESS? LANTERN-POWER 1>
           <FCLEAR ,BRASS-LANTERN ,LIGHTBIT>
580 581
           <FCLEAR ,BRASS-LANTERN ,ONBIT>
           <NOW-DARK?>)>
Jesse McGrew's avatar
Jesse McGrew committed
582 583 584 585 586 587
    ;"Report anything interesting"
    <COND (<VISIBLE? ,BRASS-LANTERN>
           <COND (<0? ,LANTERN-POWER>
                  <TELL "Your lamp has run out of power.">
                  <COND (<NOT <OR <HELD? ,FRESH-BATTERIES>
                                  <FSET? ,HERE ,LIGHTBIT>>>
588
                         <SETG LAMP-RAN-OUT T>
Jesse McGrew's avatar
Jesse McGrew committed
589 590 591 592 593 594 595 596 597
                         <JIGS-UP " You can't explore the cave without a lamp. So let's just call it a day.">)
                        (ELSE <REPLACE-LANTERN-BATTERIES>)>
                  <CRLF>
                  <RTRUE>)
                 (<=? ,LANTERN-POWER 30>
                  <TELL "Your lamp is getting dim.">
                  <COND (,FRESH-BATTERIES-USED
                         <TELL " You're also out of spare batteries. You'd best start wrapping this up." CR>)
                        (<AND <IN? ,FRESH-BATTERIES ,VENDING-MACHINE>
598
                              <FSET? ,VENDING-DEAD-END ,TOUCHBIT>>
Jesse McGrew's avatar
Jesse McGrew committed
599 600 601 602 603 604 605 606 607 608 609 610 611
                         <TELL " You'd best start wrapping this up, unless you can find some fresh batteries.
I seem to recall there's a vending machine in the maze. Bring some coins with you.">)
                        (<NOT <OR <IN? ,FRESH-BATTERIES ,VENDING-MACHINE>
                                  <IN? ,FRESH-BATTERIES ,HERE>
                                  <HELD? ,FRESH-BATTERIES>>>
                         <TELL " You'd best go back for those batteries.">)>
                  <CRLF>
                  <RTRUE>)>)>>

<OBJECT BOTTLE
    (DESC "bottle")
    (IN INSIDE-BUILDING)
    (SYNONYM BOTTLE JAR FLASK)
612
    (ADJECTIVE EMPTY)
613
    (DESCFCN BOTTLE-DESCFCN)
Jesse McGrew's avatar
Jesse McGrew committed
614 615 616 617
    (ACTION BOTTLE-F)
    (CONTFCN BOTTLE-CONTFCN)
    (FLAGS TAKEBIT CONTBIT OPENBIT)>

618
<ROUTINE BOTTLE-F ("AUX" F S)
619
    <COND (<AND <VERB? FILL-WITH> <PRSO? ,BOTTLE>>
Jesse McGrew's avatar
Jesse McGrew committed
620 621
           <COND (<FIRST? ,PRSO>
                  <TELL CT ,PRSO " is full already." CR>)
622
                 (<PRSI? ,STREAM ,SPRING>
Jesse McGrew's avatar
Jesse McGrew committed
623 624
                  <MOVE ,WATER-IN-BOTTLE ,PRSO>
                  <TELL CT ,PRSO " is now full of water." CR>)
625
                 (<PRSI? ,OIL>
Jesse McGrew's avatar
Jesse McGrew committed
626 627
                  <MOVE ,OIL-IN-BOTTLE ,PRSO>
                  <TELL CT ,PRSO " is now full of oil." CR>)
628 629 630 631
                 (ELSE
                  <TELL CT ,PRSO " is only supposed to hold liquids." CR>)>)
          (<AND <VERB? FILL> <SET F <FIND-IN ,HERE ,SPRINGBIT "from">>>
           <PERFORM ,V?FILL-WITH ,PRSO .F>)
Jesse McGrew's avatar
Jesse McGrew committed
632 633 634
          (<VERB? EMPTY>
           <COND (<NOT <SET F <FIRST? ,PRSO>>>
                  <TELL CT ,PRSO " is already empty!" CR>)
635 636
                 (<SET S <FIND-IN ,HERE ,SPONGEBIT "onto">>
                  <PERFORM ,V?POUR .F .S>)
Jesse McGrew's avatar
Jesse McGrew committed
637 638 639 640
                 (ELSE
                  <REMOVE .F>
                  <TELL "Your " D ,PRSO " is now empty and the ground is now wet." CR>)>)
          (<AND <VERB? PUT-IN> <PRSI? ,BOTTLE>>
641
           <PERFORM ,V?FILL-WITH ,PRSI ,PRSO>)>>
Jesse McGrew's avatar
Jesse McGrew committed
642

643 644 645 646 647 648 649
<ROUTINE BOTTLE-DESCFCN (ARG "AUX" F)
    <COND (<=? .ARG ,M-OBJDESC?> <RTRUE>)
          (<SET F <FIRST? ,BOTTLE>>
           <TELL "There is a bottle here, containing " A .F "." CR>)
          (ELSE
           <TELL "There is an empty bottle here." CR>)>>

Jesse McGrew's avatar
Jesse McGrew committed
650 651 652 653 654
<ROUTINE BOTTLE-CONTFCN ()
    <COND (<VERB? TAKE> <TELL "You're holding that already (in " T ,BOTTLE ")." CR>)>>

<OBJECT WATER-IN-BOTTLE
    (DESC "bottled water")
655
    (IN BOTTLE)
Jesse McGrew's avatar
Jesse McGrew committed
656
    (ARTICLE "some")
Jesse McGrew's avatar
Jesse McGrew committed
657
    (SYNONYM WATER H2O)
658
    (ADJECTIVE BOTTLED)
Jesse McGrew's avatar
Jesse McGrew committed
659
    (TEXT "It looks like ordinary water to me.")
660
    (SIZE 0)    ;"Doesn't count against inventory limit"
661
    (ACTION WATER-IN-BOTTLE-F)
662
    (GENERIC WATER-GENERIC)
663
    (FLAGS LIQUIDBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
664 665 666 667 668

<ROUTINE WATER-IN-BOTTLE-F ()
    <COND (<VERB? DRINK>
           <REMOVE ,PRSO>
           <PERFORM ,V?DRINK ,STREAM>
669 670 671
           <RTRUE>)
          (<AND <VERB? PUT-ON> <PRSO? ,WATER-IN-BOTTLE>>
           <PERFORM ,V?POUR ,PRSO ,PRSI>
Jesse McGrew's avatar
Jesse McGrew committed
672 673
           <RTRUE>)>>

674 675 676 677
<ROUTINE WATER-GENERIC (TBL)
    <COND (<VERB? DRINK POUR> ,WATER-IN-BOTTLE)
          (<VERB? PUT-IN> ,STREAM)>>

Jesse McGrew's avatar
Jesse McGrew committed
678 679
<OBJECT OIL-IN-BOTTLE
    (DESC "bottled oil")
Jesse McGrew's avatar
Jesse McGrew committed
680
    (ARTICLE "some")
Jesse McGrew's avatar
Jesse McGrew committed
681
    (SYNONYM OIL LUBRICANT GREASE)
682
    (ADJECTIVE BOTTLED)
Jesse McGrew's avatar
Jesse McGrew committed
683
    (TEXT "It looks like ordinary oil to me.")
684
    (SIZE 0)    ;"Doesn't count against inventory limit"
685
    (ACTION OIL-IN-BOTTLE-F)
686
    (GENERIC OIL-GENERIC)
687
    (FLAGS LIQUIDBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
688 689 690 691 692

<ROUTINE OIL-IN-BOTTLE-F ()
    <COND (<VERB? DRINK>
           ;"The response to DRINK OIL is to refuse, so we don't remove the object."
           <PERFORM ,V?DRINK ,OIL>
693 694 695
           <RTRUE>)
          (<AND <VERB? PUT-ON> <PRSO? ,OIL-IN-BOTTLE>>
           <PERFORM ,V?POUR ,PRSO ,PRSI>
Jesse McGrew's avatar
Jesse McGrew committed
696 697
           <RTRUE>)>>

698 699 700 701
<ROUTINE OIL-GENERIC (TBL)
    <COND (<VERB? DRINK POUR> ,OIL-IN-BOTTLE)
          (<VERB? PUT-IN> ,OIL)>>

Jesse McGrew's avatar
Jesse McGrew committed
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742
;----------------------------------------------------------------------

<ROOM IN-FOREST-1
    (DESC "In Forest")
    (IN ROOMS)
    (GLOBAL FOREST)
    (LDESC "You are in open forest, with a deep valley to one side.")
    (EAST TO IN-A-VALLEY)
    (DOWN TO IN-A-VALLEY)
    (NORTH PER RANDOM-FOREST)
    (WEST PER RANDOM-FOREST)
    (SOUTH PER RANDOM-FOREST)
    (FLAGS LIGHTBIT SACREDBIT)>

<ROOM IN-FOREST-2
    (DESC "In Forest")
    (IN ROOMS)
    (GLOBAL ROAD FOREST)
    (LDESC "You are in open forest near both a valley and a road.")
    (NORTH TO AT-END-OF-ROAD)
    (EAST TO IN-A-VALLEY)
    (WEST TO IN-A-VALLEY)
    (DOWN TO IN-A-VALLEY)
    (SOUTH PER RANDOM-FOREST)
    (FLAGS LIGHTBIT SACREDBIT)>

<ROUTINE RANDOM-FOREST ()
    <COND (<=? <RANDOM 2> 1> ,IN-FOREST-1)
          (ELSE ,IN-FOREST-2)>>

<ROOM IN-A-VALLEY
    (DESC "In A Valley")
    (IN ROOMS)
    (GLOBAL STREAM FOREST)
    (LDESC "You are in a valley in the forest beside a stream tumbling along a rocky bed.")
    (NORTH TO AT-END-OF-ROAD)
    (EAST PER RANDOM-FOREST)
    (WEST PER RANDOM-FOREST)
    (UP PER RANDOM-FOREST)
    (SOUTH TO AT-SLIT-IN-STREAMBED)
    (DOWN TO AT-SLIT-IN-STREAMBED)
743 744 745
    ;"In V3, STREAMBED collides with STREAM, but real objects are matched before
      pseudo-objects so there's no ambiguity."
    (THINGS (SMALL ROCKY BARE DRY STREAM) (BED ROCK STREAMBED) "It's a typical streambed.")
Jesse McGrew's avatar
Jesse McGrew committed
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
    (FLAGS LIGHTBIT SACREDBIT)>

;----------------------------------------------------------------------

<CONSTANT YOU-DONT-FIT "You don't fit through a two-inch slit!">

<ROOM AT-SLIT-IN-STREAMBED
    (DESC "At Slit In Streambed")
    (IN ROOMS)
    (GLOBAL STREAM)
    (LDESC "At your feet all the water of the stream splashes into a 2-inch slit in the rock.
Downstream the streambed is bare rock.")
    (NORTH TO IN-A-VALLEY)
    (EAST PER RANDOM-FOREST)
    (WEST PER RANDOM-FOREST)
    (SOUTH TO OUTSIDE-GRATE)
    (DOWN SORRY ,YOU-DONT-FIT)
    (IN SORRY ,YOU-DONT-FIT)
764
    (THINGS (TWO INCH 2-INCH) SLIT 2-INCH-SLIT-F)
Jesse McGrew's avatar
Jesse McGrew committed
765 766 767
    (FLAGS LIGHTBIT SACREDBIT)>

<ROUTINE 2-INCH-SLIT-F ()
768 769 770
    <COND (<VERB? EXAMINE>
           <TELL "It's just a 2-inch slit in the rock, through which the stream is flowing." CR>)
          (<VERB? ENTER> <TELL ,YOU-DONT-FIT CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786

;----------------------------------------------------------------------

<ROOM OUTSIDE-GRATE
    (DESC "Outside Grate")
    (IN ROOMS)
    (GLOBAL GRATE)
    (LDESC "You are in a 20-foot depression floored with bare dirt.
Set into the dirt is a strong steel grate mounted in concrete.
A dry streambed leads into the depression.")
    (EAST PER RANDOM-FOREST)
    (WEST PER RANDOM-FOREST)
    (SOUTH PER RANDOM-FOREST)
    (NORTH TO AT-SLIT-IN-STREAMBED)
    (DOWN TO BELOW-THE-GRATE IF GRATE IS OPEN)
    (ACTION OUTSIDE-GRATE-F)
787
    (THINGS (TWENTY FOOT BARE 20-FOOT) (DEPRESSION DIRT) "You're standing in it.")
Jesse McGrew's avatar
Jesse McGrew committed
788 789 790
    (FLAGS LIGHTBIT SACREDBIT)>

<ROUTINE OUTSIDE-GRATE-F (RARG)
791
    <COND (<=? .RARG ,M-FLASH>
Jesse McGrew's avatar
Jesse McGrew committed
792
           ;"Since the grate isn't actually in the room, describe it here"
793
           <MAYBE-DESCRIBE-GRATE>)
Jesse McGrew's avatar
Jesse McGrew committed
794 795 796 797 798 799 800 801 802 803
          (<AND <=? .RARG ,M-BEG>
                <VERB? WALK>
                <PRSO? ,P?DOWN>
                <NOT <FSET? ,GRATE ,LOCKEDBIT>>
                <NOT <FSET? ,GRATE ,OPENBIT>>>
           <TELL "[first opening " T ,GRATE "]" CR>
           <FSET ,GRATE ,OPENBIT>
           ;"Return false to continue handling WALK"
           <RFALSE>)>>

804 805 806 807 808 809 810 811
<ROUTINE MAYBE-DESCRIBE-GRATE ()
    <COND (<FSET? ,GRATE ,OPENBIT>
           <THIS-IS-IT ,GRATE>
           <TELL CR "The grate stands open." CR>)
          (<NOT <FSET? ,GRATE ,LOCKEDBIT>>
           <THIS-IS-IT ,GRATE>
           <TELL CR "The grate is unlocked but shut." CR>)>>

Jesse McGrew's avatar
Jesse McGrew committed
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848
<OBJECT GRATE
    (DESC "steel grate")
    (IN LOCAL-GLOBALS)
    (SYNONYM GRATE LOCK GATE GRATING)
    (ADJECTIVE METAL STRONG STEEL)
    (TEXT "It just looks like an ordinary grate mounted in concrete.")
    (ACTION GRATE-F)
    (FLAGS DOORBIT OPENABLEBIT LOCKEDBIT)>

<ROUTINE GRATE-F ()
    <COND (<AND <VERB? LOCK UNLOCK> <PRSO? ,GRATE>>
           <COND (<NOT <PRSI? ,SET-OF-KEYS>>
                  <TELL CT ,PRSI " won't fit the lock." CR>)
                 (<VERB? LOCK>
                  <COND (<FSET? ,PRSO ,LOCKEDBIT>
                         <TELL "It's already locked." CR>)
                        (ELSE
                         <FSET ,PRSO ,LOCKEDBIT>
                         <TELL "Locked." CR>)>)
                 (ELSE
                  <COND (<FSET? ,PRSO ,LOCKEDBIT>
                         <FCLEAR ,PRSO ,LOCKEDBIT>
                         <TELL "Unlocked." CR>)
                        (ELSE <TELL "It's already unlocked." CR>)>)>)>>

;----------------------------------------------------------------------
"Facilis descensus Averno..."
;----------------------------------------------------------------------

<ROOM BELOW-THE-GRATE
    (DESC "Below the Grate")
    (IN ROOMS)
    (LDESC "You are in a small chamber beneath a 3x3 steel grate to the surface.
A low crawl over cobbles leads inward to the west.")
    (GLOBAL GRATE COBBLES)
    (WEST TO IN-COBBLE-CRAWL)
    (UP TO OUTSIDE-GRATE IF GRATE IS OPEN)
849
    (ACTION BELOW-THE-GRATE-F)
Jesse McGrew's avatar
Jesse McGrew committed
850 851
    (FLAGS LIGHTBIT)>

852 853 854
<ROUTINE BELOW-THE-GRATE-F (RARG)
    <COND (<=? .RARG ,M-FLASH>
           ;"Since the grate isn't actually in the room, describe it here"
855
           <MAYBE-DESCRIBE-GRATE>)>>
856

Jesse McGrew's avatar
Jesse McGrew committed
857 858 859
<OBJECT COBBLES
    (DESC "cobbles")
    (IN LOCAL-GLOBALS)
860 861 862 863
    (SYNONYM COBBLE STONES STONE
        ;"V3 property size is limited to 8 bytes, and these collide anyway"
        %<VERSION? (ZIP #SPLICE ())
                   (ELSE #SPLICE (COBBLES COBBLESTONES))>)
Jesse McGrew's avatar
Jesse McGrew committed
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881
    (TEXT "They're just ordinary cobbles.")
    (FLAGS PLURALBIT MULTITUDEBIT)>

;----------------------------------------------------------------------

<ROOM IN-COBBLE-CRAWL
    (DESC "In Cobble Crawl")
    (IN ROOMS)
    (LDESC "You are crawling over cobbles in a low passage.
There is a dim light at the east end of the passage.")
    (GLOBAL COBBLES)
    (EAST TO BELOW-THE-GRATE)
    (WEST TO IN-DEBRIS-ROOM)
    (FLAGS LIGHTBIT)>

<OBJECT WICKER-CAGE
    (DESC "wicker cage")
    (IN IN-COBBLE-CRAWL)
882 883
    (SYNONYM CAGE)
    (ADJECTIVE SMALL WICKER)
Jesse McGrew's avatar
Jesse McGrew committed
884 885 886 887 888 889 890
    (FDESC "There is a small wicker cage discarded nearby.")
    (TEXT "It's a small wicker cage.")
    (ACTION WICKER-CAGE-F)
    (FLAGS TAKEBIT CONTBIT OPENBIT OPENABLEBIT TRANSBIT)>

<ROUTINE WICKER-CAGE-F ()
    <COND (<AND <VERB? OPEN> <IN? ,LITTLE-BIRD ,PRSO>>
891 892
           <TELL "(releasing " T ,LITTLE-BIRD ")" CR>
           <PERFORM ,V?RELEASE ,LITTLE-BIRD>
893 894 895 896 897
           <RTRUE>)
          (<AND <VERB? PUT-IN>
                <PRSI? ,WICKER-CAGE>
                <NOT <PRSO? ,LITTLE-BIRD>>>
           <TELL CT ,PRSI " won't hold " T ,PRSO "." CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912

;----------------------------------------------------------------------

<ROOM IN-DEBRIS-ROOM
    (DESC "In Debris Room")
    (IN ROOMS)
    (LDESC "You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris here, but an
awkward canyon leads upward and west.||
A note on the wall says, \"Magic word XYZZY.\"")
    (GLOBAL COBBLES)
    (EAST TO IN-COBBLE-CRAWL)
    (UP TO IN-AWKWARD-SLOPING-E/W-CANYON)
    (WEST TO IN-AWKWARD-SLOPING-E/W-CANYON)
    (ACTION IN-DEBRIS-ROOM-F)
913 914
    (THINGS <> (DEBRIS STUFF MUD) "Yuck."
            <> NOTE               ([READ EXAMINE] "The note says \"Magic word XYZZY\"."))
Jesse McGrew's avatar
Jesse McGrew committed
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943
    (FLAGS SACREDBIT)>

<ROUTINE IN-DEBRIS-ROOM-F (RARG)
    <COND (<AND <=? .RARG ,M-BEG> <VERB? XYZZY>>
           <GOTO ,INSIDE-BUILDING>
           <RTRUE>)>>

<OBJECT BLACK-ROD
    (DESC "black rod with a rusty star on the end")
    (IN IN-DEBRIS-ROOM)
    (SYNONYM ROD STAR)
    (ADJECTIVE BLACK RUSTY THREE FOOT IRON)
    (FDESC "A three foot black rod with a rusty star on one end lies nearby.")
    (TEXT "It's a three foot black rod with a rusty star on an end.")
    (ACTION BLACK-ROD-F)
    (FLAGS TAKEBIT)>

<ROUTINE BLACK-ROD-F ()
    <COND (<VERB? WAVE>
           <COND (<=? ,HERE ,WEST-SIDE-OF-FISSURE ,ON-EAST-BANK-OF-FISSURE>
                  <COND (,CAVES-CLOSED
                         <TELL "Peculiar. Nothing happens." CR>)
                        (<FSET? ,CRYSTAL-BRIDGE ,OPENBIT>
                         <FSET ,CRYSTAL-BRIDGE ,INVISIBLE>
                         <FCLEAR ,CRYSTAL-BRIDGE ,OPENBIT>
                         <TELL "The crystal bridge has vanished!" CR>)
                        (ELSE
                         <FCLEAR ,CRYSTAL-BRIDGE ,INVISIBLE>
                         <FSET ,CRYSTAL-BRIDGE ,OPENBIT>
944
                         <THIS-IS-IT ,CRYSTAL-BRIDGE>
Jesse McGrew's avatar
Jesse McGrew committed
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978
                         <TELL "A crystal bridge now spans the fissure." CR>)>)
                 (ELSE <TELL "Nothing happens." CR>)>)>>

;----------------------------------------------------------------------

<ROOM IN-AWKWARD-SLOPING-E/W-CANYON
    (DESC "Sloping E/W Canyon")
    (IN ROOMS)
    (LDESC "You are in an awkward sloping east/west canyon.")
    (DOWN TO IN-DEBRIS-ROOM)
    (EAST TO IN-DEBRIS-ROOM)
    (UP TO IN-BIRD-CHAMBER)
    (WEST TO IN-BIRD-CHAMBER)
    (FLAGS SACREDBIT)>

;----------------------------------------------------------------------
"The little bird in its natural habitat"
;----------------------------------------------------------------------

<ROOM IN-BIRD-CHAMBER
    (DESC "Orange River Chamber")
    (IN ROOMS)
    (LDESC "You are in a splendid chamber thirty feet high.
The walls are frozen rivers of orange stone.
An awkward canyon and a good passage exit from east and west sides of the chamber.")
    (EAST TO IN-AWKWARD-SLOPING-E/W-CANYON)
    (WEST TO AT-TOP-OF-SMALL-PIT)
    (FLAGS SACREDBIT)>

<OBJECT LITTLE-BIRD
    (DESC "little bird")
    (IN IN-BIRD-CHAMBER)
    (SYNONYM BIRD)
    (ADJECTIVE CHEERFUL MOURNFUL LITTLE)
979
    (PRONOUN IT)
Jesse McGrew's avatar
Jesse McGrew committed
980
    (FDESC "A cheerful little bird is sitting here singing.")
981
    (SIZE 0)    ;"Doesn't count against inventory limit"
Jesse McGrew's avatar
Jesse McGrew committed
982 983 984
    (ACTION LITTLE-BIRD-F)
    (FLAGS PERSONBIT)>

985 986 987 988 989
<ROUTINE LITTLE-BIRD-F (ARG)
    <COND (<=? .ARG ,M-WINNER>
           <SETG P-CONT 0>
           <TELL CT ,LITTLE-BIRD " tilts its head, confused." CR>)
          (<VERB? EXAMINE>
Jesse McGrew's avatar
Jesse McGrew committed
990
           <COND (<IN? ,PRSO ,WICKER-CAGE>
991
                  <TELL CT ,LITTLE-BIRD " looks unhappy in the cage." CR>)
Jesse McGrew's avatar
Jesse McGrew committed
992 993
                 (ELSE
                  <TELL "The cheerful little bird is sitting here singing." CR>)>)
994
          (<AND <VERB? PUT-IN> <PRSO? ,LITTLE-BIRD>>
Jesse McGrew's avatar
Jesse McGrew committed
995 996 997 998 999 1000 1001 1002 1003 1004
           <COND (<PRSI? ,WICKER-CAGE>
                  <PERFORM ,V?CATCH ,PRSO>
                  <RTRUE>)
                 (ELSE <TELL "Don't put the poor bird in " T ,PRSI "!" CR>)>)
          (<AND <VERB? DROP> <IN? ,PRSO ,WICKER-CAGE>>
           <TELL "(The bird is released from the cage.)" CR CR>
           <PERFORM ,V?RELEASE ,PRSO>
           <RTRUE>)
          (<VERB? TAKE CATCH>
           <COND (<IN? ,PRSO ,WICKER-CAGE>
1005
                  <TELL "You already have " T ,LITTLE-BIRD ".
Jesse McGrew's avatar
Jesse McGrew committed
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
If you take it out of the cage it will likely fly away from you." CR>)
                 (<NOT <HELD? ,WICKER-CAGE>>
                  <TELL "You can catch the bird, but you cannot carry it." CR>)
                 (<HELD? ,BLACK-ROD>
                  <TELL "The bird was unafraid when you entered, but as you approach
it becomes disturbed and you cannot catch it." CR>)
                 (ELSE
                  <MOVE ,PRSO ,WICKER-CAGE>
                  <FCLEAR ,WICKER-CAGE ,OPENBIT>
                  <TELL "You catch the bird in the wicker cage." CR>)>)
          (<VERB? RELEASE>
           <COND (<NOT <IN? ,PRSO ,WICKER-CAGE>>
                  <TELL "The bird is not caged now." CR>)
                 (ELSE
                  <FSET ,WICKER-CAGE ,OPENBIT>
                  <MOVE ,PRSO ,HERE>
                  <COND (<IN? ,SNAKE ,HERE>
                         <REMOVE ,SNAKE>
                         <TELL CT ,PRSO " attacks the green snake, and in an astounding
flurry drives the snake away." CR>)
                        (<IN? ,DRAGON ,HERE>
                         <REMOVE ,PRSO>
                         <TELL CT ,PRSO " attacks the green dragon, and in an astounding
flurry gets burnt to a cinder. The ashes blow away." CR>)
                        (ELSE <TELL "The little bird flies free." CR>)>)>)
          (<AND <VERB? GIVE> <PRSI? ,LITTLE-BIRD>>
           <TELL "It's not hungry. (It's merely pinin' for the fjords).
Besides, I suspect it would prefer bird seed." CR>)
          ;"TODO: TELL, ASK, ANSWER...?"
          (<VERB? ATTACK>
           <COND (<IN? ,PRSO ,WICKER-CAGE>
                  <TELL "Oh, leave the poor unhappy bird alone." CR>)
                 (ELSE
                  <REMOVE ,PRSO>
                  <TELL "The little bird is now dead. Its body disappears." CR>)>)>>

;----------------------------------------------------------------------

<ROOM AT-TOP-OF-SMALL-PIT
    (DESC "At Top of Small Pit")
    (IN ROOMS)
1047
    (GLOBAL MIST ROUGH-STONE-STEPS)
Jesse McGrew's avatar
Jesse McGrew committed
1048 1049 1050
    (EAST TO IN-BIRD-CHAMBER)
    (WEST SORRY "The crack is far too small for you to follow.")
    (DOWN PER DOWN-INTO-SMALL-PIT)
1051
    (ACTION AT-TOP-OF-SMALL-PIT-F)
1052 1053
    (THINGS SMALL PIT   SMALL-MISTY-PIT-F
            SMALL CRACK PIT-CRACK-F)
Jesse McGrew's avatar
Jesse McGrew committed
1054 1055 1056 1057
    (FLAGS SACREDBIT)>

<ROUTINE DOWN-INTO-SMALL-PIT ()
    <COND (<HELD? ,LARGE-GOLD-NUGGET>
1058
           <JIGS-UP "You are at the bottom of the pit with a broken neck.">
1059
           <RFALSE>)
Jesse McGrew's avatar
Jesse McGrew committed
1060 1061
          (ELSE ,IN-HALL-OF-MISTS)>>

1062 1063 1064 1065 1066
<ROUTINE AT-TOP-OF-SMALL-PIT-F (RARG)
    <COND (<=? .RARG ,M-LOOK>
           <TELL "At your feet is a small pit breathing traces of white mist.
A west passage ends here except for a small crack leading on.">
           <COND (<NOT <HELD? ,LARGE-GOLD-NUGGET>>
1067 1068
                  <TELL CR CR "Rough stone steps lead down the pit.">
                  <THIS-IS-IT ,ROUGH-STONE-STEPS>)>
1069 1070
           <CRLF>)
          (<AND <=? .RARG ,M-BEG> <VERB? CLIMB> <NOT ,PRSO>>
1071
           <DO-WALK ,P?DOWN>)>>
1072

1073
<ROUTINE SMALL-MISTY-PIT-F ()
1074 1075 1076
    <COND (<VERB? EXAMINE>
           <TELL "The pit is breathing traces of white mist." CR>)
          (<VERB? ENTER>
1077 1078
           <DO-WALK ,P?DOWN>)>>

Jesse McGrew's avatar
Jesse McGrew committed
1079
<ROUTINE PIT-CRACK-F ()
1080 1081 1082 1083
    <COND (<VERB? EXAMINE>
           <TELL "The crack is very small -- far too small for you to follow." CR>)
          (<VERB? ENTER>
           <TELL "The crack is far too small for you to follow." CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099

<OBJECT MIST
    (DESC "mist")
    (IN LOCAL-GLOBALS)
    (SYNONYM MIST VAPOR WISPS)
    (ADJECTIVE WHITE)
    (TEXT "Mist is a white vapor, usually water, seen from time to time in caves.
It can be found anywhere but is frequently a sign of a deep pit leading down to water.")>

;----------------------------------------------------------------------
"The caves open up: The Hall of Mists"
;----------------------------------------------------------------------

<ROOM IN-HALL-OF-MISTS
    (DESC "In Hall of Mists")
    (IN ROOMS)
1100
    (GLOBAL MIST ROUGH-STONE-STEPS)
Jesse McGrew's avatar
Jesse McGrew committed
1101 1102 1103 1104 1105
    (ACTION IN-HALL-OF-MISTS-F)
    (SOUTH TO IN-NUGGET-OF-GOLD-ROOM)
    (WEST TO ON-EAST-BANK-OF-FISSURE)
    (DOWN TO IN-HALL-OF-MT-KING)
    (NORTH TO IN-HALL-OF-MT-KING)
1106 1107 1108
    (UP PER UP-OUT-OF-SMALL-PIT)
    (THINGS (WIDE STONE) (STAIR STAIRS STAIRCASE) WIDE-STONE-STAIRCASE-F
            <>           DOME                     DOME-F)>
Jesse McGrew's avatar
Jesse McGrew committed
1109 1110 1111

<ROUTINE IN-HALL-OF-MISTS-F (RARG)
    <COND (<AND <=? .RARG ,M-ENTER>
Jesse McGrew's avatar
Jesse McGrew committed
1112
                <NOT <FSET? ,IN-HALL-OF-MISTS ,TOUCHBIT>>>
1113 1114 1115 1116 1117 1118 1119 1120
           <SETG SCORE <+ ,SCORE 25>>)
          (<=? .RARG ,M-LOOK>
           <TELL "You are at one end of a vast hall stretching forward out of sight to the west.
There are openings to either side. Nearby, a wide stone staircase leads downward.
The hall is filled with wisps of white mist swaying to and fro almost as if alive.
A cold wind blows up the staircase.
There is a passage at the top of a dome behind you.">
           <COND (<NOT <HELD? ,LARGE-GOLD-NUGGET>>
1121 1122
                  <TELL CR CR "Rough stone steps lead up the dome.">
                  <THIS-IS-IT ,ROUGH-STONE-STEPS>)>
1123 1124
           <CRLF>)
          (<AND <=? .RARG ,M-BEG> <VERB? CLIMB> <NOT ,PRSO>>
1125
           <DO-WALK ,P?UP>)>>
Jesse McGrew's avatar
Jesse McGrew committed
1126 1127 1128

<ROUTINE UP-OUT-OF-SMALL-PIT ()
    <COND (<HELD? ,LARGE-GOLD-NUGGET>
1129 1130
           <TELL "The dome is unclimbable." CR>
           <RFALSE>)
Jesse McGrew's avatar
Jesse McGrew committed
1131 1132
          (ELSE ,AT-TOP-OF-SMALL-PIT)>>

1133 1134 1135 1136 1137 1138
<ROUTINE WIDE-STONE-STAIRCASE-F ()
    <COND (<VERB? EXAMINE>
           <TELL "The staircase leads down." CR>)
          (<VERB? ENTER>
           <DO-WALK ,P?DOWN>
           <RTRUE>)>>
Jesse McGrew's avatar
Jesse McGrew committed
1139 1140 1141

<OBJECT ROUGH-STONE-STEPS
    (DESC "rough stone steps")
1142
    (IN LOCAL-GLOBALS)
Jesse McGrew's avatar
Jesse McGrew committed
1143 1144 1145
    (SYNONYM ;"STAIR STAIRS STAIRCASE"
             STEP STEPS)
    (ADJECTIVE ROUGH STONE)
1146
    (ACTION ROUGH-STONE-STEPS-F)
Jesse McGrew's avatar
Jesse McGrew committed
1147 1148
    (FLAGS NDESCBIT PLURALBIT MULTITUDEBIT)>

1149
<ROUTINE ROUGH-STONE-STEPS-F ()
1150 1151 1152 1153 1154 1155
    <COND (<HELD? ,LARGE-GOLD-NUGGET>
           <TELL CT ,ROUGH-STONE-STEPS " are gone." CR>)
          (<VERB? EXAMINE>
           <TELL CT ,ROUGH-STONE-STEPS " lead ">
           <COND (<=? ,HERE ,IN-HALL-OF-MISTS>
                  <TELL "up the dome." CR>)
1156
                 (ELSE
1157 1158 1159
                  <TELL "down the pit." CR>)>)
          (<VERB? CLIMB ENTER>
           <DO-WALK <COND (<=? ,HERE ,IN-HALL-OF-MISTS> ,P?UP) (ELSE ,P?DOWN)>>)>>
1160

Jesse McGrew's avatar
Jesse McGrew committed
1161 1162 1163 1164 1165 1166
<ROUTINE DOME-F ()
    <COND (<VERB? EXAMINE>
           <COND (<HELD? ,LARGE-GOLD-NUGGET>
                  <TELL "I'm not sure you'll be able to get up it with what you're carrying." CR>)
                 (ELSE <TELL "It looks like you might be able to climb up it." CR>)>)
          (<VERB? CLIMB>
1167
           <DO-WALK ,P?UP>
Jesse McGrew's avatar
Jesse McGrew committed
1168 1169 1170 1171 1172 1173 1174 1175 1176
           <RTRUE>)>>

;----------------------------------------------------------------------

<ROOM IN-NUGGET-OF-GOLD-ROOM
    (DESC "Low Room")
    (IN ROOMS)
    (LDESC "This is a low room with a crude note on the wall:||
\"You won't get it up the steps.\"")
1177 1178
    (NORTH TO IN-HALL-OF-MISTS)
    (THINGS CRUDE NOTE ([READ EXAMINE] "The note says, \"You won't get it up the steps.\""))>
Jesse McGrew's avatar
Jesse McGrew committed
1179 1180 1181 1182

<OBJECT LARGE-GOLD-NUGGET
    (DESC "large gold nugget")
    (IN IN-NUGGET-OF-GOLD-ROOM)
1183
    (SYNONYM GOLD NUGGET)
Jesse McGrew's avatar
Jesse McGrew committed
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200
    (ADJECTIVE GOLD LARGE HEAVY)
    (FDESC "There is a large sparkling nugget of gold here!")
    (TEXT "It's a large sparkling nugget of gold!")
    (FLAGS TAKEBIT TREASUREBIT)>

;----------------------------------------------------------------------

<CONSTANT USE-THE-BRIDGE
    "I respectfully suggest you go across the bridge instead of jumping.">

<ROUTINE FISSURE-ROOMS-F (RARG)
    <COND (<=? .RARG ,M-BEG>
           <COND (<VERB? JUMP>
                  <COND (<FSET? ,CRYSTAL-BRIDGE ,OPENBIT> <TELL ,USE-THE-BRIDGE CR>)
                        (ELSE <JIGS-UP "You didn't make it.">)>)
                 (<AND <VERB? WALK> <PRSO? ,P?DOWN>>
                  <TELL "The fissure is too terrifying!" CR>)>)
1201
          (<=? .RARG ,M-FLASH>
Jesse McGrew's avatar
Jesse McGrew committed
1202 1203
           ;"Since the bridge isn't actually in the room, describe it here"
           <COND (<FSET? ,CRYSTAL-BRIDGE ,OPENBIT>
1204
                  <THIS-IS-IT ,CRYSTAL-BRIDGE>
Jesse McGrew's avatar
Jesse McGrew committed
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231
                  <TELL CR "A crystal bridge now spans the fissure." CR>)>)>>

<ROOM ON-EAST-BANK-OF-FISSURE
    (DESC "On East Bank of Fissure")
    (IN ROOMS)
    (LDESC "You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.")
    (GLOBAL CRYSTAL-BRIDGE FISSURE MIST)
    (EAST TO IN-HALL-OF-MISTS)
    (WEST TO WEST-SIDE-OF-FISSURE IF CRYSTAL-BRIDGE IS OPEN ELSE "The fissure is too wide.")
    (ACTION FISSURE-ROOMS-F)>

<ROOM WEST-SIDE-OF-FISSURE
    (DESC "West Side of Fissure")
    (IN ROOMS)
    (LDESC "You are on the west side of the fissure in the hall of mists.")
    (GLOBAL CRYSTAL-BRIDGE FISSURE)
    (WEST TO AT-WEST-END-OF-HALL-OF-MISTS)
    (EAST TO ON-EAST-BANK-OF-FISSURE IF CRYSTAL-BRIDGE IS OPEN ELSE "The fissure is too wide.")
    (NORTH TO AT-WEST-END-OF-HALL-OF-MISTS)
    (ACTION WEST-SIDE-OF-FISSURE-F)>

<ROUTINE ROOMS-WITH-LOW-WIDE-PASSAGE-F (RARG)
    <COND (<AND <=? .RARG ,M-BEG>
                <VERB? WALK>
                <PRSO? ,P?NORTH>>
           <TELL "You have crawled through a very low wide passage
1232
parallel to and north of the hall of mists." CR CR>
Jesse McGrew's avatar
Jesse McGrew committed
1233 1234 1235 1236 1237 1238 1239 1240 1241
           <RFALSE>)>>

<ROUTINE WEST-SIDE-OF-FISSURE-F (RARG)
    <T? <OR <ROOMS-WITH-LOW-WIDE-PASSAGE-F .RARG>
            <FISSURE-ROOMS-F .RARG>>>>

<OBJECT DIAMONDS
    (DESC "diamonds")
    (IN WEST-SIDE-OF-FISSURE)
1242
    (SYNONYM DIAMOND DIAMONDS)
Jesse McGrew's avatar
Jesse McGrew committed
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253
    (ADJECTIVE SEVERAL HIGH QUALITY)
    (FDESC "There are diamonds here!")
    (TEXT "They look to be of the highest quality!")
    (FLAGS TAKEBIT TREASUREBIT PLURALBIT MULTITUDEBIT)>

<OBJECT CRYSTAL-BRIDGE
    (DESC "crystal bridge")
    (IN LOCAL-GLOBALS)
    (SYNONYM BRIDGE)
    (ADJECTIVE CRYSTAL)
    (TEXT "It spans the fissure, thereby providing you a way across.")
1254
    (FLAGS DOORBIT INVISIBLE)>
Jesse McGrew's avatar
Jesse McGrew committed
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311

<OBJECT FISSURE
    (DESC "fissure")
    (IN LOCAL-GLOBALS)
    (SYNONYM FISSURE)
    (ADJECTIVE WIDE)
    (TEXT "The fissure looks far too wide to jump.")>

;----------------------------------------------------------------------

<ROOM AT-WEST-END-OF-HALL-OF-MISTS
    (DESC "At West End of Hall of Mists")
    (IN ROOMS)
    (LDESC "You are at the west end of the hall of mists.
A low wide crawl continues west and another goes north.
To the south is a little passage 6 feet off the floor.")
    (SOUTH TO ALIKE-MAZE-1)
    (UP TO ALIKE-MAZE-1)
    (EAST TO WEST-SIDE-OF-FISSURE)
    (WEST TO AT-EAST-END-OF-LONG-HALL)
    (NORTH TO WEST-SIDE-OF-FISSURE)
    (ACTION ROOMS-WITH-LOW-WIDE-PASSAGE-F)>

;----------------------------------------------------------------------
"Long Hall to the west of the Hall of Mists"
;----------------------------------------------------------------------

<ROOM AT-EAST-END-OF-LONG-HALL
    (DESC "At East End of Long Hall")
    (IN ROOMS)
    (LDESC "You are at the east end of a very long hall apparently without side chambers.
To the east a low wide crawl slants up.
To the north a round two foot hole slants down.")
    (EAST TO AT-WEST-END-OF-HALL-OF-MISTS)
    (UP TO AT-WEST-END-OF-HALL-OF-MISTS)
    (WEST TO AT-WEST-END-OF-LONG-HALL)
    (NORTH TO CROSSOVER)
    (DOWN TO CROSSOVER)>

;----------------------------------------------------------------------

<ROOM AT-WEST-END-OF-LONG-HALL
    (DESC "At West End of Long Hall")
    (IN ROOMS)
    (LDESC "You are at the west end of a very long featureless hall.
The hall joins up with a narrow north/south passage.")
    (EAST TO AT-EAST-END-OF-LONG-HALL)
    (SOUTH TO DIFFERENT-MAZE-1)
    (NORTH TO CROSSOVER)>

;----------------------------------------------------------------------

<ROOM CROSSOVER
    (DESC "N/S and E/W Crossover")
    (IN ROOMS)
    (LDESC "You are at a crossover of a high N/S passage and a low E/W one.")
    (WEST TO AT-EAST-END-OF-LONG-HALL)
1312
    (NORTH TO CROSSOVER-DEAD-END)
Jesse McGrew's avatar
Jesse McGrew committed
1313
    (EAST TO IN-WEST-SIDE-CHAMBER)
1314 1315
    (SOUTH TO AT-WEST-END-OF-LONG-HALL)
    (THINGS CROSS (OVER CROSSOVER) "You know as much as I do at this point.")>
Jesse McGrew's avatar
Jesse McGrew committed
1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338

;----------------------------------------------------------------------
"Many Dead Ends will be needed for the maze below, so define a helper function"
;----------------------------------------------------------------------

<DEFINE DEAD-END-ROOM (NAME DIR DEST "ARGS" PS "AUX" DEF)
    <SET DEF
         <FORM ROOM .NAME
               '(DESC "Dead End")
               '(IN ROOMS)
               '(LDESC "You have reached a dead end.")
               '(ACTION DEAD-END-ROOMS-F)
               <LIST .DIR TO .DEST>
               <LIST OUT TO .DEST>
               !.PS>>
    <EVAL .DEF>>

<ROUTINE DEAD-END-ROOMS-F (RARG)
    <COND (<AND <=? .RARG ,M-BEG>
                <VERB? WALK>
                <0? <GETPT ,HERE ,PRSO>>>
           <TELL "You'll have to go back the way you came." CR>)>>

1339
<DEAD-END-ROOM CROSSOVER-DEAD-END SOUTH CROSSOVER>
Jesse McGrew's avatar
Jesse McGrew committed
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370

;----------------------------------------------------------------------
"The Hall of the Mountain King and side chambers"
;----------------------------------------------------------------------

<ROOM IN-HALL-OF-MT-KING
    (DESC "Hall of the Mountain King")
    (IN ROOMS)
    (LDESC "You are in the hall of the mountain king, with passages off in all directions.")
    (UP TO IN-HALL-OF-MISTS)
    (EAST TO IN-HALL-OF-MISTS)
    (NORTH TO LOW-N/S-PASSAGE)
    (SOUTH TO IN-SOUTH-SIDE-CHAMBER)
    (WEST TO IN-WEST-SIDE-CHAMBER)
    (SW TO IN-SECRET-E/W-CANYON)
    (ACTION IN-HALL-OF-MT-KING-F)>

<ROUTINE IN-HALL-OF-MT-KING-F (RARG)
    <COND (<AND <=? .RARG ,M-BEG> <VERB? WALK>>
           <COND (<0? <GETPT ,HERE ,PRSO>>
                  <TELL "Well, perhaps not quite all directions." CR>)
                 (<AND <IN? ,SNAKE ,HERE>
                       <OR <PRSO? ,P?NORTH ,P?SOUTH ,P?WEST>
                           <AND <PRSO? ,P?SW> <PROB 35>>>>
                  <TELL "You can't get by the snake." CR>)>)>>

<OBJECT SNAKE
    (DESC "snake")
    (IN IN-HALL-OF-MT-KING)
    (SYNONYM SNAKE COBRA ASP)
    (ADJECTIVE HUGE FIERCE GREEN FEROCIOUS ;VENEMOUS VENOMOUS LARGE BIG KILLER)
1371
    (PRONOUN IT)
Jesse McGrew's avatar
Jesse McGrew committed
1372 1373
    (FDESC "A huge green fierce snake bars the way!")
    (TEXT "I wouldn't mess with it if I were you.")
1374 1375
    (ACTION SNAKE-F)
    (FLAGS PERSONBIT ATTACKBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
1376

1377 1378 1379 1380 1381
<ROUTINE SNAKE-F (ARG)
    <COND (<=? .ARG ,M-WINNER>
           <SETG P-CONT 0>
           <TELL CT ,SNAKE " gives you a cold stare." CR>)
          (<AND <VERB? THROW-AT> <PRSI? ,SNAKE>>
Jesse McGrew's avatar
Jesse McGrew committed
1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408
           <COND (<PRSO? ,AXE> <PERFORM ,V?ATTACK ,PRSI>)
                 (ELSE <PERFORM ,V?GIVE ,PRSO ,PRSI>)>
           <RTRUE>)
          (<AND <VERB? GIVE> <PRSI? ,SNAKE>>
           <COND (<PRSO? ,LITTLE-BIRD>
                  <REMOVE ,PRSO>
                  <TELL "The snake has now devoured your bird." CR>)
                 (ELSE <TELL "There's nothing here it wants to eat (except perhaps you)." CR>)>)
          (<VERB? ATTACK>
           <TELL "Attacking the snake both doesn't work and is very dangerous." CR>)
          (<VERB? TAKE>
           <JIGS-UP "It takes you instead. Glrp!">)>>

;----------------------------------------------------------------------

<ROOM LOW-N/S-PASSAGE
    (DESC "Low N/S Passage")
    (IN ROOMS)
    (LDESC "You are in a low N/S passage at a hole in the floor.
The hole goes down to an E/W passage.")
    (SOUTH TO IN-HALL-OF-MT-KING)
    (DOWN TO IN-DIRTY-PASSAGE)
    (NORTH TO AT-Y2)>

<OBJECT BARS-OF-SILVER
    (DESC "bars of silver")
    (IN LOW-N/S-PASSAGE)
1409
    (SYNONYM BAR BARS SILVER)
Jesse McGrew's avatar
Jesse McGrew committed
1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422