-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpermagic.inf
More file actions
1182 lines (1039 loc) · 41.3 KB
/
permagic.inf
File metadata and controls
1182 lines (1039 loc) · 41.3 KB
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
!===============================================================================!
! Perilous Magic - The Source Code! !
! Copyright 1999-2019 by David Fillmore. !
! This work is licensed under the Creative Commons Attribution-NonCommercial !
! 4.0 International License. !
! To view a copy of this license, visit !
! http://creativecommons.org/licenses/by-nc/4.0/ !
! or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain !
! View, California, 94041, USA. !
!===============================================================================!
Constant Story "Perilous Magic";
Constant Headline "^A Really Short Interactive Comic Tragedy.
^Copyright David Fillmore 1999^";
Release 11;
Constant Max_score 3;
Constant Number_Tasks 3;
Constant Tasks_Provided;
Constant Amusing_Provided;
Attribute ungnustoable; ! Means that the spell isn't gnustoable. There aren't any
! spell book in the game, but it prints up a line about
! the spell being long.
Attribute weapon; ! Can be used to attack things (mainly Gunther) with.
Attribute questionable; ! You can ask a question about this object. For instance:
! WHAT IS A GRUE or WHO IS GUNTHER.
Array task_scores -> 1 1 1;
Global the_spell_was = gnusto_spell;
Replace StrongSub;
Replace NotifyTheScore;
Include "Parser";
[ NotifyTheScore i;
style bold;
print "^[Your score has just gone ";
if (last_score > score)
{ i=last_score-score;
@sound_effect 2; ! Makes the game go boop when you lose a point. You can't
! lose points, but who cares?
print "down";
}
else
{ i=score-last_score;
@sound_effect 1; ! Makes the game go beep when you gain a point.
print "up";
}
print " by "; EnglishNumber(i); print " point";
if (i>1) print "s"; print ".]^";
style roman;
];
! This is what happens when you swear. Most of you won't have found this, because
! of course no one ever swears at a computer game. I put this in when I realised
! that the game had been printing "Real adventures do not used such language.",
! and your character isn't an adventurer. I decided to use the text from all
! the other Zork games I knew of, editing them so they made sense. Sort of.
! I was going to use the replies from Dungeon as well, but that required me to
! swear back at the player, something I'm not prepared to do unless they send me
! a really nasty e-mail.
[ StrongSub;
switch(random(18))
{ 1: "Moral turpitude is grounds for removal from your job!"; ! Spellbreaker.
2: print "You suddenly feel less intelligent.^"; ! Beyond Zork. This is my favourite response.
style bold;
print " [Your intelligence has not been affected.]^";
style roman;
rtrue;
3: "Such language from a civil servant!"; ! Enchanter and Sorcerer.
4: "[What charming language.]"; ! Wishbringer.
5: "[Computers aren't impressed by naughty words.]"; ! Wishbringer.
6: "[Grow up.]"; ! Wishbringer
7: "[Computers aren't impressed by naughty words!]"; ! Zork Zero.
8: "[What charming language!]"; ! Zork Zero.
9: "[You ought to be ashamed of yourself!]"; ! Zork Zero.
10: "[Hey, save that talk for the locker room!]"; ! Zork Zero.
11: "[Step outside and say that!]"; ! Zork Zero.
12: "[And so's your old man!]"; ! Zork Zero.
13: "Such language in a high-class establishment like this!"; ! The Zork Trilogy.
14: "Real civil servants do not use such language."; ! Balances and Zork: The Undiscovered Underground.
15: "This is a family game. Play Nice."; ! Enlightenment.
16: "Such language from a civil servant such as yourself! The ground rumbles suddenly!"; ! SpiritWrak.
17: "You swear sulphurously to yourself."; ! Zork: A Troll's Eye View.
18: "Such language betrays your low intelligence."; ! Beyond Zork.
}
];
! I had to copy out all this, just to change one message.
Object LibraryMessages
with before
[ n; n = lm_n;
Miscellany: if (n==1) "(considering the first sixteen objects only)^";
if (n==2) "Nothing to do!";
if (n==3) { print " You have died "; rtrue; }
!And here is that message.
if (n==4) { print " You have caused a major historical incident "; rtrue; }
if (n==5)
{ print "^Would you like to RESTART, RESTORE a saved game";
if (TASKS_PROVIDED==0)
print ", give the FULL score for that game";
if (deadflag==2 && AMUSING_PROVIDED==0)
{ print ", see some suggestions for AMUSING things to do";
box "See how much wood or"
"how great a forest"
"a tiny spark can set ablaze"
""
"The Letter of James, III. v";
}
" or QUIT?"; }
if (n==6) "[Your interpreter does not provide ~undo~. Sorry!]";
if (n==7) "~Undo~ failed. [Not all interpreters provide it.]";
if (n==8) "Please give one of the answers above.";
if (n==9) "^It is now pitch dark in here!";
if (n==10) "Excuse me?";
if (n==11) "[You can't ~undo~ what hasn't been done!]";
if (n==12) "[Can't ~undo~ twice in succession. Sorry!]";
if (n==13) "[Previous turn undone.]";
if (n==14) "Sorry, that can't be corrected.";
if (n==15) "Think nothing of it.";
if (n==16) "~Oops~ can only correct a single word.";
];
Replace QuitSub;
Replace RestartSub;
Include "VerbLib";
Object questions "qs";
[ QuerySub; PrintOrRun(noun, description);
];
[ Topic i;
switch(scope_stage)
{ 1: rfalse;
2: objectloop (i has questionable) PlaceInScope(i); rtrue;
3: "At the moment, even the simplest questions confuse you.";
}
];
Verb "what" "who"
* "is" scope=Topic -> Query
* "was" scope=Topic -> Query;
! I doubt anyone got this to print up. Who's going to type "WHAT IS A G***"?
[ Gruebox;
box "~It's t*** that you'll *** meeting a g***"
" Your death will be g***some, g***lling and grim."
" So when off to fight, take plenty of light"
" And make sure its pickings are slim.~"
""
"This was an unpaid advertisement for ~Enlightenment~"
"Thank you for your patience.";
];
[ QuitSub;
@sound_effect 2; ! boop.
L__M(##Score);
PrintRank();
L__M(##Quit,2); if (YesOrNo()~=0) quit;
];
!-------------------------------------------------------------
[ RestartSub;
#ifdef TARGET_ZCODE;
@sound_effect 2; !bing.
#endif;
L__M(##Score);
PrintRank();
L__M(##Restart,1);
if (YesOrNo()~=0)
{ @restart;
L__M(##Restart,2);
}
];
[ TitlePage i;
@erase_window -1;
print "^^^^^^^^^^^^^";
i = 0->33;
if (i==0) i=80;
i=(i-50)/2;
style bold;
font off;
spaces(i);
print " PERILOUS MAGIC^";
style roman;
print "^^";
spaces(i);
print " [Please press SPACE to begin.]^";
font on;
box "A rose-red city--'half as old as Time'!"
""
"-- Rev. John William Burgon, ~Petra~ 1. 132";
do { @read_char 1 0 0 i; } until (i==32 or 10 or 13);
@erase_window -1;
];
[ Initialise s;
SetTime( 60 * 17 + 00, 1);
location = your_cubicle;
move pen to player;
StartDaemon(pen);
objectloop(s ofclass scroll)
{ s.spell_name = child(s);
startdaemon(s);
}
TitlePage();
move new_scroll to gundesk;
"^^^^^It's 5:00 now, and you have to get your work done by 5:30. Luckily, you
only have one more job: write out a report in triplicate. You've just
finished one, but now you've run out of paper!^";
];
[ GiveHint hint keypress;
print (string) hint; new_line; new_line;
#ifdef TARGET_ZCODE;
@read_char 1 0 0 keypress;
if (keypress == 'H' or 'h') rfalse;
#ifnot;
if (KeyCharPrimitive() == 104 or 72) rfalse;
#endif;
rtrue;
];
!-----------------------------------------------
[ PrintRank;
print ", earning you the rank of ";
switch(score)
{ 0 to 2: "civil servant.";
3: "Pyromaniac Extraordinaire.";
}
];
[ DeathMessage;
if (deadflag == 3)
print "You are fired";
if (deadflag == 4)
print "You are burned to a crisp";
if (deadflag == 5)
print "You are buried alive";
if (deadflag == 6)
print "You are fired ***^ *** You are fired ***^ *** You are fired";
rtrue;
];
[ WriteReportSub;
if (pen notin player)
"You don't have a pen!";
if (paper notin location)
"You don't have anything to write it on!";
];
[ WriteReportOnSub;
if (noun ofclass scroll)
"No, you'd need a clean sheet of paper.";
if (noun == junk)
"No, you'd need a clean sheet of paper.";
"You can't write a report on that!";
];
[ WriteOnSub;
if (noun == gunther)
"I don't think he'd appreciate that.";
if (noun == player)
"That would hurt.";
"Vandalism of company property could get you fired.";
];
[ ReadSub;
<<Examine noun>>;
];
[ XyzzySub;
"A hollow voice says 'Cretin'.^
(Probably your boss)";
];
[ CreditsSub;
@erase_window -1;
print "^^^";
Banner();
style bold;
print "^Beta-Testers^";
style roman;
print "Chad Schultz^
Jonadab the Unsightly One^
Kelly M.^
Mark Silcox^^";
style roman;
print "Other people who spotted bugs or gave suggestions^";
style roman;
print "Randy Cox^";
print "ct^";
print "Francesco Bova^";
print "Martin Braun^";
style bold;
print "^Important! Read this!^";
style roman;
"I put far more work into this game that is reasonable considering the size, mainly editing the code for the spell scrolls. I don't think I ever understood how I made them work.
If you have any comments or questions, you can contact me at marvin@@64frobnitz.co.uk, and I might even notice eventually.";
];
Verb "xyzzy" * -> Xyzzy;
Verb "plugh" * -> Xyzzy;
Verb "credits" * -> Credits;
Statusline time;
[ PrintTaskName ach;
switch(ach)
{ 0: "finding the old scroll";
1: "getting the new scroll past Gunther";
2: "triplicating the report";
}
];
Object pen "pen"
with name "pen",
t 0,
description "A simple blue ball-point pen.",
before
[; Read: "Inscribed on one side of the pen, in very small letters,
is the following: ~FMPC: Hello, Writer!~^
On the other side is written ~JTUO: Better?~";
],
daemon
[; self.t++;
if (self.t == 30)
{ deadflag = 3;
"You fail to triplicate the report on time.";
}
],
has weapon;
Object your_cubicle "Your Cubicle"
with description "Vast piles of junk fill every corner of this cramped
cubicle, but you're only interested in one thing:
the report.^^
Somewhere to the east, behind a particularly immense
pile of old papers, is the exit.",
out_to hallway,
e_to hallway,
has light;
Object -> desk "desk"
with name "desk",
before
[; Search: <<Search junk>>;
],
description "Actually, you can barely see the desk under all the
junk, but you're pretty certain it's there. It was
oak, if you remember correctly.",
has supporter scenery;
Object -> -> report "report"
with name "report",
description "It's the report your supposed to finish by 5:30.",
before
[; Take: "You should leave it here. If you take it somewhere, you'll only
lose it.";
],
has scenery;
Object -> -> junk "junk"
with name "junk" "clutter" "paper" "papers" "rubbish" "pile" "of",
description "It's a load of junk. There might be something interesting in there though.",
x,
lamp,
sword,
civilpaper,
before
[ i ; Search: if (self.x==0)
{ move old_scroll to player;
PronounNotice(old_scroll);
achieved(0);
self.x++;
"Sifting the the piles of junk, you come across an old scroll you
were supposed to do something with weeks ago. You take it.";
}
else
{ if (random(10) > 3) "You don't find anything interesting.";
switch(random(3))
{ 1: if (self.lamp==0)
{ self.lamp++;
move brasslamp to player;
PronounNotice(brasslamp);
"Sifting through the piles of junk, you come across an
old brass lantern. Now how did that get in there?";
}
else
"You don't find anything interesting.";
2: if (self.sword==0)
{ self.sword++;
move elvishsword to player;
PronounNotice(elvishsword);
"Sifting through the piles of junk, you come across a
sword of Elvish workmanship. Who put that there?";
}
else
"You don't find anything interesting.";
3: if (self.civilpaper==0)
{ self.civilpaper++;
move newspaper to player;
PronounNotice(newspaper);
print "Sifting through the piles of junk, you come across a copy
of the U.S. News and Dungeon Report dated ";
! This prints the date of compilation
for (i=22:i<24:i++) print (char) 0->i;
print "/";
for (i=20:i<22:i++) print (char) 0->i;
print "/";
for (i=18:i<20:i++) print (char) 0->i;
new_line;
rtrue;
}
else
"You don't find anything interesting";
}
}
],
has scenery;
Object paper "pile of paper";
Object elvishsword "sword"
with name "sword" "elvish",
has weapon;
Object brasslamp "lamp"
with name "lamp" "lantern" "brass",
before
[; SwitchOn: "It appears to have run out.";
],
has switchable ~on;
Object newspaper "newspaper"
with name "paper" "newspaper",
description [ i; style bold;
print " U.S. News and Dungeon Report^ ";
style roman;
for (i=22:i<24:i++) print (char) 0->i;
print "/";
for (i=20:i<22:i++) print (char) 0->i;
print "/";
for (i=18:i<20:i++) print (char) 0->i;
print "^^Edited some text a bit. No big changes.^";
new_line;
rtrue;
];
Object hallway "Hallway"
with description "You're in a long hallway lined with cubicles just like yours.
Your cubicle is to the west, and to the east is Gunther's
one.",
w_to your_cubicle,
e_to gun_cubicle,
n_to "You've got to finish triplicating that report before you go home!",
s_to "You've got to finish triplicating that report before you go home!",
has light;
Object gunther "Gunther"
with name "gunther" "gunther?" "foobar", ! Look! Gunther has a last name! Gunther Foobar.
initial "Gunther is here, looking through his reports to see if you stole anything.",
parse_name [; return 0; ],
description "Gunther is smart, efficent, and comletely humourless. He's
had a grudge against you ever since you accidently knocked
a ~fooble~ potion into his coffee.",
react_before [; Give: if (noun notin player)
"You can't see any such thing.";
if (noun ofclass scroll)
{ gun_cubicle.done = 3;
move noun to gundesk;
if (noun == old_scroll && new_scroll in player) achieved(1);
PlayerTo(hallway, 1);
give gunther general;
"He snatches it out of your hand and pushes you into the hallway.";
}
else
"~I don't want that.~";
Take: if (noun ofclass scroll && gunther has general)
{ PlayerTo(hallway, 1);
move noun to gundesk;
gun_cubicle.done = 3;
"Gunther sees you trying to steal his scroll again, and pushes
you back into the hallway.";
}
],
life
[; Attack: "No, that would be immature and boring.^
(If you had a weapon, it would just be immature, which is fine.)";
Kiss: "Gunther isn't your type.";
ThrowAt: if (noun == elvishsword) "You can get in trouble for that kind of thing.";
if (noun == brasslamp)
{ print "You throw the lamp at Gunther, and it bounces off his head with a satifying
clang. You run out of his cubicle";
move brasslamp to location;
if (new_scroll in player)
{ move new_scroll to location;
print ", dropping the scroll in your hurry.^";
}
else print ".^";
give gunther general;
PlayerTo(hallway);
rtrue;
}
if (noun == pen) "You could put an eye out doing that!";
Show: if (noun ofclass scroll)
"Gunther glares at you. ~Give it back!~";
<<Give gunther noun>>;
Ask: print "Gunther glares at you. ";
switch(second)
{ 'new', 'scroll':
"~I'm going to need that tommorow, I've got lots of work to do!~";
'pile', 'of', 'reports':
"~Leave them alone!~";
}
"How should I know? Go away!";
],
has animate proper questionable;
Object gun_cubicle "Gunther's Cubicle"
with description [ ; print "This is Gunther's cubicle. Unlike yours, it's neat, clean and
everything is in place.";
],
done 0,
out_to [; <<Go W_obj>>;],
w_to [; if (self.done == 0 && new_scroll in player)
{ self.done = 1;
move gunther to self;
PronounNotice(gunther);
"Gunther walks in and notices you holding his scroll. He demands it back.";
}
if (self.done == 1)
"Gunther blocks your way.";
if (new_scroll notin player || self.done == 3)
return hallway;
],
has light;
Object -> gundesk "desk"
with name "desk",
description "It's just a desk. There's not much interesting about it.",
has supporter scenery;
Object -> -> reports "pile of reports"
with name "reports" "pile" "of",
before
[; Take: "I think Gunther would notice.";
],
description "You spent all day looking through reports, you don't
want to read Gunther's too!";
! ----------------------------------------------------------------------------
! Now the whole spell-casting system
! ----------------------------------------------------------------------------
! The spellcasting system is a modified version of the one from Balances.
! I had to change it to enable the player to cast spells directly from
! spell scrolls.
Attribute known_about; ! Player has seen this spell somewhere
Attribute is_spell;
Class Spell
with name "spell" "spells", article "the",
number 0,
word_name
[; print (address) (self.&name)-->0;
],
short_name
[; self.word_name(); print " spell"; give self known_about; rtrue;
],
specification
[; self.short_name();
print ": ", (string) self.purpose;
],
before
[; Examine: self.specification(); ".";
],
has is_spell;
Object memory
with capacity 5,
number_known 1,
describe_contents
[ i j k;
objectloop (i in self) if (i.number==100) j++;
if (j>0)
{ print "The ";
objectloop (i in self)
if (i.number==100)
{ k++; i.word_name();
if (k==j-1) print " and ";
if (k<j-1) print ", ";
}
if (j==1) print " spell is"; else print " spells are";
print " yours forever. Other than that, y";
}
else print "Y";
print "ou have ";
j=0; k=0;
objectloop (i in self) if (i.number<99) j++;
if (j>0)
{ print "the ";
objectloop (i in self)
if (i.number<99)
{ k++;
print (name) i;
if (i.number==2) print " (twice)";
if (i.number==3) print " (thrice)";
if (i.number==4) print " (four times)";
if (i.number>=5) print " (many times)";
if (k==j-1) print " and ";
if (k<j-1) print ", ";
}
}
else print "no spells";
" memorised. After a few years, most civil servants lose the brain power nessecary to learn them.
However, you could probably cast one straight from a scroll."; !If you steal my system, you'll probably want to edit this.
],
learn_spell
[ sp;
if (sp.number==100) "You always know that spell.";
print "Using your best study habits, you commit the ";
sp.word_name();
print " spell to memory";
if (sp notin self) sp.number=0;
move sp to self;
self.number_known++;
sp.number++;
if (sp.number==1) print ".";
if (sp.number==2) print " once again.";
if (sp.number==3) print " a third time.";
if (sp.number>3) print " yet another time.";
if (self.number_known <= self.capacity) { new_line; rtrue; }
self.forget_spell(sibling(child(self)));
" You have so much buzzing around in your head, though,
that it's likely something may have been forgotten
in the shuffle.";
],
forget_spell
[ sp;
if (sp notin self || sp.number==100) rtrue;
self.number_known--;
sp.number--;
if (sp.number==0) remove sp;
rtrue;
];
! There is no way to get the gnusto spell, but taking it out makes the compiler
! complain. The same is true of alot of the stuff in the spell system. I
! just couldn't be bothered to go through it all and edit it so it only contained
! what I needed. I'm lazy.
Spell gnusto_spell
with name "gnusto",
purpose "copy a scroll into your spell book",
magic
[ i a_book;
if (second ofclass SpellBook)
"Unlike scrolls, spell books are magically guarded against
the 'theft' of their lore.";
if (second==0 || ~~(second ofclass Scroll))
"Your spell fizzles vaguely out.";
if (second notin player)
"A gnusto spell would require close scrutiny of the scroll
it is to copy: which you do not seem to be holding.";
objectloop (i in player)
if (i ofclass SpellBook) a_book=i;
if (a_book==0)
"Your spell fails, as you have no spell book.";
i=child(second);
if (i==0 || ~~(i ofclass Spell))
{ print_ret "Your spell fails, as ", (the) second,
" is illegible.";
}
a_book.learn_spell(i); remove second;
print_ret
"Your spell book begins to glow softly. Slowly, ornately,
the words of ", (the) i, " are inscribed,
glowing even more brightly then the book itself.
The book's brightness fades, but the spell remains!
However, the scroll on which it was written vanishes as
the last word is copied.";
];
Class SpellBook
with array_of_spells 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,
capacity 16,
learn_spell
[ sp p i;
p = self.&array_of_spells;
for (i=0:i<self.capacity && (p-->i)~=0:i++) ;
if (i==self.capacity) rtrue;
p-->i = sp;
],
before
[; Open, Close:
print_ret
(The) self, " is always open to the right place, but it
is also always closed. This eliminates tedious leafing and
hunting for spells. Many lives have been saved by this
magical innovation.";
Attack:
print_ret "When you are done, ", (the) self, " remains unmarred.";
],
after
[ p i j; Examine:
p = self.&array_of_spells;
for (i=0:i<self.capacity && (p-->i)~=0:i++)
{ j=p-->i; <Examine j>;
}
rtrue;
];
Class Scroll
with parse_name
[ i j k; j=-1;
if (self has general)
{ if (child(self)~=0 && child(self) ofclass Spell)
j=(child(self).&name)-->0; else j='illegible';
}
for (::)
{ k=NextWord();
if (k=='scrolls') parser_action=##PluralFound;
if ((k=='scrolls' or 'scroll' or j) || k==(self.&name)-->0)
i++;
else return i;
}
],
react_before
[; Read, Examine: move self.spell_name to self;
],
before
[ i; Examine:
i=child(self);
give self general;
if (i==0 || ~~(i ofclass Spell))
"The scroll has faded, and you cannot read it.";
print "The scroll reads ~"; i.specification(); print "~.^";
if (i has ungnustoable)
"The spell seems very long and extremely complicated.";
else
rtrue;
],
spell_name 0,
daemon
[; if (self in player)
{ move self.spell_name to memory;
self.spell_name.number = 99;
}
else
{ move self.spell_name to self;
self.spell_name.number = 0;
}
],
invent
[; if (inventory_stage==2 && self has general)
if (self.spell_name == 0) print " (which is illegible)";
else print " (of ", (the) self.spell_name, ")";
!{ if (child(self)==0 || ~~(child(self) ofclass Spell))
! print " (which is illegible)";
! else
! { print " (of ", (the) child(self), ")"; }
!}
];
[ ReadableSpell i j k;
if (scope_stage==1)
{ if (action_to_be==##Examine) rfalse;
rtrue;
}
if (scope_stage==2)
{ objectloop (i in player)
if (i ofclass SpellBook)
{ for (k=0:k<i.capacity && (i.&array_of_spells)-->k~=0:k++)
{ j=(i.&array_of_spells)-->k; PlaceInScope(j);
}
}
rtrue;
}
! No need for scope_stage 3 (the error stage), because our
! ParserError routine handles that case instead
];
[ SpellsSub; memory.describe_contents(); ];
[ LearnSub; if (location==thedark)
print "(The magic writing of the spells casts enough light
that you can read them.)^";
memory.learn_spell(noun);
];
[ CastOneSub; <Cast the_spell_was noun>; ];
[ CastSub s;
the_spell_was = noun; memory.forget_spell(noun);
objectloop(s ofclass scroll && s.spell_name == the_spell_was)
{ remove s;
print "As you cast the spell, ", (the) s," vanishes!^";
}
if (second ~= 0)
{ ResetVagueWords(second); ! Set "it", "him", "her"
if (second provides before
&& second.before() ~= 0) return; ! Run before routine(s)
}
if (noun.magic() ~= 0) return;
"Nothing happens.";
];
[ InScope i;
if (verb_word=='c,cast' or 'cast')
objectloop (i in memory
!Without the following bit of code, casting from scrolls doesn't work
!properly. I can't remember why, but it doesn't.
|| (parent(i) ofclass scroll && parent(i) in player))
PlaceInScope(i);
rfalse;
];
[ ParserError x i flag vb;
if (etype==VERB_PE or ASKSCOPE_PE)
{ if (etype==ASKSCOPE_PE)
{ if (verb_word=='cast') vb=1;
if (verb_word=='learn' or 'memorise' or 'memorize') vb=2;
if (verb_word=='copy') vb=3;
if (vb==0) { etype=CANTSEE_PE; rfalse; }
}
wn=verb_wordnum; if (vb~=0) wn++;
x=NextWordStopped();
for (i=player+1:i<=top_object:i++)
if (i ofclass Spell && Refers(i,x)==1
&& i has known_about) flag=1;
if (flag==1)
{ if (vb==0 or 1)
"You haven't got that spell committed to memory. [Type ~spells~
to see what you do remember.]";
if (vb==2)
"Your training is such that you can only memorise such a spell
with the aid of a spell book containing it.";
if (vb==3)
"You have no text of that spell to copy.";
}
if (vb==1)
"After a few years, most civil servants lose the brain power necessary to learn spells.
However, you could probably cast one straight from a scroll.";
if (vb==2 or 3)
"After a few years, most civil servants lose the brain power necessary to learn spells.
However, you could probably cast one straight from a scroll.";
}
rfalse;
];
[ ChooseObjects obj code;
if (code<2)
{ if (obj in player)
return 2;
rfalse;
}
if (action_to_be==##WriteOn && obj in player) return 9;
if (obj notin player) return 9;
if (obj in player) return 1;
return 0;
];
[ UnknownVerb word i;
objectloop (i in memory)
if (word==(i.&name)-->0) { the_spell_was = i; return 'c,cast'; }
rfalse;
];
[ PrintVerb v;
if (v=='c,cast') { print "cast a spell at"; rtrue; }
rfalse;
];
Scroll old_scroll "old scroll"
with name "old";
Spell -> zimbor_spell
with name "zimbor",
purpose "turn one really big city into lots of tiny, little ashes",
magic
[; deadflag = 4;
"Everyone is very upset with you when the entire city burns down,
and a lot of people want to make your life very, very miserable.
So it's probably a good thing that you're already dead.";
],
has ungnustoable;
Scroll new_scroll "new scroll"
with name "new";
Spell -> zemdor_spell
with name "zemdor",
purpose "turn original into triplicate",
magic
[; if (second == report)
{ achieved(2);
NotifyTheScore();
deadflag = 2;
"^You triplicate the report, and go home. Later, when the entire city of
Mareilon is completely destroyed while you are visting your mother, you
decide that maybe you made a mistake. Then you deny all knowledge of
the incident.";
}
if (second == Gunther)
{ deadflag = 3;
"Well that was a BIG mistake. You see, Gunther actually enjoys
his work, and with 3 of him around, your services are no longer required.";
}
if (second == junk)
{ deadflag = 5;
"The already huge piles of junk multiply. Unfortunately for you, they then
collapse on top of you.";
}
if (second == player)
{ deadflag = 6;
"You feel feel somewhat what lighthead head headed fororor a momentoment moment,,, befobeforere yoyouyou pppaaassssss ooouuuttt... ... ...^
ByByBy ttthhheee time time time you youyou wake wake wake up up up,,, it's it's it's 6:00, 6:00, 6:00 and and and you you you are are are fired fired fired (all three of you).^
(all three of you).^
(all three of you).^";
}
if (second == reports)
{ if (gunther in location)
{ PlayerTo(hallway);
"Gunther watches in horror as you triplicate his reports, and then he
attacks you with his bare hands, pushing you out of his cubicle.
He probably needs to cut down on the coffee.";
}
"The pile of reports is now three times larger than it was. Gunther's not going to
be happy.";
}
"Sadly, the spell fails.";
];
Object grue "grue"
with description "The grue is a sinister, lurking presence in the
dark places of the earth. Its favorite diet is
civil servants, but its insatiable appetite is
tempered by its fear of light. No grue has ever
been seen by the light of day, and few have
survived its fearsome jaws to tell the tale.^