advent.zil 173 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
7
;"TODO: Replace scenery objects with PSEUDO / THINGS once implemented."
;"TODO: DESCRIBE-OBJECTS should mention special LOCAL-GLOBALS?"
;"TODO: Add CANT-GO property?"

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

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

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

19
20
21
22
;"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
23

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

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

Jesse McGrew's avatar
Jesse McGrew committed
36
37
38
<ROUTINE GO ()
    <SETG HERE ,AT-END-OF-ROAD>
    <SETG SCORE 36>
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<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>>)
                        (<MOVE ,PRSO ,HERE>
                         <FSET ,PRSO ,TOUCHBIT>
                         <FCLEAR ,PRSO ,WORNBIT>
                         <TELL "You safely deposit " T ,PRSO "." CR>)>
                  <RTRUE>)
                 (<VERB? QUIT>
                  <V-SCORE T>
                  <CRLF>
                  <V-QUIT>
                  <RTRUE>)
                 (<AND <VERB? PUT-IN>
                       <PRSO? ,LITTLE-BIRD>
                       <PRSI? ,WICKER-CAGE>>
                  ;"PUT BIRD IN CAGE is normally blocked by PRE-PUT-IN, so we intercept it here
                    and redirect to CATCH BIRD."
                  <PERFORM ,V?CATCH ,PRSO>
                  <RTRUE>)
                 (<AND <VERB? DROP>
                       <PRSO? ,LITTLE-BIRD>
                       <IN? ,LITTLE-BIRD ,WICKER-CAGE>
                       <HELD? ,WICKER-CAGE>>
                  ;"Likewise, DROP BIRD is normally blocked by PRE-DROP, so we intercept it here
                    and redirect to FREE BIRD."
                  <PERFORM ,V?RELEASE ,PRSO>
132
133
134
135
136
                  <RTRUE>)
                 (<AND <VERB? PUT-ON>
                       <PRSO? ,WATER-IN-BOTTLE>>
                  ;"Likewise, PUT WATER ON FOO is normally blocked by PRE-PUT-ON."
                  <PERFORM ,V?POUR ,PRSO ,PRSI>
137
                  <RTRUE>)>)>
138
139
140
    ;"Fall back to the library's handler."
    <PLAYER-F>>

141
142
143
144
145
;----------------------------------------------------------------------
"Include the standard library"
;----------------------------------------------------------------------

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

149
150
;"This is used by the debugging verbs.
  Note: TREASUREBIT isn't listed because it's a bit synonym."
151
<SETG EXTRA-FLAGS
152
    '(SACREDBIT MULTITUDEBIT SPRINGBIT LIQUIDBIT SPONGEBIT)>
153

154
;"We replace a few library sections below."
155
<DELAY-DEFINITION DARKNESS-F>
156
157
<DELAY-DEFINITION PRINT-GAME-OVER>
<DELAY-DEFINITION RESURRECT?>
158

Jesse McGrew's avatar
Jesse McGrew committed
159
160
<INSERT-FILE "parser">

161
162
163
164
;----------------------------------------------------------------------
"Utilities, properties, globals, and constants"
;----------------------------------------------------------------------

Jesse McGrew's avatar
Jesse McGrew committed
165
166
167
168
169
170
171
;"Utility macro for randomness"
<DEFMAC PROB ('N)
    <FORM L=? '<RANDOM 100> .N>>

;"Properties"
<PROPDEF DEPOSIT-POINTS 10>

172
173
174
175
176
177
;"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>

178
179
180
181
182
183
184
185
186
187
188
189
190
;----------------------------------------------------------------------
"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
191
    <TABLE %<VERSION? (ZIP '(BYTE)) (ELSE #SPLICE ())>
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
        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>

225
<ROUTINE V-SCORE ("OPT" DEAD "AUX" MAX NR)
226
    <TELL "In ">
227
    <COND (<1? ,MOVES> <TELL "1 turn">) (ELSE <TELL N ,MOVES " turns">)>
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
    <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>)>)>>

254
<ROUTINE UPDATE-SCORE-AND-NOTIFY ("AUX" D T OS NS)
255
256
257
258
259
260
261
262
263
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
    ;"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
290
291
292
293
294
295
296
297
298
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
;----------------------------------------------------------------------
"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)
    (SYNONYM STREAM WATER ;BROOK RIVER LAKE ;RESERVOIR)
    (ADJECTIVE SMALL TUMBLING SPLASHING BABBLING RUSHING)
