-
Notifications
You must be signed in to change notification settings - Fork 17
/
c3.zil
2302 lines (2137 loc) · 66.4 KB
/
c3.zil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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
225
226
227
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
254
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
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
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
416
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
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
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
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
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
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
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
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
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"C3 for
MAGE
(c) Copyright 1985 Infocom, Inc. All Rights Reserved."
"AIR"
<OBJECT AIR-CUBE
(IN MOUTH)
(DESC "cube")
(SYNONYM CUBE CUBES)
(ADJECTIVE CQ ;C3 SMALL FEATURELESS WHITE)
(NAME 0)
(TEXT "eagles")
(FLAGS NDESCBIT TAKEBIT TRYTAKEBIT)
(ACTION CUBE-F)
(DESCFCN CUBE-DESC)
(GENERIC GENERIC-CUBE-F)
(CUBE AIR-ROOM)>
<ROOM AIR-ROOM
(IN ROOMS)
(DESC "Air Room")
(CUBE AIR-CUBE)
(NORTH TO GLACIER-ROOM)
(WEST TO BAZAAR)
(SOUTH PER MIDAIR-EXIT) ;"EITHER WARNING OR MIDAIR"
(DOWN PER MAGIC-BOX-EXIT)
(ACTION AIR-ROOM-F)
(FLAGS RLANDBIT)
(GLOBAL GLOBAL-HOLE)
(THINGS <PSEUDO (FLUFFY CLOUD CLOUD-PSEUDO)
(FLUFFY CLOUDS CLOUD-PSEUDO)>)>
<ROUTINE MIDAIR-EXIT ()
<COND (<OR ,FALL-WARNING? <IN? ,PLAYER ,MAGIC-CARPET>>
,MIDAIR)
(ELSE
<SETG FALL-WARNING? T>
<TELL
"You pull back at the edge, noticing just in time that the hole in the
floor opens into thin air which goes a long way down before anything
solid is reached." CR>
<RFALSE>)>>
<GLOBAL FALL-WARNING?:FLAG <>>
<ROUTINE AIR-ROOM-F (RARG)
<COND (<EQUAL? .RARG ,M-LOOK>
<TELL
"You are on a large fluffy white cloud. In fact, you are
surrounded by clouds. They blow past, wind seeming to boil them around
you from all sides. There is a bit of clear air to the north, momentary
gaps in the clouds to the south and west, and an alarming one below
you." CR>)
(<EQUAL? .RARG ,M-LEAVE>
<RECOVER-CUBE>)>>
<ROOM GLACIER-ROOM
(IN ROOMS)
(DESC "Glacier")
(ACTION GLACIER-ROOM-F)
(FLAGS RLANDBIT OUTSIDE ONBIT)
(THINGS
<PSEUDO (TRACKLESS GLACIER GLACIER-PSEUDO)
(<> ICE GLACIER-PSEUDO)
(<> SNOW GLACIER-PSEUDO)
(<> CREVASSE GLACIER-PSEUDO)
(FLATHEAD MOUNTAIN MOUNTAIN-PSEUDO)>)>
<ROUTINE GLACIER-ROOM-F (RARG)
<COND (<EQUAL? .RARG ,M-LOOK>
<TELL
"You are in the midst of a trackless glacier in the Flathead Mountains.
Snow blows around you, the wind complaining of its own discomfort. This
is a desolate and dangerous place, for there are crevasses everywhere
under the deceptive blanket of snow." CR>)
(<EQUAL? .RARG ,M-BEG>
<COND (<VERB? WALK>
<COND (<PROB 75>
<JIGS-UP
"You have just walked into a crevasse.">)
(ELSE
<GOTO ,GLACIER-ROOM>)>)>)
(<EQUAL? .RARG ,M-LEAVE>
<SETG FREEZE-COUNT 0>)
(<EQUAL? .RARG ,M-END>
<SETG FREEZE-COUNT <+ ,FREEZE-COUNT 1>>
<COND (<EQUAL? ,FREEZE-COUNT 5>
<TELL CR
"Your body is becoming numb from the cold." CR>)
(<EQUAL? ,FREEZE-COUNT 10>
<CRLF>
<JIGS-UP
"The freezing weather has overcome you. You die of hypothermia.">)>)>>
<ROUTINE GLACIER-PSEUDO ()
<COND (<VERB? EXAMINE>
<TELL
"The ice glints so brightly that you are almost blinded." CR>)
(<VERB? TINSOT>
<TELL
"Coals to Newcastle, if you ask me." CR>)>>
<ROOM EMPORIUM
(IN ROOMS)
(DESC "Emporium")
(ACTION EMPORIUM-F)
(WEST TO BAZAAR IF EMPORIUM-DOOR IS OPEN)
(OUT TO BAZAAR IF EMPORIUM-DOOR IS OPEN)
(FLAGS ONBIT RLANDBIT)
(GLOBAL EMPORIUM-DOOR)
(THINGS
<PSEUDO (<> SIGN SIGN-PSEUDO)
(<> SIGNS SIGN-PSEUDO)
(<> PILE CARPET-PSEUDO)
(<> CARPET CARPET-PSEUDO)
(WOVEN RUGS CARPET-PSEUDO)
(ORNATE RUGS CARPET-PSEUDO)>)>
<ROUTINE CARPET-PSEUDO ()
<COND (<VERB? EXAMINE>
<TELL
"They are beautiful examples of the weaver's art." CR>)
(<VERB? TAKE>
<TELL
"You might be accused of thievery." CR>)
(<VERB? BUY>
<TELL ,MORE-SPECIFIC ,PERIOD>)>>
<ROUTINE SIGN-PSEUDO ()
<COND (<VERB? READ EXAMINE>
<TELL
"The sign might as well be Greek." CR>)>>
<ROUTINE EMPORIUM-F (RARG)
<COND (<EQUAL? .RARG ,M-LOOK>
<TELL
"This is the middle of a huge emporium. Signs in a language unknown to you
grace the displays. Most of the objects displayed are ornately woven rugs.
There is an exit into the street to the west."
CR>)
(<EQUAL? .RARG ,M-ENTER>
<QUEUE I-KICKED-OUT 50>
<QUEUE I-MERCHANT -1>)
(<EQUAL? .RARG ,M-LEAVE>
<COND (<OR <HELD? ,MAGIC-CARPET>
<HELD? ,RANDOM-CARPET>>
<FSET ,EMPORIUM-DOOR ,LOCKED>
<FCLEAR ,EMPORIUM-DOOR ,OPENBIT>)>
<DEQUEUE I-MERCHANT>)
(<EQUAL? .RARG ,M-BEG>
<COND (<VERB? NO YES>
<TELL
"\"Words are trifles! Let me see your zorkmids!\" chides the merchant." CR>)
(<SPELL-VERB?>
<TELL
"The spell trickles away to nothing. The merchant smiles. \"Do you think
you are the first magician to try to use lawless, thieving magic on a
humble merchant?\"">
<KICKED-OUT>
<RTRUE>)>)>>
<OBJECT EMPORIUM-DOOR
(IN LOCAL-GLOBALS)
(DESC "shop door")
(SYNONYM DOOR)
(ADJECTIVE SHOP)
(ACTION EMPORIUM-DOOR-F)
(FLAGS DOORBIT OPENBIT)>
<ROUTINE EMPORIUM-DOOR-F ()
<COND (<AND <VERB? OPEN KNOCK REZROV THROUGH>
<FSET? ,EMPORIUM-DOOR ,LOCKED>>
<MERCHANT-AT-DOOR>)
(<VERB? THROUGH>
<DO-WALK <COND (<EQUAL? ,HERE ,BAZAAR> ,P?EAST)
(ELSE ,P?WEST)>>)>>
<ROUTINE MERCHANT-AT-DOOR ()
<TELL
,DOOR-LOCKED ", apparently by powerful magic. When you attempt
entry, the merchant opens a small panel in the door and recognizes you.
\"We're closed for lunch!\" He slams the panel shut." CR>>
<ROUTINE EMPORIUM-EXIT ()
<COND (<FSET? ,EMPORIUM-DOOR ,LOCKED>
<THIS-IS-IT ,EMPORIUM-DOOR>
<MERCHANT-AT-DOOR>
<RFALSE>)
(<FSET? ,EMPORIUM-DOOR ,OPENBIT>
,EMPORIUM)
(ELSE
<TELL-OPEN-CLOSED ,EMPORIUM-DOOR>
<RFALSE>)>>
<OBJECT ZORKMID
(IN MOUNTAIN-TOP)
(DESC "gold coin")
(SYNONYM ZORKMID ZM MONEY COIN)
(ADJECTIVE GOLD INTNUM PRICE)
(ACTION ZORKMID-F)
(FLAGS TAKEBIT TRYTAKEBIT)>
<ROUTINE ZORKMID-F ()
<COND (<VERB? EXAMINE READ>
<TELL
"This is a gold 500 zorkmid piece." CR>)>>
<OBJECT MERCHANT
(IN EMPORIUM)
(DESC "merchant")
(SYNONYM MERCHANT SALESMAN MAN)
(ADJECTIVE YOUNG EARNEST)
(FLAGS THE PERSON OPENBIT CONTBIT TRANSBIT)
(CONTFCN MERCHANT-F)
(DESCFCN MERCHANT-DESC)
(ACTION MERCHANT-F)>
<ROUTINE MERCHANT-DESC (RARG OBJ)
<TELL
"A young and earnest-looking merchant stands near a pile
of carpets">
<COND (<FIRST? ,MERCHANT>
<TELL ". He is carrying in his arms a ">
<COND (<IN? ,MAGIC-CARPET ,MERCHANT>
<TELL
'MAGIC-CARPET " with a design of cubes on it">
<COND (<IN? ,RANDOM-CARPET ,MERCHANT>
<TELL " and a ">)>)>
<COND (<IN? ,RANDOM-CARPET ,MERCHANT>
<TELL
'RANDOM-CARPET " that's shabby and badly made">)>)>
<TELL ,PERIOD>>
<GLOBAL MERCHANT-FLAG:FLAG <>>
<ROUTINE MERCHANT-F ("OPTIONAL" (RARG <>) "AUX" PREV)
<SETG MERCHANT-FLAG T>
<COND (<EQUAL? ,WINNER ,MERCHANT>
<COND (<AND <VERB? TELL-ABOUT>
<EQUAL? ,PRSO ,ME>>
<RFALSE>)
(<VERB? HELLO>
<TELL
"\"Greetings to you! May I be of assistance?\"" CR>)
(<OR <VERB? TELL-ME-ABOUT>
<AND <VERB? GIVE SELL>
<EQUAL? ,PRSI ,ME>>>
<ASK-ABOUT-CARPET ,PRSO>)
(<ZERO? ,YOUR-OFFER>
<TELL
"\"Would you care to purchase a fine carpet?\"" CR>)
(ELSE
<TELL
"\"Come, come. I haven't all day.\"" CR>)>)
(<EQUAL? .RARG ,M-CONTAINER>
<COND (<VERB? EXAMINE> <RFALSE>)
(<VERB? BUY>
<COND (<EQUAL? ,PRSI ,OPAL ,ZORKMID>
<SETG ASKED-FOR ,PRSO>
<PERFORM ,V?GIVE ,PRSI ,MERCHANT>
<RTRUE>)
(<AND <ZERO? ,YOUR-OFFER>
<ZERO? ,MERCHANT-COUNT>>
<SETG ASKED-FOR ,PRSO>
<MAKE-NEW-OFFER>)
(ELSE
<ASK-ABOUT-CARPET ,PRSO>)>)
(<VERB? TAKE POINT RUB ADMIRE POINT>
<ASK-ABOUT-CARPET ,PRSO>)
(<NOT <VERB? FIND>>
<TELL
"\"Your obvious eagerness to do business is matched only by your boorish
manners.\"" CR>)>)
(<NOT .RARG>
<COND (<AND <VERB? EXAMINE>
<EQUAL? ,PRSO ,MERCHANT>>
<TELL
"The merchant is extremely anxious to please. He looks as if it might be
his first day on the job. He's a young fellow wearing purple trousers
which bulge alarmingly at the knees, an orange-striped shirt and a
small hat. He has a detestable moustache." CR>)
(<VERB? BARGAIN>
<TELL
"\"This is precisely my intention!\"" CR>)
(<AND <VERB? GIVE SHOW> <EQUAL? ,PRSI ,MERCHANT>>
<COND (<EQUAL? ,PRSO ,MAGIC-CARPET>
<PERFORM ,V?TAKE ,RANDOM-CARPET>
<RTRUE>)
(<EQUAL? ,PRSO ,RANDOM-CARPET>
<PERFORM ,V?TAKE ,MAGIC-CARPET>
<RTRUE>)
(<NOT <G? ,MERCHANT-WANTS ,YOUR-OFFER>>
<TELL
"\"But we've already made a deal! I can't accept anything additional!\"" CR>)
(<OR <EQUAL? ,PRSO ,OPAL>
<EQUAL? ,PRSO ,ZORKMID ,INTNUM>>
<NEW-OFFER>)
(<NOT <ZERO? <GETP ,PRSO ,P?CUBE>>>
<TELL
"\"A mere gewgaw, hardly worth a single zorkmid!\"" CR>)
(<OR <FSET? ,PRSO ,MAGICBIT>
<FSET? ,PRSO ,SCROLLBIT>>
<TELL
"\"That sort of thing is worthless to me. I am a simple man with no
interest in magic!\"" CR>)
(ELSE
<TELL
"\"You insult me. You insult my wife, you insult my children, you insult
even my lowliest, mangiest dog.\"" CR>)>)>)>>
"ask for a carpet"
<ROUTINE ASK-ABOUT-CARPET (OBJ)
<COND (<ZERO? ,YOUR-OFFER>
<COND (<OR <VERB? ASK-ABOUT ASK-FOR TELL-ME-ABOUT>
<VERB? ADMIRE POINT>
<NOT <EQUAL? .OBJ ,MAGIC-CARPET ,RANDOM-CARPET>>>
<TELL
"\"I see you have excellent taste. Let me tell you about these fine carpets">
<COND (<NOT <EQUAL? .OBJ ,MAGIC-CARPET ,RANDOM-CARPET>>
<TELL " instead">)
(ELSE <SETG ASKED-FOR .OBJ>)>
<TELL
". They are my pride and joy, next of course to my nieces and nephews, but
I digress... These carpets are the best you will find anywhere.\"" CR>)
(ELSE
<SETG ASKED-FOR .OBJ>
<TELL
"\"This is a valuable carpet. What will you offer for it? I'm not in
business for my health.\"" CR>)>)
(<L? ,YOUR-OFFER ,MERCHANT-WANTS>
<TELL
"\"A serious offer, now! Enough of this game-playing!\"" CR>)
(<AND <EQUAL? .OBJ ,MAGIC-CARPET>
<IN? .OBJ ,MERCHANT>>
<COND (<EQUAL? ,ASKED-FOR ,MAGIC-CARPET>
<COND (<IN? ,RANDOM-CARPET ,PLAYER>
<TELL
"\"How silly of me! You wanted this one with the cubes, didn't you?\" He
gives it to you">)
(ELSE
<TELL
"He grudgingly gives you the " 'MAGIC-CARPET>)>
<COND (<IN? ,PLAYER ,RANDOM-CARPET>
<MOVE ,PLAYER ,HERE>)>
<MOVE ,RANDOM-CARPET ,MERCHANT>
<MOVE ,MAGIC-CARPET ,PLAYER>
<SCORE-OBJECT ,MAGIC-CARPET>
<COND (<NOT <IN? ,RANDOM-CARPET ,MERCHANT>>
<TELL ", retrieving the " 'RANDOM-CARPET>)>
<TELL ,PERIOD>)
(<EQUAL? ,ASKED-FOR ,RANDOM-CARPET>
<TELL
"\"No going back on our deal! I'll report you to the merchants'
association!\"" CR>)>)
(<AND <EQUAL? .OBJ ,RANDOM-CARPET>
<IN? .OBJ ,MERCHANT>>
<SETG ASKED-FOR ,RANDOM-CARPET>
<TELL
"He hurriedly gives you the " 'RANDOM-CARPET>
<COND (<NOT <IN? ,MAGIC-CARPET ,MERCHANT>>
<TELL ", retrieving the " 'MAGIC-CARPET>)>
<COND (<IN? ,PLAYER ,MAGIC-CARPET>
<MOVE ,PLAYER ,HERE>)>
<MOVE ,MAGIC-CARPET ,MERCHANT>
<MOVE ,RANDOM-CARPET ,PLAYER>
<TELL ,PERIOD>)
(ELSE
<TELL "\"Yes? What about " THE .OBJ "?\"" CR>)>>
"process new offer to merchant"
<ROUTINE NEW-OFFER ("AUX" NEW OBJ)
<COND (<EQUAL? ,PRSO ,ZORKMID ,INTNUM>
<SET OBJ ,ZORKMID>
<COND (<ZERO? ,P-NUMBER>
<COND (<ZERO? ,YOUR-OFFER>
<TELL
"\"Five hundred zorkmids? Possibly a true coin...\" He
tries to hide his interest. ">)>
<SET NEW 500>)
(ELSE
<SET NEW ,P-NUMBER>)>)
(ELSE
<SET OBJ ,PRSO>
<SET NEW ,MERCHANT-WANTS>)>
<COND (<NOT ,ASKED-FOR>
<SETG ASKED-FOR ,RANDOM-CARPET>
<TELL
"The merchant's eyes light up. \"No doubt you wish to purchase this lovely "
'RANDOM-CARPET ". A wise choice!\"" CR>)
(<NOT <G? ,MERCHANT-WANTS .NEW>>
<SETG YOUR-OFFER .NEW>
<TELL
"\"Done, then!\" The merchant takes " THE .OBJ ". ">
<COND (<NOT <EQUAL? .OBJ ,ZORKMID>>
<TELL "He examines it skeptically. \"I don't
really think this is worth the price, no, it won't do at all...\" He
hefts it in his hand. \"Well, I believe in accommodating our out-of-town
visitors. Otherwise, we don't get any repeat customers, right? I can always
put this trinket on the mantelpiece and regale my family with the story.\"
He smiles unctuously. ">)
(<G? ,YOUR-OFFER 500>
<TELL
"\"What do you take me for? This is only a 500 zorkmid piece! Trying to
cheat me is trying to cheat my children! This I cannot accept! Out with
you!\"">
<KICKED-OUT>
<RTRUE>)>
<MOVE .OBJ ,MERCHANT>
<MOVE ,RANDOM-CARPET ,PLAYER>
<TELL
"\"I don't know what my family will eat tonight, but they say I'm
softhearted. I only want to get back to my lunch, so you've got a deal. You
should have told me you were an expert.\" He gives you a carpet. \"Now
go before my family sees what a fool I've been...\"" CR>)
(<AND <NOT <L? .NEW 100>>
<NOT <L? .NEW <+ 50 ,YOUR-OFFER>>>>
<MAKE-NEW-OFFER .NEW>)
(ELSE
<COND (<ZERO? ,YOUR-OFFER>
<SETG YOUR-OFFER .NEW>)>
<TELL
"\"Now, really, you must bargain in good faith. My patience is not infinite,
as my lunch even now is congealing.\"" CR>)>>
<ROUTINE MAKE-NEW-OFFER ("OPTIONAL" (NEW 0))
<SETG YOUR-OFFER .NEW>
<SETG MERCHANT-COUNT <+ ,MERCHANT-COUNT 1>>
<COND (<NOT <G? ,MERCHANT-COUNT <GET ,MERCHANT-SAYS 0>>>
<SETG MERCHANT-WANTS <- ,MERCHANT-WANTS 100>>
<COND (<NOT <G? ,MERCHANT-WANTS ,YOUR-OFFER>>
<SETG MERCHANT-WANTS ,YOUR-OFFER>
<NEW-OFFER>)
(ELSE
<TELL <GET ,MERCHANT-SAYS
,MERCHANT-COUNT>
CR>)>)
(ELSE
<TELL
"\"That does it! Out you go! Down the road to the rag-pickers, you
thief!\"">
<KICKED-OUT>
<RTRUE>)>>
<GLOBAL ASKED-FOR:FLAG <>>
<ROUTINE KICKED-OUT ("AUX" (L <LOC ,PLAYER>))
<COND (<FSET? .L ,VEHBIT>
<MOVE ,PLAYER ,HERE>
<MOVE .L ,PLAYER>)>
<TELL " He throws you into the street and bars the door." CR CR>
<FCLEAR ,EMPORIUM-DOOR ,OPENBIT>
<FSET ,EMPORIUM-DOOR ,LOCKED>
<GOTO ,BAZAAR>>
<ROUTINE I-KICKED-OUT ()
<COND (<EQUAL? ,HERE ,EMPORIUM>
<TELL CR
"The merchant says, \"Time is money, and you've wasted too much of mine!\"">
<KICKED-OUT>)>>
<GLOBAL YOUR-OFFER:NUMBER 0>
<GLOBAL MERCHANT-WANTS:NUMBER 900>
<GLOBAL MERCHANT-COUNT:NUMBER 0>
<GLOBAL MERCHANT-SAYS:TABLE
<PLTABLE
"\"These carpets are the epitome of the weaver's art, woven
by skilled native craftsmen with pride in their work. The Flatheads themselves
have carpets like these. Their worth is nearly incalculable, but because
today is my aged mother's birthday, we are offering them at an absurdly low
price. A mere eight hundred zorkmids each!\""
"\"You obviously didn't hear me. I didn't say we were giving them away.
But my father is also hard of hearing and
thus I have a warm spot in my heart for those similarly afflicted, so I will
accept a pittance, as charity: seven hundred zorkmids.\""
"\"My word! Let me see your teeth... No, not shark's teeth after all. Perhaps
your rapaciousness has led you astray. Down the block you may find old rags
and such to make a fine floor covering for your hovel. Here you must pay what
the product is worth. Six hundred, or I send you down the street.\""
"\"This grows tedious. Because I am a busy man and my lunch is growing cold,
I will sell you a rug below my own cost. These rugs are imported at great
expense over burning deserts, steep mountains and bandit-infested plains.
My own cousin, who was watching out for the family interests in the caravan,
was lost bringing this very shipment here. The caravan master, in his
absence, no doubt robbed us blind, as you propose to do. Done at five hundred,
then!\" He reaches toward you expectantly.">>
<ROOM BAZAAR
(IN ROOMS)
(DESC "Bazaar")
(EAST PER EMPORIUM-EXIT)
(IN PER EMPORIUM-EXIT)
(FLAGS RLANDBIT OUTSIDE ONBIT)
(ACTION BAZAAR-F)
(GLOBAL EMPORIUM-DOOR)
(THINGS
<PSEUDO ;(RAGGED URCHIN URCHIN-PSEUDO)
(<> SIGN SIGN-PSEUDO)
(<> SHOP SHOP-PSEUDO)
(<> EMPORIUM SHOP-PSEUDO)>)>
<ROUTINE SHOP-PSEUDO ()
<COND (<VERB? THROUGH>
<DO-WALK ,P?EAST>)>>
;<ROUTINE URCHIN-PSEUDO ()
<COND (<OR <VERB? EXAMINE FOLLOW GIVE FIND>
<HOSTILE-VERB?>>
<TELL "What urchin? You don't see an urchin." CR>)>>
<ROUTINE BAZAAR-F (RARG)
<COND (<EQUAL? .RARG ,M-LOOK>
<TELL
"This is a crowded, noisy bazaar. Directly in front of you to the east
is a shop. Above its door is a sign in an unknown tongue. " ,YOU-CANT "read
it, but it is illustrated with a picture of a very ornate rug. ">
<COND (<FSET? ,EMPORIUM-DOOR ,LOCKED>
<THIS-IS-IT ,EMPORIUM-DOOR>
<TELL ,DOOR-LOCKED ,PERIOD>)
(<NOT <FSET? ,EMPORIUM-DOOR ,OPENBIT>>
<TELL-OPEN-CLOSED ,EMPORIUM-DOOR>)
(ELSE
<TELL "The door beckons invitingly." CR>)>)
;(<EQUAL? .RARG ,M-ENTER>
<QUEUE I-URCHIN 2>)>>
<OBJECT RANDOM-CARPET
(DESC "scruffy red carpet")
(SYNONYM CARPET RUG)
(ADJECTIVE SHABBY SCRUFFY RED UGLY)
(FLAGS TAKEBIT VEHBIT CONTBIT OPENBIT SURFACEBIT SEARCHBIT)
(CAPACITY 200)
(GENERIC GENERIC-CARPET-F)
(ACTION RANDOM-CARPET-F)>
<ROUTINE TAKE-ON-CARPET (CARP)
<COND (<EQUAL? ,PRSO ,MAGIC-CARPET>
<GET-OFF-FIRST>)
(<NOT-IN-VEHICLE?>
<CANT-REACH-THAT>)>>
<ROUTINE NOT-SITTING ()
<COND (,SITTING?
<MOVE ,PLAYER ,HERE>
<SETG SITTING? <>>
<TELL
" You are no longer sitting on the carpet.">)>>
<ROUTINE NOW-SITTING ()
<COND (<AND ,SITTING? <IN? ,PLAYER ,PRSO>>
<TELL ,YOU-ARE ,PERIOD>
<RFALSE>)
(ELSE
<SETG SITTING? T>
<TELL "You ">
<COND (<IN? ,PLAYER ,PRSO>
<TELL "sit down">)
(ELSE
<MOVE ,PLAYER ,PRSO>
<TELL "are now sitting">)>
<TELL " on " THE ,PRSO ". ">)>>
<ROUTINE RANDOM-CARPET-F ("OPTIONAL" (RARG <>))
<COND (<EQUAL? .RARG ,M-BEG>
<COND (<OR <VERB? FLY>
<AND <VERB? WALK>
<OR <EQUAL? ,P-WALK-DIR ,P?UP>
<G? ,UD-COUNT 0>>>>
<TELL ,NOTHING-HAPPENS>)
(<VERB? WALK>
<GET-OFF-FIRST>)
(<VERB? TAKE MOVE>
<TAKE-ON-CARPET ,RANDOM-CARPET>)
(<AND <VERB? DISEMBARK>
<EQUAL? ,PRSO ,RANDOM-CARPET>>
<STEP-OFF-CARPET>
<CRLF>)>)
(<NOT .RARG>
<COND (<VERB? EXAMINE>
<TELL
"This is a cheaply made and ugly carpet. It is a garish red and looks ready
to fall apart.">
<CLEVER-CONTENTS ,RANDOM-CARPET
" On the carpet">
<CRLF>)
(<VERB? CASKLY>
<TELL
"It's perfectly awful already." CR>)
(<AND <VERB? OFFER>
<EQUAL? ,PRSI ,RANDOM-CARPET>
<IN? ,MERCHANT ,HERE>>
<SETG ASKED-FOR ,PRSI>
<PERFORM ,V?GIVE ,PRSO ,MERCHANT>
<RTRUE>)
(<VERB? TAKE>
<TAKE-CARPET>)
(<VERB? BOARD CLIMB-ON STAND-ON>
<BOARD-CARPET>)
(<AND <VERB? SIT>
<NOT <IN? ,WINNER ,RANDOM-CARPET>>>
<COND (<CANT-GET-ON?>
<RTRUE>)
(ELSE
<COND (<NOW-SITTING>
<TELL
"Some of the nap comes off on you." CR>)>
<RTRUE>)>)
(<AND <VERB? CUT>
<EQUAL? ,PRSI ,SHEARS ,KNIFE>>
<CARPET-CRUMBLES>)>)>>
<GLOBAL SITTING?:FLAG <>>
<ROUTINE IMPOSSIBLE-MANEUVER ()
<TELL
"An impossible maneuver under the circumstances." CR>>
<ROUTINE CANT-GET-ON? ()
<COND (<FSET? ,HERE ,RAIRBIT>
<TELL
"A good thought, but a little too late to save you, I'm afraid." CR>)
(<FSET? ,HERE ,RWATERBIT>
<IMPOSSIBLE-MANEUVER>)
(<HELD? ,PRSO>
<TELL
,YOU-HAVE-TO " put it down first." CR>)>>
<ROUTINE BOARD-CARPET ()
<COND (<IN? ,PLAYER ,PRSO>
<TELL ,YOU-ARE ,PERIOD>)
(<CANT-GET-ON?> <RTRUE>)
(ELSE
<MOVE ,PLAYER ,PRSO>
<SETG SITTING? <>>
<TELL
,YOU-ARE-NOW "standing on the carpet. Nothing expected is happening." CR>)>>
<ROUTINE STEP-OFF-CARPET ()
<SETG SITTING? <>>
<MOVE ,PLAYER <LOC ,PRSO>>
<TELL "You step off the carpet.">>
<OBJECT MAGIC-CARPET
(DESC "beautiful blue carpet")
(SYNONYM CARPET RUG)
(ADJECTIVE MAGIC BEAUTIFUL BLUE STRANGE DESIGN)
(FLAGS TAKEBIT VEHBIT MAGICBIT CONTBIT OPENBIT SURFACEBIT SEARCHBIT)
(CAPACITY 200)
(GENERIC GENERIC-CARPET-F)
(ACTION MAGIC-CARPET-F)>
<ROUTINE MAGIC-CARPET-F ("OPTIONAL" (RARG <>))
<COND (<EQUAL? .RARG ,M-BEG>
<COND (<VERB? TAKE MOVE>
<TAKE-ON-CARPET ,MAGIC-CARPET>)
(<AND <VERB? DROP> <G? ,UD-COUNT 0>>
<DROP-IN-AIR>)
(<OR <VERB? FLY>
<AND <VERB? WALK>
<OR <EQUAL? ,P-WALK-DIR ,P?UP>
<G? ,UD-COUNT 0>>>>
<COND (<AND <VERB? FLY>
<NOT ,PRSO>>
<SETG P-WALK-DIR ,P?UP>)>
<COND (<OR <NOT <IN? ,CARPET-LABEL ,MAGIC-CARPET>>
<FSET? ,CARPET-LABEL ,RMUNGBIT>>
<TELL ,NOTHING-HAPPENS>)
(<NOT ,SITTING?>
<TELL ,RIPPLES ,PERIOD>)
(<EQUAL? ,HERE ,MIDAIR>
<COND (<EQUAL? ,P-WALK-DIR ,P?NORTH>
<SETG NS-COUNT <+ ,NS-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?SOUTH>
<SETG NS-COUNT <- ,NS-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?EAST>
<SETG EW-COUNT <+ ,EW-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?WEST>
<SETG EW-COUNT <- ,EW-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?UP>
<SETG UD-COUNT <+ ,UD-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?DOWN>
<SETG UD-COUNT <- ,UD-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?NE>
<SETG NS-COUNT <+ ,NS-COUNT 1>>
<SETG EW-COUNT <+ ,EW-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?NW>
<SETG NS-COUNT <+ ,NS-COUNT 1>>
<SETG EW-COUNT <- ,EW-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?SE>
<SETG NS-COUNT <- ,NS-COUNT 1>>
<SETG EW-COUNT <+ ,EW-COUNT 1>>)
(<EQUAL? ,P-WALK-DIR ,P?SW>
<SETG NS-COUNT <- ,NS-COUNT 1>>
<SETG EW-COUNT <- ,EW-COUNT 1>>)
(ELSE
<TELL
"The carpet doesn't move." CR>
<RTRUE>)>
<COND (<EQUAL? ,UD-COUNT 0>
<COND (<AND <EQUAL? ,NS-COUNT 0>
<EQUAL? ,EW-COUNT 0>>
<GOTO ,ROC-NEST>)
(<AND <EQUAL? ,NS-COUNT 0>
<EQUAL? ,EW-COUNT 4>
,SEEN-TOWER?>
<GOTO ,GUARD-TOWER>)
(ELSE
<GOTO ,LOST-ON-LAND>)>
<RTRUE>)
(ELSE
<DESCRIBE-CARPET-LOC>)>)
(<EQUAL? ,HERE ,LOST-IN-CLOUDS>
<SETG SMASH-PROB <+ ,SMASH-PROB 5>>
<COND (<PROB ,SMASH-PROB>
<FCLEAR ,MIDAIR ,TOUCHBIT>
<GOTO ,MIDAIR>)
(ELSE
<TELL
"You are still lost in thick, fluffy clouds. It is impossible to tell
directions in here." CR>)>)
(<EQUAL? ,P-WALK-DIR ,P?UP>
<COND (<EQUAL? ,HERE ,GUARD-TOWER ,ROC-NEST>
<TELL
"The carpet takes to the air, rising swiftly.">
<COND (<AND <IN? ,ROC ,HERE>
<EQUAL? ,HERE ,GUARD-TOWER>>
<REMOVE ,ROC>
<TELL
" The huge bird stops, almost stalls, and flees goggle-eyed with
surprise.">)>
<CRLF>
<CRLF>
<FCLEAR ,MIDAIR ,TOUCHBIT>
<GOTO ,MIDAIR>)
(<EQUAL? ,HERE ,VOLCANO-ROOM ,VOLCANO-BASE
,OUTCROPPING-ROOM>
<TELL
"You begin to rise, but you notice that the ">
<COND (<EQUAL? ,MAGIC-CARPET ,ICED-OBJECT>
<SETG ICED-OBJECT <>>
<TELL
"carpet is steaming as the ice melts. You prudently return to earth." CR>
<RTRUE>)
(ELSE
<REMOVE ,CARPET-LABEL>
<JIGS-UP
"fringe of the carpet is starting
to singe and turn brown from the heat. Just as you are about to turn back,
the label catches fire and burns to a crisp. You plummet into the lava and
are seen no more.">)>)
(<FSET? ,HERE ,OUTSIDE>
<FCLEAR ,LOST-IN-CLOUDS ,TOUCHBIT>
<GOTO ,LOST-IN-CLOUDS>)
(ELSE
<TELL
"It ripples a little." CR>)>)
(ELSE
<TELL ,RIPPLES ,PERIOD>)>)
(<VERB? WALK>
<GET-OFF-FIRST>)
(<AND <VERB? DISEMBARK>
<EQUAL? ,PRSO ,MAGIC-CARPET>>
<STEP-OFF-CARPET>
<COND (<FSET? ,HERE ,RAIRBIT>
<START-FALLING>
<TELL
" As you are in midair, you begin to fall. The
carpet loses its impetus the moment you cease to touch it and accordians
like a rug that's been slipped on. It too begins to fall.">)>
<CRLF>)
(<AND <VERB? LEAP> <G? ,UD-COUNT 0>>
<TELL
"This is not the most prudent method of disembarking." CR>)>)
(<NOT .RARG>
<COND (<VERB? EXAMINE>
<TELL
"This is a carpet of unusual design. It is blue, beautifully woven and has
a pattern that looks different each time you look at it.
Sometimes, for example, it's an array of cubes pointing upward, and other
times it's the same array pointing downward. There is a jaunty fringe
around the outer edge.">
<CLEVER-CONTENTS ,MAGIC-CARPET
" On the carpet"
,CARPET-LABEL>
<CRLF>)
(<AND <VERB? OFFER>
<EQUAL? ,PRSI ,MAGIC-CARPET>
<IN? ,MERCHANT ,HERE>>
<SETG ASKED-FOR ,PRSI>
<PERFORM ,V?GIVE ,PRSO ,MERCHANT>
<RTRUE>)
(<VERB? TAKE>
<TAKE-CARPET>)
(<AND <VERB? CUT>
<EQUAL? ,PRSI ,SHEARS ,KNIFE>>
<START-FALLING>
<CARPET-CRUMBLES>)
(<VERB? LOOK-INSIDE>
<COND (<CLEVER-CONTENTS ,PRSO
"On the carpet"
,CARPET-LABEL>
<CRLF>)
(ELSE <ITS-EMPTY>)>)
(<VERB? LOOK-UNDER TURN-OVER MOVE>
<TELL "You turn the carpet over and discover ">
<COND (<AND <IN? ,PLAYER ,MAGIC-CARPET>
<EQUAL? ,HERE ,MIDAIR ,LOST-IN-CLOUDS>>
<JIGS-UP
"that you have sent the carpet into a fatal stall!">
<RFATAL>)
(<AND <IN? ,CARPET-LABEL ,MAGIC-CARPET>
<NOT <FSET? ,CARPET-LABEL ,RMUNGBIT>>>
<FCLEAR ,CARPET-LABEL ,INVISIBLE>
<TELL "a label">)
(ELSE
<TELL "nothing">)>
<TELL ,PERIOD>)
(<VERB? BOARD CLIMB-ON STAND-ON>
<BOARD-CARPET>)
(<VERB? SIT>
<COND (<CANT-GET-ON?> <RTRUE>)
(<NOW-SITTING>
<COND (<AND <IN? ,CARPET-LABEL
,MAGIC-CARPET>
<NOT <FSET? ,CARPET-LABEL
,RMUNGBIT>>>
<TELL
"At first nothing happens. Then the
fringe of the carpet starts to ruffle expectantly." CR>)
(ELSE
<TELL
"Nothing interesting happens, although the carpet is comfortable." CR>)>)>
<RTRUE>)>)
(<EQUAL? .RARG ,M-ENTER>
<SETG SMASH-PROB 0>)>>
<ROUTINE TAKE-CARPET ("AUX" (IGNORE? <>))
<COND (<EQUAL? <ITAKE> T>
<TELL "Taken">
<SET IGNORE?
<COND (<NOT <FSET? ,CARPET-LABEL ,RMUNGBIT>>
,CARPET-LABEL)>>
<COND (<ROB ,PRSO ,HERE .IGNORE?>
<TELL ", but something fell off">)>
<TELL ,PERIOD>)>
<RTRUE>>
<GLOBAL RIPPLES:STRING "The carpet ripples excitedly">
<ROUTINE GET-OFF-FIRST ()
<TELL
,YOU-HAVE-TO " get off the carpet first." CR>>
<ROUTINE CARPET-CRUMBLES ()
<COND (<IN? ,PLAYER ,PRSO>
<MOVE ,PLAYER ,HERE>)>
<REMOVE ,PRSO>
<TELL
"As the first thread is cut, the " 'PRSO " crumbles to dust." CR>>
<ROUTINE DESCRIBE-CARPET-LOC ()
<TELL "You are ">
<COND (<IN? ,PLAYER ,MAGIC-CARPET> <TELL "flying ">)>
<COND (<G? ,UD-COUNT 3>
<TELL "dizzyingly high ">)
(<G? ,UD-COUNT 2>
<TELL "very high ">)
(<G? ,UD-COUNT 1>
<TELL "high ">)>
<TELL "above ">
<COND (<AND <EQUAL? ,NS-COUNT 0>
<EQUAL? ,EW-COUNT 0>>
<TELL "a giant bird's nest">)
(<AND <EQUAL? ,NS-COUNT 0>
<EQUAL? ,EW-COUNT 4>
,SEEN-TOWER?>
<TELL "an abandoned guard tower">)
(<EQUAL? ,EW-COUNT 0>
<TELL "jagged mountains">)
(ELSE
<TELL "a trackless wilderness to the ">
<COND (<G? ,EW-COUNT 0>
<TELL "east">)
(ELSE
<TELL "west">)>
<TELL " of a range of jagged mountains">)>
<TELL ,PERIOD>>
<OBJECT CARPET-LABEL
(IN MAGIC-CARPET)
(DESC "label")
(SYNONYM LABEL)
(FLAGS INVISIBLE TAKEBIT READBIT)
(ACTION CARPET-LABEL-F)>
<ROUTINE CARPET-LABEL-F ()
<COND (<VERB? READ EXAMINE>
<TELL
"The label reads:|
|
\"Frobozz Magic Magic Carpet Co.|
|
This carpet is made of all-unnatural fibers.
Occupancy by more than one person is prohibited. Keep to posted speeds.
Do not remove this label under penalty of law.|
|
Abdul el-Flathead|
|
(Printed by the Frobozz Magic Label Co.)\"" CR>)
(<AND <VERB? CASKLY>
<NOT <IN? ,CARPET-LABEL ,MAGIC-CARPET>>>
<TELL ,NOTHING-HAPPENS>)
(<OR <VERB? TAKE MUNG>
<AND <VERB? CUT>
,PRSI
<FSET? ,PRSI ,WEAPONBIT>>>
<FSET ,PRSO ,RMUNGBIT>
<COND (<AND <IN? ,PLAYER ,MAGIC-CARPET>
<FSET? ,HERE ,RAIRBIT>>
<START-FALLING>
<MOVE ,PLAYER ,HERE>
<TELL
"As soon as the label is removed, the carpet hits an air pocket and rolls
up. There is no room for you on a rolled-up carpet. You begin to fall."
CR>)>)>>
<ROUTINE START-FALLING ()
<SETG FALLING? T>
<SETG SMASH-PROB 0>
<QUEUE I-FALLING -1>>
<ROOM MIDAIR
(IN ROOMS)
(DESC "Midair")
(ACTION MIDAIR-F)
(FLAGS RAIRBIT OUTSIDE ONBIT)
(THINGS
<PSEUDO (FLATHEAD MOUNTAIN MOUNTAIN-PSEUDO)
(TRACKLESS WILDERNESS RANDOM-PSEUDO)
(<> CLOUDS CLOUD-PSEUDO)
(GUARD TOWER RANDOM-PSEUDO)
(ROC NEST NEST-PSEUDO)>)>
<ROUTINE MIDAIR-F (RARG)
<COND (<EQUAL? .RARG ,M-LOOK>
<TELL "You are in midair.">
<COND (<IN? ,PLAYER ,ROC>
<TELL
" Fortunately a very large bird is carrying you, otherwise you would fall.">)
(<IN? ,PLAYER ,MAGIC-CARPET>
<TELL
" Fortunately you are sitting on a magic carpet and thus are fairly safe.">)
(,FALLING?
<TELL " You are falling.">)>
<COND (<EQUAL? ,HERE ,MIDAIR>
<TELL " ">
<DESCRIBE-CARPET-LOC>)
(ELSE <CRLF>)>
<RTRUE>)
(<EQUAL? .RARG ,M-ENTER>
<COND (<NOT <IN? ,PLAYER ,MAGIC-CARPET>>
<SETG ROC-PROB
<COND (<FSET? ,HERE ,TOUCHBIT> 0)
(ELSE 25)>>
<QUEUE I-ROC -1>)>
<SETG EW-COUNT
<COND (<EQUAL? ,OHERE ,LOST-IN-CLOUDS>
<- <RANDOM 5> 1>)
(<EQUAL? ,OHERE ,GUARD-TOWER
,AIR-ROOM ,EARTH-ROOM>
4)
(ELSE
0)>>
<SETG NS-COUNT
<COND (<EQUAL? ,OHERE ,LOST-IN-CLOUDS>
<- <RANDOM 5> 3>)
(ELSE
0)>>
<SETG UD-COUNT
<COND (<EQUAL? ,OHERE ,LOST-IN-CLOUDS>
<RANDOM 4>)
(<EQUAL? ,OHERE ,AIR-ROOM ,EARTH-ROOM>
4)
(ELSE
1)>>
<RFALSE>)
(<EQUAL? .RARG ,M-LEAVE>
<COND (<IN? ,MAGIC-CARPET ,HERE>
<MOVE ,MAGIC-CARPET ,LOST-ON-LAND>)>)
(<EQUAL? .RARG ,M-BEG>
<COND (<AND <VERB? WALK> ,FALLING?>
<COND (<EQUAL? ,P-WALK-DIR ,P?DOWN>
<TELL "You have little choice." CR>)
(ELSE