330
331
    (ACTION STREAM-F)
    (FLAGS SPRINGBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
332
333
334

<ROUTINE STREAM-F ()
    <COND (<VERB? DRINK>
335
336
337
338
339
340
           <TELL "You have taken a drink from the stream. The water tastes strongly of ">
           ;"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
341
342
          (<VERB? TAKE>
           <COND (<HELD? ,BOTTLE>
343
                  <PERFORM ,V?FILL-WITH ,BOTTLE ,STREAM>
Jesse McGrew's avatar
Jesse McGrew committed
344
345
346
347
348
349
350
351
                  <RTRUE>)
                 (ELSE <TELL "You have nothing in which to carry the water." CR>)>)
          (<AND <VERB? PUT-IN> <PRSI? ,STREAM>>
           <COND (<PRSO? ,MING-VASE>
                  <REMOVE ,PRSO>
                  <MOVE ,SHARDS ,HERE>
                  <TELL "The sudden change in temperature has delicately shattered the vase." CR>)
                 (<PRSO? ,BOTTLE>
352
                  <PERFORM ,V?FILL-WITH ,BOTTLE ,STREAM>
Jesse McGrew's avatar
Jesse McGrew committed
353
354
355
                  <RTRUE>)
                 (ELSE
                  <REMOVE ,PRSO>
Jesse McGrew's avatar
Jesse McGrew committed
356
357
                  <TELL CT ,PRSO " wash">
                  <COND (<NOT <FSET? ,PRSO ,PLURALBIT>> <TELL "es">)>
358
359
360
                  <TELL " away with the stream." CR>)>)
          (<VERB? ENTER>
           <TELL "Your feet are now wet." CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
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

<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)
    (FLAGS LIGHTBIT SACREDBIT)>

<OBJECT HILL
    (DESC "hill")
    (IN AT-HILL-IN-ROAD)
    (SYNONYM HILL BUMP INCLINE)
    (TEXT "It's just a typical hill.")
    (FLAGS NDESCBIT)>

<OBJECT OTHER-SIDE-OF-HILL
    (DESC "other side of hill")
    (IN AT-HILL-IN-ROAD)
    (SYNONYM SIDE)
    (ADJECTIVE OTHER)
    (TEXT "Why not explore it yourself?")
    (FLAGS NDESCBIT VOWELBIT)>

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

<ROOM INSIDE-BUILDING
    (DESC "Inside Building")
    (IN ROOMS)
416
    (GLOBAL WELL-HOUSE STREAM)
Jesse McGrew's avatar
Jesse McGrew committed
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
    (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)
443
    (SYNONYM SPRING)
Jesse McGrew's avatar
Jesse McGrew committed
444
445
    (ADJECTIVE LARGE)
    (TEXT ,STREAM-FLOWS-OUT)
446
    (FLAGS NDESCBIT SPRINGBIT)
447
448
449
450
    (ACTION SPRING-F)>

<ROUTINE SPRING-F ()
    <COND (<VERB? DRINK> <TELL ,STREAM-FLOWS-OUT CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
451
452
453
454

<OBJECT SEWER-PIPES
    (DESC "pair of 1 foot diameter sewer pipes")
    (IN INSIDE-BUILDING)
455
    (SYNONYM PAIR PIPES PIPE)
Jesse McGrew's avatar
Jesse McGrew committed
456
457
458
459
460
461
462
463
    (ADJECTIVE PAIR FOOT DIAMETER SEWER)
    (TEXT "Too small. The only exit is to the west.")
    (FLAGS NDESCBIT)>

<OBJECT SET-OF-KEYS
    (DESC "set of keys")
    (SYNONYM KEY KEYS KEYRING SET)
    (ADJECTIVE SET)
464
    (PRONOUN IT THEM)
Jesse McGrew's avatar
Jesse McGrew committed
465
466
467
468
    (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)
469
    (FLAGS TAKEBIT TOOLBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
470
471
472
473
474
475
476

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

<OBJECT TASTY-FOOD
    (DESC "tasty food")
    (IN INSIDE-BUILDING)
477
    (SYNONYM FOOD RATION TRIPE RATIONS)
Jesse McGrew's avatar
Jesse McGrew committed
478
    (ADJECTIVE YUMMY TASTY DELICIOUS SCRUMPTIOUS)
Jesse McGrew's avatar
Jesse McGrew committed
479
    (ARTICLE "some")
Jesse McGrew's avatar
Jesse McGrew committed
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
    (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>
502
503
           <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
504
505
506
507

<ROUTINE BRASS-LANTERN-F ()
    <COND (<VERB? EXAMINE>
           <TELL "It is a shiny brass lamp">
508
           <COND (<NOT <FSET? ,PRSO ,LIGHTBIT>>
Jesse McGrew's avatar
Jesse McGrew committed
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
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
                  <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>
560
561
           <FCLEAR ,BRASS-LANTERN ,ONBIT>
           <NOW-DARK?>)>
Jesse McGrew's avatar
Jesse McGrew committed
562
563
564
565
566
567
    ;"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>>>
568
                         <SETG LAMP-RAN-OUT T>
Jesse McGrew's avatar
Jesse McGrew committed
569
570
571
572
573
574
575
576
577
                         <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>
578
                              <FSET? ,VENDING-DEAD-END ,TOUCHBIT>>
Jesse McGrew's avatar
Jesse McGrew committed
579
580
581
582
583
584
585
586
587
588
589
590
591
                         <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)
592
    (DESCFCN BOTTLE-DESCFCN)
Jesse McGrew's avatar
Jesse McGrew committed
593
594
595
596
    (ACTION BOTTLE-F)
    (CONTFCN BOTTLE-CONTFCN)
    (FLAGS TAKEBIT CONTBIT OPENBIT)>

597
<ROUTINE BOTTLE-F ("AUX" F S)
598
    <COND (<AND <VERB? FILL-WITH> <PRSO? ,BOTTLE>>
Jesse McGrew's avatar
Jesse McGrew committed
599
600
           <COND (<FIRST? ,PRSO>
                  <TELL CT ,PRSO " is full already." CR>)
601
                 (<PRSI? ,STREAM ,SPRING>
Jesse McGrew's avatar
Jesse McGrew committed
602
603
                  <MOVE ,WATER-IN-BOTTLE ,PRSO>
                  <TELL CT ,PRSO " is now full of water." CR>)
604
                 (<PRSI? ,OIL>
Jesse McGrew's avatar
Jesse McGrew committed
605
606
                  <MOVE ,OIL-IN-BOTTLE ,PRSO>
                  <TELL CT ,PRSO " is now full of oil." CR>)
607
608
609
610
                 (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
611
612
613
          (<VERB? EMPTY>
           <COND (<NOT <SET F <FIRST? ,PRSO>>>
                  <TELL CT ,PRSO " is already empty!" CR>)
614
615
                 (<SET S <FIND-IN ,HERE ,SPONGEBIT "onto">>
                  <PERFORM ,V?POUR .F .S>)
Jesse McGrew's avatar
Jesse McGrew committed
616
617
618
619
                 (ELSE
                  <REMOVE .F>
                  <TELL "Your " D ,PRSO " is now empty and the ground is now wet." CR>)>)
          (<AND <VERB? PUT-IN> <PRSI? ,BOTTLE>>
620
           <PERFORM ,V?FILL-WITH ,PRSO ,PRSI>)>>
Jesse McGrew's avatar
Jesse McGrew committed
621

622
623
624
625
626
627
628
<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
629
630
631
632
633
<ROUTINE BOTTLE-CONTFCN ()
    <COND (<VERB? TAKE> <TELL "You're holding that already (in " T ,BOTTLE ")." CR>)>>

<OBJECT WATER-IN-BOTTLE
    (DESC "bottled water")
634
    (IN BOTTLE)
Jesse McGrew's avatar
Jesse McGrew committed
635
    (ARTICLE "some")
Jesse McGrew's avatar
Jesse McGrew committed
636
    (SYNONYM WATER H2O)
637
    (ADJECTIVE BOTTLED)
Jesse McGrew's avatar
Jesse McGrew committed
638
    (TEXT "It looks like ordinary water to me.")
639
    (SIZE 0)    ;"Doesn't count against inventory limit"
640
641
    (ACTION WATER-IN-BOTTLE-F)
    (FLAGS LIQUIDBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
642
643
644
645
646
647
648
649
650

<ROUTINE WATER-IN-BOTTLE-F ()
    <COND (<VERB? DRINK>
           <REMOVE ,PRSO>
           <PERFORM ,V?DRINK ,STREAM>
           <RTRUE>)>>

<OBJECT OIL-IN-BOTTLE
    (DESC "bottled oil")
Jesse McGrew's avatar
Jesse McGrew committed
651
    (ARTICLE "some")
Jesse McGrew's avatar
Jesse McGrew committed
652
    (SYNONYM OIL LUBRICANT GREASE)
653
    (ADJECTIVE BOTTLED)
Jesse McGrew's avatar
Jesse McGrew committed
654
    (TEXT "It looks like ordinary oil to me.")
655
    (SIZE 0)    ;"Doesn't count against inventory limit"
656
657
    (ACTION OIL-IN-BOTTLE-F)
    (FLAGS LIQUIDBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711

<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>
           <RTRUE>)>>

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

<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)
    (FLAGS LIGHTBIT SACREDBIT)>

<OBJECT STREAMBED
    (DESC "streambed")
    (IN IN-A-VALLEY)
    (SYNONYM BED ROCK
712
        ;"In V3, this conflicts with STREAM and we don't want ambiguity."
713
714
        %<VERSION? (ZIP #SPLICE ()) (ELSE STREAMBED)>)
    (ADJECTIVE SMALL ROCKY ;BARE ;DRY STREAM)
Jesse McGrew's avatar
Jesse McGrew committed
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
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
    (FLAGS NDESCBIT)>

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

<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)
    (FLAGS LIGHTBIT SACREDBIT)>

<OBJECT 2-INCH-SLIT
    (DESC "2-inch slit")
    (IN AT-SLIT-IN-STREAMBED)
    (SYNONYM SLIT)
    (ADJECTIVE TWO INCH 2-INCH)
    (TEXT "It's just a 2-inch slit in the rock, through which the stream is flowing.")
    (ACTION 2-INCH-SLIT-F)
    (FLAGS NDESCBIT)>

<ROUTINE 2-INCH-SLIT-F ()
    <COND (<VERB? ENTER> <TELL ,YOU-DONT-FIT CR>)>>

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

<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.")
    (GLOBAL GRATE)
    (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)
    (FLAGS LIGHTBIT SACREDBIT)>

<ROUTINE OUTSIDE-GRATE-F (RARG)
766
    <COND (<=? .RARG ,M-FLASH>
Jesse McGrew's avatar
Jesse McGrew committed
767
           ;"Since the grate isn't actually in the room, describe it here"
768
           <MAYBE-DESCRIBE-GRATE>)
Jesse McGrew's avatar
Jesse McGrew committed
769
770
771
772
773
774
775
776
777
778
          (<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>)>>

779
780
781
782
783
784
785
786
<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
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
<OBJECT 20-FOOT-DEPRESSION
    (DESC "20-foot depression")
    (IN OUTSIDE-GRATE)
    (SYNONYM DEPRESSION DIRT)
    (ADJECTIVE TWENTY FOOT BARE 20-FOOT)
    (TEXT "You're standing in it.")
    (FLAGS NDESCBIT)>

<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)
832
    (ACTION BELOW-THE-GRATE-F)
Jesse McGrew's avatar
Jesse McGrew committed
833
834
    (FLAGS LIGHTBIT)>

835
836
837
<ROUTINE BELOW-THE-GRATE-F (RARG)
    <COND (<=? .RARG ,M-FLASH>
           ;"Since the grate isn't actually in the room, describe it here"
838
           <MAYBE-DESCRIBE-GRATE>)>>
839

Jesse McGrew's avatar
Jesse McGrew committed
840
841
842
<OBJECT COBBLES
    (DESC "cobbles")
    (IN LOCAL-GLOBALS)
843
844
845
846
    (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
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
    (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)
865
866
    (SYNONYM CAGE)
    (ADJECTIVE SMALL WICKER)
Jesse McGrew's avatar
Jesse McGrew committed
867
868
869
870
871
872
873
    (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>>
874
875
           <TELL "(releasing " T ,LITTLE-BIRD ")" CR>
           <PERFORM ,V?RELEASE ,LITTLE-BIRD>
876
877
878
879
880
           <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
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914

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

<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)
    (FLAGS SACREDBIT)>

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

<OBJECT DEBRIS
    (DESC "debris")
    (IN IN-DEBRIS-ROOM)
    (SYNONYM DEBRIS STUFF MUD)
    (TEXT "Yuck.")
    (FLAGS NDESCBIT)>

<OBJECT XYZZY-NOTE
    (DESC "note")
    (IN IN-DEBRIS-ROOM)
    (SYNONYM NOTE)
    (TEXT "The note says \"Magic word XYZZY\".")
915
    (FLAGS NDESCBIT READBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938

<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>
939
                         <THIS-IS-IT ,CRYSTAL-BRIDGE>
Jesse McGrew's avatar
Jesse McGrew committed
940
941
942
943
944
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
                         <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)
974
    (PRONOUN IT)
Jesse McGrew's avatar
Jesse McGrew committed
975
    (FDESC "A cheerful little bird is sitting here singing.")
976
    (SIZE 0)    ;"Doesn't count against inventory limit"
Jesse McGrew's avatar
Jesse McGrew committed
977
978
979
980
981
982
983
984
985
    (ACTION LITTLE-BIRD-F)
    (FLAGS PERSONBIT)>

<ROUTINE LITTLE-BIRD-F ()
    <COND (<VERB? EXAMINE>
           <COND (<IN? ,PRSO ,WICKER-CAGE>
                  <TELL "The little bird looks unhappy in the cage." CR>)
                 (ELSE
                  <TELL "The cheerful little bird is sitting here singing." CR>)>)
986
          (<AND <VERB? PUT-IN> <PRSO? ,LITTLE-BIRD>>
Jesse McGrew's avatar
Jesse McGrew committed
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
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
           <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>
                  <TELL "You already have the little bird.
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)
1039
    (GLOBAL MIST ROUGH-STONE-STEPS)
Jesse McGrew's avatar
Jesse McGrew committed
1040
1041
1042
    (EAST TO IN-BIRD-CHAMBER)
    (WEST SORRY "The crack is far too small for you to follow.")
    (DOWN PER DOWN-INTO-SMALL-PIT)
1043
    (ACTION AT-TOP-OF-SMALL-PIT-F)
Jesse McGrew's avatar
Jesse McGrew committed
1044
1045
1046
1047
    (FLAGS SACREDBIT)>

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

1052
1053
1054
1055
1056
<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>>
1057
1058
                  <TELL CR CR "Rough stone steps lead down the pit.">
                  <THIS-IS-IT ,ROUGH-STONE-STEPS>)>
1059
1060
           <CRLF>)
          (<AND <=? .RARG ,M-BEG> <VERB? CLIMB> <NOT ,PRSO>>
1061
           <DO-WALK ,P?DOWN>)>>
1062

Jesse McGrew's avatar
Jesse McGrew committed
1063
1064
1065
1066
1067
1068
<OBJECT SMALL-MISTY-PIT
    (DESC "small pit")
    (IN AT-TOP-OF-SMALL-PIT)
    (SYNONYM PIT)
    (ADJECTIVE SMALL)
    (TEXT "The pit is breathing traces of white mist.")
1069
    (ACTION SMALL-MISTY-PIT-F)
Jesse McGrew's avatar
Jesse McGrew committed
1070
1071
    (FLAGS NDESCBIT)>

1072
1073
1074
1075
<ROUTINE SMALL-MISTY-PIT-F ()
    <COND (<VERB? ENTER>
           <DO-WALK ,P?DOWN>)>>

Jesse McGrew's avatar
Jesse McGrew committed
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
<OBJECT PIT-CRACK
    (DESC "crack")
    (IN AT-TOP-OF-SMALL-PIT)
    (SYNONYM CRACK)
    (ADJECTIVE SMALL)
    (TEXT "The crack is very small -- far too small for you to follow.")
    (ACTION PIT-CRACK-F)
    (FLAGS NDESCBIT)>

<ROUTINE PIT-CRACK-F ()
    <COND (<VERB? ENTER> <TELL "The crack is far too small for you to follow." CR>)>>

<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)
1103
    (GLOBAL MIST ROUGH-STONE-STEPS)
Jesse McGrew's avatar
Jesse McGrew committed
1104
1105
1106
1107
1108
1109
1110
1111
1112
    (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)
    (UP PER UP-OUT-OF-SMALL-PIT)>

<ROUTINE IN-HALL-OF-MISTS-F (RARG)
    <COND (<AND <=? .RARG ,M-ENTER>
Jesse McGrew's avatar
Jesse McGrew committed
1113
                <NOT <FSET? ,IN-HALL-OF-MISTS ,TOUCHBIT>>>
1114
1115
1116
1117
1118
1119
1120
1121
           <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>>
1122
1123
                  <TELL CR CR "Rough stone steps lead up the dome.">
                  <THIS-IS-IT ,ROUGH-STONE-STEPS>)>
1124
1125
           <CRLF>)
          (<AND <=? .RARG ,M-BEG> <VERB? CLIMB> <NOT ,PRSO>>
1126
           <DO-WALK ,P?UP>)>>
Jesse McGrew's avatar
Jesse McGrew committed
1127
1128
1129

<ROUTINE UP-OUT-OF-SMALL-PIT ()
    <COND (<HELD? ,LARGE-GOLD-NUGGET>
1130
1131
           <TELL "The dome is unclimbable." CR>
           <RFALSE>)
Jesse McGrew's avatar
Jesse McGrew committed
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
          (ELSE ,AT-TOP-OF-SMALL-PIT)>>

<OBJECT WIDE-STONE-STAIRCASE
    (DESC "wide stone staircase")
    (IN IN-HALL-OF-MISTS)
    (SYNONYM STAIR STAIRS STAIRCASE)
    (ADJECTIVE WIDE STONE)
    (TEXT "The staircase leads down.")
    (FLAGS NDESCBIT)>

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

1151
<ROUTINE ROUGH-STONE-STEPS-F ()
1152
1153
1154
1155
1156
1157
    <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>)
1158
                 (ELSE
1159
1160
1161
                  <TELL "down the pit." CR>)>)
          (<VERB? CLIMB ENTER>
           <DO-WALK <COND (<=? ,HERE ,IN-HALL-OF-MISTS> ,P?UP) (ELSE ,P?DOWN)>>)>>
1162

Jesse McGrew's avatar
Jesse McGrew committed
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
<OBJECT DOME
    (DESC "dome")
    (IN IN-HALL-OF-MISTS)
    (SYNONYM DOME)
    (ACTION DOME-F)
    (FLAGS NDESCBIT)>

<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>
1176
           <DO-WALK ,P?UP>
Jesse McGrew's avatar
Jesse McGrew committed
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
           <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.\"")
    (NORTH TO IN-HALL-OF-MISTS)>

<OBJECT NUGGET-NOTE
    (DESC "note")
    (IN IN-NUGGET-OF-GOLD-ROOM)
    (SYNONYM NOTE)
    (ADJECTIVE CRUDE)
    (TEXT "The note says, \"You won't get it up the steps.\"")
1194
    (FLAGS NDESCBIT READBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
1195
1196
1197
1198

<OBJECT LARGE-GOLD-NUGGET
    (DESC "large gold nugget")
    (IN IN-NUGGET-OF-GOLD-ROOM)
1199
    (SYNONYM GOLD NUGGET)
Jesse McGrew's avatar
Jesse McGrew committed
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
    (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>)>)
1217
          (<=? .RARG ,M-FLASH>
Jesse McGrew's avatar
Jesse McGrew committed
1218
1219
           ;"Since the bridge isn't actually in the room, describe it here"
           <COND (<FSET? ,CRYSTAL-BRIDGE ,OPENBIT>
1220
                  <THIS-IS-IT ,CRYSTAL-BRIDGE>
Jesse McGrew's avatar
Jesse McGrew committed
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
                  <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
1248
parallel to and north of the hall of mists." CR CR>
Jesse McGrew's avatar
Jesse McGrew committed
1249
1250
1251
1252
1253
1254
1255
1256
1257
           <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)
1258
    (SYNONYM DIAMOND DIAMONDS)
Jesse McGrew's avatar
Jesse McGrew committed
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
    (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.")
1270
    (FLAGS DOORBIT INVISIBLE)>
Jesse McGrew's avatar
Jesse McGrew committed
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
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327

<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)
1328
    (NORTH TO CROSSOVER-DEAD-END)
Jesse McGrew's avatar
Jesse McGrew committed
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
    (EAST TO IN-WEST-SIDE-CHAMBER)
    (SOUTH TO AT-WEST-END-OF-LONG-HALL)>

<OBJECT CROSSOVER-SCENERY
    (DESC "crossover")
    (IN CROSSOVER)
    (SYNONYM CROSSOVER OVER)
    (ADJECTIVE CROSS)
    (TEXT "You know as much as I do at this point.")
    (FLAGS NDESCBIT)>

;----------------------------------------------------------------------
"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>)>>

1362
<DEAD-END-ROOM CROSSOVER-DEAD-END SOUTH CROSSOVER>
Jesse McGrew's avatar
Jesse McGrew committed
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393

;----------------------------------------------------------------------
"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)
1394
    (PRONOUN IT)
Jesse McGrew's avatar
Jesse McGrew committed
1395
1396
    (FDESC "A huge green fierce snake bars the way!")
    (TEXT "I wouldn't mess with it if I were you.")
1397
1398
    (ACTION SNAKE-F)
    (FLAGS PERSONBIT ATTACKBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428

<ROUTINE SNAKE-F ()
    <COND (<AND <VERB? THROW-AT> <PRSI? ,SNAKE>>
           <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)
1429
    (SYNONYM BAR BARS SILVER)
Jesse McGrew's avatar
Jesse McGrew committed
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
    (FDESC "There are bars of silver here!")
    (TEXT "They're probably worth a fortune!")
    (FLAGS TAKEBIT PLURALBIT TREASUREBIT)>

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

<ROOM IN-SOUTH-SIDE-CHAMBER
    (DESC "In South Side Chamber")
    (IN ROOMS)
    (LDESC "You are in the south side chamber.")
    (NORTH TO IN-HALL-OF-MT-KING)>

<OBJECT PRECIOUS-JEWELRY
    (DESC "precious jewelry")
    (IN IN-SOUTH-SIDE-CHAMBER)
    (SYNONYM JEWEL JEWELS JEWELRY)
    (ADJECTIVE PRECIOUS EXQUISITE)
Jesse McGrew's avatar
Jesse McGrew committed
1447
    (ARTICLE "some")
1448
    (PRONOUN IT THEM)
Jesse McGrew's avatar
Jesse McGrew committed
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
    (FDESC "There is precious jewelry here!")
    (TEXT "It's all quite exquisite!")
    (FLAGS TAKEBIT TREASUREBIT)>

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

<ROOM IN-WEST-SIDE-CHAMBER
    (DESC "In West Side Chamber")
    (IN ROOMS)
    (LDESC "You are in the west side chamber of the hall of the mountain king.
A passage continues west and up here.")
    (WEST TO CROSSOVER)
    (UP TO CROSSOVER)
    (EAST TO IN-HALL-OF-MT-KING)>

<OBJECT RARE-COINS
    (DESC "rare coins")
    (IN IN-WEST-SIDE-CHAMBER)
    (SYNONYM COINS)
    (ADJECTIVE RARE)
Jesse McGrew's avatar
Jesse McGrew committed
1469
    (ARTICLE "many")
Jesse McGrew's avatar
Jesse McGrew committed
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
    (FDESC "There are many coins here!")
    (TEXT "They're a numismatist's dream!")
    (FLAGS TAKEBIT PLURALBIT TREASUREBIT MULTITUDEBIT)>


;----------------------------------------------------------------------
"The Y2 Rock Room and environs, slightly below"
;----------------------------------------------------------------------

<ROOM AT-Y2
    (DESC "At \"Y2\"")
    (IN ROOMS)
    (LDESC "You are in a large room, with a passage to the south,
a passage to the west, and a wall of broken rock to the east.
1484
There is a large \"Y2\" on a rock in the room's center.")
Jesse McGrew's avatar
Jesse McGrew committed
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
    (SOUTH TO LOW-N/S-PASSAGE)
    (EAST TO JUMBLE-OF-ROCK)
    (WEST TO AT-WINDOW-ON-PIT-1)
    (ACTION AT-Y2-F)>

<ROUTINE AT-Y2-F (RARG)
    <COND (<=? .RARG ,M-BEG>
           <COND (<VERB? PLUGH>
                  <GOTO ,INSIDE-BUILDING>
                  <RTRUE>)
                 (<VERB? PLOVER>
                  <COND (<HELD? ,EGG-SIZED-EMERALD>
1497
                         <MOVE ,EGG-SIZED-EMERALD ,IN-PLOVER-ROOM>)>
Jesse McGrew's avatar
Jesse McGrew committed
1498
1499
1500
                  <GOTO ,IN-PLOVER-ROOM>
                  <RTRUE>)>)
          (<AND <=? .RARG ,M-END>
1501
                <VERB? LOOK WALK>
Jesse McGrew's avatar
Jesse McGrew committed
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
                <PROB 25>>
           <TELL CR "A hollow voice says, \"Plugh.\"" CR>
           <RFALSE>)>>

<OBJECT Y2-ROCK
    (DESC "\"Y2\" rock")
    (IN AT-Y2)
    (SYNONYM ROCK Y2)
    (ADJECTIVE Y2)
    (TEXT "There is a large \"Y2\" painted on the rock.")
    (FLAGS NDESCBIT SURFACEBIT)>

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

<ROOM JUMBLE-OF-ROCK
    (DESC "Jumble of Rock")
    (IN ROOMS)
    (LDESC "You are in a jumble of rocks, with cracks everywhere.")
    (DOWN TO AT-Y2)
    (UP TO IN-HALL-OF-MISTS)>

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

<ROOM AT-WINDOW-ON-PIT-1
    (DESC "At Window on Pit")
    (IN ROOMS)
    (GLOBAL WINDOW HUGE-PIT MARKS-IN-DUST SHADOWY-FIGURE MIST)
    (ACTION AT-WINDOW-ON-PIT-ROOMS-F)
    (EAST TO AT-Y2)>

;"AT-WINDOW-ON-PIT-1 and AT-WINDOW-ON-PIT-2 have nearly identical descriptions
  and some common action responses, so we handle them with the same routine"
<ROUTINE AT-WINDOW-ON-PIT-ROOMS-F (RARG)
    <COND (<=? .RARG ,M-BEG>
           <COND (<VERB? WAVE-HANDS>
                  <TELL "The shadowy figure waves back at you!" CR>)
                 (<AND <VERB? WALK> <0? <GETPT ,HERE ,PRSO>>>
                  <TELL "The only passage is back "
                        <COND (<=? ,HERE ,AT-WINDOW-ON-PIT-1> "east to Y2")
                              (ELSE "west to the junction")>
                        "." CR>)
                 (<AND <VERB? JUMP> <=? ,HERE ,AT-WINDOW-ON-PIT-2>>
                  <JIGS-UP "You jump and break your neck!">)>)
          (<=? .RARG ,M-LOOK>
           <TELL "You're at a low window overlooking a huge pit, which extends up out of sight.
A floor is indistinctly visible over 50 feet below.
Traces of white mist cover the floor of the pit, becoming thicker to the "
                 <COND (<=? ,HERE ,AT-WINDOW-ON-PIT-1> "right") (ELSE "left")> ".
Marks in the dust around the window would seem to indicate that someone has been here recently.
Directly across the pit from you and 25 feet away there is a similar window looking into
a lighted room.
A shadowy figure can be seen there peering back at you." CR>)>>

<OBJECT WINDOW
    (DESC "window")
    (IN LOCAL-GLOBALS)
    (SYNONYM WINDOW)
    (ADJECTIVE LOW)
    (LDESC "It looks like a regular window.")
    ;(FLAGS OPENABLEBIT)>

<OBJECT HUGE-PIT
    (DESC "huge pit")
    (IN LOCAL-GLOBALS)
    (SYNONYM PIT)
    (ADJECTIVE DEEP LARGE)
    (LDESC "It's so deep you can barely make out the floor below, and the top isn't visible at all.")>

<OBJECT MARKS-IN-DUST
    (DESC "marks in the dust")
    (IN LOCAL-GLOBALS)
    (SYNONYM MARKS DUST)
    (LDESC "Evidently you're not alone here.")
    (FLAGS PLURALBIT MULTITUDEBIT)>

<OBJECT SHADOWY-FIGURE
    (DESC "shadowy figure")
    (IN LOCAL-GLOBALS)
    (SYNONYM FIGURE PERSON INDIVIDUAL SHADOW)
1581
    (ADJECTIVE MYSTERIOUS SHADOWY)
Jesse McGrew's avatar
Jesse McGrew committed
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
    (LDESC "The shadowy figure seems to be trying to attract your attention.")>

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

<ROOM IN-DIRTY-PASSAGE
    (DESC "Dirty Passage")
    (IN ROOMS)
    (LDESC "You are in a dirty broken passage. To the east is a crawl.
To the west is a large passage. Above you is a hole to another passage.")
    (EAST TO ON-BRINK-OF-PIT)
    (UP TO LOW-N/S-PASSAGE)
    (WEST TO IN-DUSTY-ROCK-ROOM)>

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

<ROOM ON-BRINK-OF-PIT
    (DESC "Brink of Pit")
    (IN ROOMS)
    (LDESC "You are on the brink of a small clean climbable pit.
A crawl leads west.")
    (WEST TO IN-DIRTY-PASSAGE)
    (DOWN TO IN-PIT)
    (IN TO IN-PIT)>

<OBJECT SMALL-CLIMBABLE-PIT
    (DESC "small pit")
    (IN ON-BRINK-OF-PIT)
    (SYNONYM PIT)
    (ADJECTIVE SMALL CLEAN CLIMBABLE)
    (TEXT "It looks like you might be able to climb down into it.")
    (ACTION SMALL-CLIMBABLE-PIT-F)
    (FLAGS NDESCBIT)>

<ROUTINE SMALL-CLIMBABLE-PIT-F ()
    <COND (<VERB? CLIMB ENTER>
1617
           <DO-WALK ,P?DOWN>
Jesse McGrew's avatar
Jesse McGrew committed
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
           <RTRUE>)>>

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

<ROOM IN-PIT
    (DESC "In Pit")
    (IN ROOMS)
    (LDESC "You are in the bottom of a small pit with a little stream,
which enters and exits through tiny slits.")
    (GLOBAL STREAM)
    (UP TO ON-BRINK-OF-PIT)
    (DOWN SORRY "You don't fit through the tiny slits!")
    (FLAGS SACREDBIT)>

<OBJECT TINY-SLITS
    (DESC "tiny slits")
    (IN IN-PIT)
    (SYNONYM SLIT SLITS)
    (ADJECTIVE TINY)
    (TEXT "The slits form a complex pattern in the rock.")
    (FLAGS NDESCBIT MULTITUDEBIT PLURALBIT)>

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

<ROOM IN-DUSTY-ROCK-ROOM
    (DESC "In Dusty Rock Room")
    (IN ROOMS)
    (LDESC "You are in a large room full of dusty rocks.
There is a big hole in the floor.
There are cracks everywhere, and a passage leading east.")
    (EAST TO IN-DIRTY-PASSAGE)
    (DOWN TO AT-COMPLEX-JUNCTION)>

<OBJECT DUSTY-ROCKS
    (DESC "dusty rocks")
    (IN IN-DUSTY-ROCK-ROOM)
    (TEXT "They're just rocks. (Dusty ones, that is.)")
    (ACTION DUSTY-ROCKS-F)
    (FLAGS NDESCBIT MULTITUDEBIT PLURALBIT)>

<ROUTINE DUSTY-ROCKS-F ()
    <COND (<VERB? LOOK-UNDER PUSH PULL>
           <TELL "You'd have to blast your way through." CR>)>>

;----------------------------------------------------------------------
"A maze of twisty little passages, all alike..."
;----------------------------------------------------------------------

;"Define a function to save a bit of tedium. This lets us specify connections
  within the maze by number instead of typing out the room name, and omit TO."
<DEFINE MAZE-ROOM (NAME "ARGS" CS "AUX" DEF PS)
    ;"Convert list of map connections to property definitions.
      (NORTH FOO-ROOM) -> (NORTH TO FOO-ROOM)
      (NORTH 5)        -> (NORTH TO ALIKE-MAZE-5)"
    <SET PS
        <MAPF ,LIST
              <FUNCTION (C "AUX" (DIR <1 .C>) (DEST <2 .C>))
                  <COND (<TYPE? .DEST FIX>
                         <SET DEST <PARSE <STRING "ALIKE-MAZE-" <UNPARSE .DEST>>>>)>
                  <LIST .DIR TO .DEST>>
              .CS>>
    ;"Build room definition and evaluate it"
    <SET DEF
        <FORM ROOM .NAME
1682
            <IFFLAG (DBMAZE <LIST DESC <SPNAME .NAME>>) (ELSE '(DESC "Maze"))>
Jesse McGrew's avatar
Jesse McGrew committed
1683
1684
1685
1686
1687
1688
1689
            '(IN ROOMS)
            '(LDESC "You are in a maze of twisty little passages, all alike.")
            '(ACTION MAZE-ROOMS-F)
            !.PS>>
    <EVAL .DEF>>

<ROUTINE MAZE-ROOMS-F (RARG)
1690
1691
1692
    <COND (<=? .RARG ,M-ENTER>
           <FCLEAR ,HERE ,TOUCHBIT>)
          (<AND <=? .RARG ,M-BEG>
Jesse McGrew's avatar
Jesse McGrew committed
1693
1694
1695
1696
1697
1698
1699
1700
                <VERB? WALK>
                <PRSO? ,P?OUT>>
           <TELL "Easier said than done." CR>)>>

<MAZE-ROOM ALIKE-MAZE-1
    (UP AT-WEST-END-OF-HALL-OF-MISTS) (NORTH 1) (EAST 2) (SOUTH 4) (WEST 11)>

<MAZE-ROOM ALIKE-MAZE-2
1701
    (WEST 1) (SOUTH 3) (EAST 4)>
Jesse McGrew's avatar
Jesse McGrew committed
1702
1703

<MAZE-ROOM ALIKE-MAZE-3
1704
    (EAST 2) (DOWN DEAD-END-3) (SOUTH 6) (NORTH DEAD-END-8)>
Jesse McGrew's avatar
Jesse McGrew committed
1705
1706
1707
1708

<MAZE-ROOM ALIKE-MAZE-4
    (WEST 1) (NORTH 2) (EAST DEAD-END-1) (SOUTH DEAD-END-2) (UP 14) (DOWN 14)>

1709
1710
1711
1712
1713
1714
<DEAD-END-ROOM DEAD-END-1 WEST ALIKE-MAZE-4>

<DEAD-END-ROOM DEAD-END-2 EAST ALIKE-MAZE-4>

<DEAD-END-ROOM DEAD-END-3 UP ALIKE-MAZE-3>

Jesse McGrew's avatar
Jesse McGrew committed
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
<MAZE-ROOM ALIKE-MAZE-5
    (EAST 6) (WEST 7)>

<MAZE-ROOM ALIKE-MAZE-6
    (EAST 3) (WEST 5) (DOWN 7) (SOUTH 8)>

<MAZE-ROOM ALIKE-MAZE-7
    (WEST 5) (UP 6) (EAST 8) (SOUTH 9)>

<MAZE-ROOM ALIKE-MAZE-8
1725
    (WEST 6) (EAST 7) (SOUTH 8) (UP 9) (NORTH 10) (DOWN DEAD-END-10)>
Jesse McGrew's avatar
Jesse McGrew committed
1726
1727
1728
1729

<MAZE-ROOM ALIKE-MAZE-9
    (WEST 7) (NORTH 8) (SOUTH DEAD-END-4)>

1730
<DEAD-END-ROOM DEAD-END-4 WEST ALIKE-MAZE-9>
Jesse McGrew's avatar
Jesse McGrew committed
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758

<MAZE-ROOM ALIKE-MAZE-10
    (WEST 8) (NORTH 10) (DOWN DEAD-END-5) (EAST AT-BRINK-OF-PIT)>

<DEAD-END-ROOM DEAD-END-5 UP ALIKE-MAZE-10>

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

<ROOM AT-BRINK-OF-PIT
    (DESC "At Brink of Pit")
    (IN ROOMS)
    (LDESC "You are on the brink of a thirty foot pit with a massive orange column down one wall.
You could climb down here but you could not get back up.
The maze continues at this level.")
    (DOWN TO IN-BIRD-CHAMBER)
    (WEST TO ALIKE-MAZE-10)
    (SOUTH TO DEAD-END-6)
    (NORTH TO ALIKE-MAZE-12)
    (EAST TO ALIKE-MAZE-13)>

<OBJECT MASSIVE-ORANGE-COLUMN
    (DESC "massive orange column")
    (IN AT-BRINK-OF-PIT)
    (TEXT "It looks like you could climb down it.")
    (ACTION MASSIVE-ORANGE-COLUMN-F)
    (FLAGS NDESCBIT)>

<ROUTINE MASSIVE-ORANGE-COLUMN-F ()
1759
    <COND (<VERB? CLIMB> <DO-WALK ,P?DOWN> <RTRUE>)>>
Jesse McGrew's avatar
Jesse McGrew committed
1760
1761
1762
1763
1764

<OBJECT PIT
    (DESC "pit")
    (IN AT-BRINK-OF-PIT)
    (SYNONYM PIT)
1765
    (ADJECTIVE THIRTY FOOT THIRTY-FOOT)
Jesse McGrew's avatar
Jesse McGrew committed
1766
1767
1768
1769
1770
1771
    (TEXT "You'll have to climb down to find out anything more...")
    (ACTION PIT-F)
    (FLAGS NDESCBIT)>

<ROUTINE PIT-F ()
    <COND (<VERB? CLIMB>
1772
           <DO-WALK ,P?DOWN>
Jesse McGrew's avatar
Jesse McGrew committed
1773
1774
           <RTRUE>)>>

1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
<DEAD-END-ROOM DEAD-END-6 EAST AT-BRINK-OF-PIT>

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

<MAZE-ROOM ALIKE-MAZE-11
    (NORTH 1) (WEST 11) (SOUTH 11) (EAST DEAD-END-7)>

<DEAD-END-ROOM DEAD-END-7 WEST ALIKE-MAZE-11>

<DEAD-END-ROOM DEAD-END-8 SOUTH ALIKE-MAZE-3>

<MAZE-ROOM ALIKE-MAZE-12
    (SOUTH AT-BRINK-OF-PIT) (EAST 13) (WEST DEAD-END-9)>

<MAZE-ROOM ALIKE-MAZE-13
    (NORTH AT-BRINK-OF-PIT) (WEST 12) (NW PIRATE-DEAD-END)>

<DEAD-END-ROOM DEAD-END-9 EAST ALIKE-MAZE-12>

<DEAD-END-ROOM DEAD-END-10 UP ALIKE-MAZE-8>

<MAZE-ROOM ALIKE-MAZE-14
    (UP 4) (DOWN 4)>

<ROOM PIRATE-DEAD-END
    (DESC "Dead End")
    (IN ROOMS)
    (LDESC "This is the pirate's dead end.")
    (SE TO ALIKE-MAZE-13)
    (OUT TO ALIKE-MAZE-13)
    (ACTION PIRATE-DEAD-END-F)
    (FLAGS SACREDBIT)>

<ROUTINE PIRATE-DEAD-END-F (RARG)
    <COND (<=? .RARG ,M-ENTER>
           <DEQUEUE I-PIRATE>
           <COND (<AND <IN? ,TREASURE-CHEST ,HERE>
                       <NOT <FSET? ,TREASURE-CHEST ,TOUCHBIT>>>
                  <TELL "You've found the pirate's treasure chest!" CR>)>)>>

<OBJECT TREASURE-CHEST
    (DESC "treasure chest")
    (IN PIRATE-DEAD-END)
    (SYNONYM CHEST BOX RICHES TREASURE)
1819
    (ADJECTIVE PIRATE TREASURE PIRATE\'S)
1820
1821
1822
1823
    (FDESC "The pirate's treasure chest is here!")
    (TEXT "It's the pirate's treasure chest, filled with riches of all kinds!")
    (DEPOSIT-POINTS 12)
    (FLAGS TAKEBIT TREASUREBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897

;----------------------------------------------------------------------
"A line of three vital junctions, east to west"
;----------------------------------------------------------------------

<ROOM AT-COMPLEX-JUNCTION
    (DESC "At Complex Junction")
    (IN ROOMS)
    (LDESC "You are at a complex junction.
A low hands and knees passage from the north joins a higher crawl from the east
to make a walking passage going west. There is also a large room above.
The air is damp here.")
    (UP TO IN-DUSTY-ROCK-ROOM)
    (WEST TO IN-BEDQUILT)
    (NORTH TO IN-SHELL-ROOM)
    (EAST TO IN-ANTEROOM)>

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

<ROOM IN-BEDQUILT
    (DESC "In Bedquilt")
    (IN ROOMS)
    (LDESC "You are in bedquilt, a long east/west passage with holes everywhere.
To explore at random select north, south, up, or down.")
    (EAST TO AT-COMPLEX-JUNCTION)
    (WEST TO IN-SWISS-CHEESE-ROOM)
    (SOUTH TO IN-SLAB-ROOM)
    (UP TO IN-DUSTY-ROCK-ROOM)
    (NORTH TO AT-JUNCTION-OF-THREE)
    (DOWN TO IN-ANTEROOM)
    (ACTION IN-BEDQUILT-F)>

<CONSTANT CRAWLED-AROUND-HOLES "You have crawled around in some little holes and
wound up back in the main passage.">

<ROUTINE IN-BEDQUILT-F (RARG "AUX" DEST)
    <COND (<AND <=? .RARG ,M-BEG> <VERB? WALK>>
           <COND (<AND <PRSO? ,P?SOUTH ,P?DOWN> <PROB 80>>
                  <SET DEST 1>)
                 (<PRSO? ,P?UP>
                  <COND (<PROB 80> <SET DEST 1>)>
                  <COND (<PROB 50> <SET DEST ,IN-SECRET-N/S-CANYON-1>)>)
                 (<PRSO? ,P?NORTH>
                  <COND (<PROB 60> <SET DEST 1>)>
                  <COND (<PROB 75> <SET DEST ,IN-LARGE-LOW-ROOM>)>)>
           <COND (<0? .DEST> <RFALSE>)
                 (<1? .DEST> <TELL ,CRAWLED-AROUND-HOLES CR>)
                 (ELSE <GOTO .DEST> <RTRUE>)>)>>

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

<ROOM IN-SWISS-CHEESE-ROOM
    (DESC "In Swiss Cheese Room")
    (IN ROOMS)
    (LDESC "You are in a room whose walls resemble swiss cheese.
Obvious passages go west, east, ne, and nw.
Part of the room is occupied by a large bedrock block.")
    (WEST TO AT-EAST-END-OF-TWOPIT-ROOM)
    (SOUTH TO IN-TALL-E/W-CANYON)
    (NE TO IN-BEDQUILT)
    (NW TO IN-ORIENTAL-ROOM)
    (EAST TO IN-SOFT-ROOM)
    (ACTION IN-SWISS-CHEESE-ROOM-F)>

<ROUTINE IN-SWISS-CHEESE-ROOM-F (RARG)
    <COND (<AND <=? .RARG ,M-BEG>
                <VERB? WALK>
                <OR <AND <PRSO? ,P?SOUTH> <PROB 80>>
                    <AND <PRSO? ,P?NW> <PROB 50>>>>
           <TELL ,CRAWLED-AROUND-HOLES CR>)>>

<OBJECT BEDROCK-BLOCK
    (DESC "bedrock block")
    (IN IN-SWISS-CHEESE-ROOM)
1898
    (SYNONYM BEDROCK BLOCK)
Jesse McGrew's avatar
Jesse McGrew committed
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
    (ADJECTIVE BEDROCK LARGE)
    (TEXT "It's just a huge block.")
    (ACTION BEDROCK-BLOCK-F)
    (FLAGS NDESCBIT)>

<ROUTINE BEDROCK-BLOCK-F ()
    <COND (<VERB? LOOK-UNDER PUSH PULL TAKE>
           <TELL "Surely you're joking." CR>)>>

;----------------------------------------------------------------------
"The Twopit Room area"
;----------------------------------------------------------------------

;"Possible heights for the plant"
<CONSTANT TINY-HEIGHT 0>
<CONSTANT TALL-HEIGHT 1>
<CONSTANT HUGE-HEIGHT 2>

<ROOM AT-WEST-END-OF-TWOPIT-ROOM
    (DESC "At West End of Twopit Room")
    (IN ROOMS)
    (LDESC "You are at the west end of the twopit room.
There is a large hole in the wall above the pit at the end of this room.")
    (GLOBAL PLANT-STICKING-UP HOLE-ABOVE-PIT-WEST MIST)
    (EAST TO AT-EAST-END-OF-TWOPIT-ROOM)
    (WEST TO IN-SLAB-ROOM)
    (DOWN TO IN-WEST-PIT)
    (UP SORRY "It is too far up for you to reach.")
    (ACTION POTENTIAL-PLANT-STICKING-UP-ROOMS-F)>

<ROUTINE POTENTIAL-PLANT-STICKING-UP-ROOMS-F (RARG)
1930
    <COND (<AND <=? .RARG ,M-FLASH>
Jesse McGrew's avatar
Jesse McGrew committed
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
                <NOT <FSET? ,PLANT-STICKING-UP ,INVISIBLE>>>
           <CRLF>
           <DESCRIBE-PLANT-STICKING-UP>
           <RTRUE>)>>

<OBJECT PLANT-STICKING-UP
    (DESC "beanstalk")
    (IN LOCAL-GLOBALS)
    (SYNONYM PLANT BEANSTALK STALK)
    ;"V3 property size is limited to 8 bytes"
    %<VERSION?
        (ZIP '(ADJECTIVE BEAN GIANT TINY LITTLE TWELVE FOOT TALL))
        (ELSE '(ADJECTIVE BEAN GIANT TINY LITTLE TWELVE FOOT TALL MURMURING BELLOWING))>
    (ACTION PLANT-STICKING-UP-F)
1945
    (FLAGS INVISIBLE SPONGEBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
1946
1947

<ROUTINE DESCRIBE-PLANT-STICKING-UP ()
1948
    <THIS-IS-IT ,PLANT-STICKING-UP>
Jesse McGrew's avatar
Jesse McGrew committed
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
    <COND (<=? ,PLANT-HEIGHT ,TALL-HEIGHT>
           <TELL "The top of a 12-foot-tall beanstalk is poking out of the west pit." CR>)
          (ELSE
           <TELL "There is a huge beanstalk growing out of the west pit up to the hole." CR>)>>

<ROUTINE PLANT-STICKING-UP-F ()
    <COND (<VERB? EXAMINE> <DESCRIBE-PLANT-STICKING-UP>)
          (<AND <VERB? CLIMB> <=? ,PLANT-HEIGHT ,HUGE-HEIGHT>>
           <PERFORM ,V?CLIMB ,PLANT>
           <RTRUE>)>>

<OBJECT HOLE-ABOVE-PIT-WEST
    (DESC "hole above pit")
    (IN LOCAL-GLOBALS)
    (SYNONYM HOLE PIT)
    (ADJECTIVE HOLE ABOVE)
    (TEXT "The hole is in the wall above the pit at this end of the room.")
    (ACTION HOLE-ABOVE-PIT-WEST-F)>

<ROUTINE HOLE-ABOVE-PIT-WEST-F ()
    <COND (<VERB? ENTER> <TELL "It is too far up for you to reach." CR>)>>

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

<ROOM IN-WEST-PIT
    (DESC "In West Pit")
    (IN ROOMS)
    (LDESC "You are at the bottom of the western pit in the twopit room.
There is a large hole in the wall about 25 feet above you.")
    (GLOBAL HOLE-ABOVE-PIT-WEST)
    (UP TO AT-WEST-END-OF-TWOPIT-ROOM)
    (ACTION IN-WEST-PIT-F)
    (FLAGS SACREDBIT)>

;"TODO: is this CLIMB handler needed?"
<ROUTINE IN-WEST-PIT-F (RARG)
    <COND (<AND <=? .RARG ,M-BEG> <VERB? CLIMB> <NOT <PRSO? ,PLANT>>>
           <COND (<=? ,PLANT-HEIGHT ,TINY-HEIGHT>
                  <TELL "There is nothing here to climb. Use \"up\" or \"out\" to leave the pit." CR>)>)>>

<GLOBAL PLANT-HEIGHT ,TINY-HEIGHT>

<OBJECT PLANT
    (DESC "plant")
    (IN IN-WEST-PIT)
    (SYNONYM PLANT BEANSTALK STALK)
    ;"V3 property size is limited to 8 bytes"
    %<VERSION?
        (ZIP '(ADJECTIVE BEAN GIANT TINY LITTLE TWELVE FOOT TALL))
        (ELSE '(ADJECTIVE BEAN GIANT TINY LITTLE TWELVE FOOT TALL MURMURING BELLOWING))>
    (DESCFCN PLANT-DESCFCN)
2000
2001
    (ACTION PLANT-F)
    (FLAGS SPONGEBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
2002
2003
2004
2005

<ROUTINE PLANT-DESCFCN (ARG)
    <COND (<=? .ARG ,M-OBJDESC?> <RTRUE>)>
    <COND (<=? ,PLANT-HEIGHT ,TINY-HEIGHT>
2006
           <TELL "There is a tiny little plant in the pit, murmuring \"Water, water, ...\"" CR>)
Jesse McGrew's avatar
Jesse McGrew committed
2007
2008
          (<=? ,PLANT-HEIGHT ,TALL-HEIGHT>
           <TELL "There is a 12-foot-tall beanstalk stretching up out of the pit,
2009
bellowing \"Water!! Water!!\"" CR>)
Jesse McGrew's avatar
Jesse McGrew committed
2010
          (ELSE
2011
           <TELL "There is a gigantic beanstalk stretching all the way up to the hole." CR>)>>
Jesse McGrew's avatar
Jesse McGrew committed
2012
2013
2014
2015
2016
2017

<ROUTINE PLANT-F ("AUX" F)
    <COND (<VERB? CLIMB>
           <COND (<=? ,PLANT-HEIGHT ,TINY-HEIGHT>
                  <TELL "It's just a little plant!" CR>)
                 (<=? ,PLANT-HEIGHT ,TALL-HEIGHT>
2018
                  <TELL "You have climbed up the plant and out of the pit." CR CR>
Jesse McGrew's avatar
Jesse McGrew committed
2019
2020
2021
                  <GOTO ,AT-WEST-END-OF-TWOPIT-ROOM>
                  <RTRUE>)
                 (ELSE
2022
                  <TELL "You clamber up the plant and scurry through the hole at the top." CR CR>
Jesse McGrew's avatar
Jesse McGrew committed
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
                  <GOTO ,IN-NARROW-CORRIDOR>
                  <RTRUE>)>)
          (<VERB? TAKE>
           <TELL CT ,PLANT " has exceptionally deep roots and cannot be pulled free." CR>)
          (<VERB? WATER>
           <COND (<NOT <HELD? ,BOTTLE>>
                  <TELL "You have nothing to water the plant with." CR>)
                 (<NOT <SET F <FIRST? ,BOTTLE>>>
                  <TELL CT ,BOTTLE " is empty." CR>)
                 (<=? .F ,OIL-IN-BOTTLE>
                  <REMOVE .F>
                  <TELL CT ,PLANT " indignantly shakes the oil off its leaves and asks, \"Water?\"" CR>)
                 (ELSE
                  <REMOVE .F>
                  <COND (<=? ,PLANT-HEIGHT ,TINY-HEIGHT>
                         <INC PLANT-HEIGHT>
                         <TELL CT ,PLANT " spurts into furious growth for a few seconds." CR CR>
                         <FCLEAR ,PLANT-STICKING-UP ,INVISIBLE>)
                        (<=? ,PLANT-HEIGHT ,TALL-HEIGHT>
                         <INC PLANT-HEIGHT>
                         <TELL CT ,PLANT " grows explosively, almost filling the bottom of the pit." CR CR>)
                        (ELSE
                         <TELL "You've over-watered the plant! It's shriveling up! It's, it's..." CR CR>
                         <FSET ,PLANT-STICKING-UP ,INVISIBLE>
                         <SETG PLANT-HEIGHT ,TINY-HEIGHT>)>
                  <PERFORM ,V?EXAMINE ,PRSO>
                  <RTRUE>)>)
          (<VERB? OIL>
           <PERFORM ,V?WATER ,PRSO>)
          (<VERB? EXAMINE>
2053
2054
2055
2056
2057
           <PLANT-DESCFCN ,M-OBJDESC>)
          (<AND <VERB? GIVE>
                <PRSO? ,WATER-IN-BOTTLE ,OIL-IN-BOTTLE>>
           <PERFORM ,V?WATER ,PRSI>
           <RTRUE>)>>
Jesse McGrew's avatar
Jesse McGrew committed
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079

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

<ROOM AT-EAST-END-OF-TWOPIT-ROOM
    (DESC "At East End of Twopit Room")
    (IN ROOMS)
    (LDESC "You are at the east end of the twopit room.
The floor here is littered with thin rock slabs, which make it easy to descend the pits.
There is a path here bypassing the pits to connect passages from east and west.
There are holes all over, but the only big one is on the wall directly over the west pit
where you can't get to it.")
    (GLOBAL HOLE-ABOVE-PIT-EAST PLANT-STICKING-UP)
    (EAST TO IN-SWISS-CHEESE-ROOM)
    (WEST TO AT-WEST-END-OF-TWOPIT-ROOM)
    (DOWN TO IN-EAST-PIT)
    (ACTION POTENTIAL-PLANT-STICKING-UP-ROOMS-F)>

<OBJECT THIN-ROCK-SLABS
    (DESC "thin rock slabs")
    (IN AT-EAST-END-OF-TWOPIT-ROOM)
    (SYNONYM SLABS SLAB ROCKS STAIRS)
    (ADJECTIVE THIN ROCK)
2080
    (TEXT "They almost form natural stairs down into the pit.")
Jesse McGrew's avatar
Jesse McGrew committed
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
    (ACTION THIN-ROCK-SLABS-F)
    (FLAGS NDESCBIT PLURALBIT MULTITUDEBIT)>

<ROUTINE THIN-ROCK-SLABS-F ()
    <COND (<VERB? LOOK-UNDER PUSH PULL TAKE>
           <TELL "Surely you're joking. You'd have to blast them aside." CR>)>>

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

<ROOM IN-EAST-PIT
    (DESC "In East Pit")
    (IN ROOMS)
    (LDESC "You are at the bottom of the eastern pit in the twopit room.
There is a small pool of oil in one corner of the pit.")
    (GLOBAL HOLE-ABOVE-PIT-EAST)
    (UP TO AT-EAST-END-OF-TWOPIT-ROOM)
    (FLAGS SACREDBIT)>

<OBJECT OIL
    (DESC "pool of oil")
    (IN IN-EAST-PIT)
    (SYNONYM POOL OIL)
    (TEXT "It looks like ordinary oil.")
    (ACTION OIL-F)
2105
    (FLAGS NDESCBIT SPRINGBIT)>
Jesse McGrew's avatar
Jesse McGrew committed
2106
2107
2108
2109

<ROUTINE OIL-F ()
    <COND (<VERB? DRINK> <TELL "Absolutely not." CR>)
          (<VERB? TAKE>
2110
           <COND (<HELD? ,BOTTLE> <PERFORM ,V?FILL-WITH ,BOTTLE ,OIL> <RTRUE>)
Jesse McGrew's avatar
Jesse McGrew committed
2111
2112
                 (ELSE <TELL "You have nothing in which to carry the oil." CR>)>)
          (<VERB? PUT-IN>
2113
           <COND (<PRSI? ,BOTTLE> <PERFORM ,V?FILL-WITH ,BOTTLE ,OIL> <RTRUE>)
Jesse McGrew's avatar
Jesse McGrew committed
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
                 (ELSE <TELL "You have nothing in which to carry the oil." CR>)>)>>

<OBJECT HOLE-ABOVE-PIT-EAST
    (DESC "hole above pit")
    (IN LOCAL-GLOBALS)
    (SYNONYM HOLE PIT)
    (ADJECTIVE HOLE ABOVE)
    (TEXT "The hole is in the wall above you.")
    (FLAGS NDESCBIT)>

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

<ROOM IN-SLAB-ROOM
    (DESC "Slab Room")
    (IN ROOMS)
    (LDESC "You are in a large low circular chamber whose floor is an immense slab
fallen from the ceiling (slab room). East and west there once were large passages,
but they are now filled with boulders. Low small passages go north and south, and
the south one quickly bends west around the boulders.")
    (SOUTH TO AT-WEST-END-OF-TWOPIT-ROOM)
    (UP TO IN-SECRET-N/S-CANYON-0)
    (NORTH TO IN-BEDQUILT)>

<OBJECT SLAB
    (DESC "slab")
    (IN IN-SLAB-ROOM)
    (SYNONYM SLAB)
    (ADJECTIVE IMMENSE)
    (TEXT "It is now the floor here.")
    (ACTION SLAB-F)
    (FLAGS NDESCBIT)>

<ROUTINE SLAB-F ()
    <COND (<VERB? LOOK-UNDER PUSH PULL TAKE>
           <TELL "Surely you're joking." CR>)>>

<OBJECT BOULDERS
    (DESC "boulders")
    (IN IN-SLAB-ROOM)
2153
    (SYNONYM BOULDER ROCKS STONES BOULDERS)
Jesse McGrew's avatar
Jesse McGrew committed
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211