3bdf7102f3e4ca6dccf4ec40769c2f687babec95
[snowed-in.git] / src / snowed-in.inf
1 ! Copyright (C) 2021, 2022 Jason Self <j@jxself.org>
2 !
3 ! This file is free software: you may copy, redistribute and/or
4 ! modify it under the terms of the GNU Affero General Public License
5 ! as published by the Free Software Foundation, either version 3 of
6 ! the License, or (at your option) any later version.
7 !
8 ! This file is distributed in the hope that it will be useful, but
9 ! WITHOUT ANY WARRANTY; without even the implied warranty of
10 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ! Affero General Public License for more details.
12 !
13 ! You should have received a copy of the GNU Affero General Public
14 ! License along with this file. If not, see https://gnu.org/licenses/
15 Global lantern_fuel_left = 20;
16 Global body_temperature = 20;
17 Global cabin_has_electricity = 1;
18 Global forest_location = 1;
19 Global snowmobile_location = 0;
20 Constant MAX_SCORE = 7;
21 Constant DEATH_MENTION_UNDO;
22 Constant Story "Snowed In";
23 Constant Headline 
24     "^A work of interactive fiction.
25     ^If you get stuck try typing HELP.
26     ^Ongoing development: https://jxself.org/git/?p=snowed-in.git
27     ^Send bugs and feedback by email to j@@64jxself.org.
28     ^IFID DE9FA2E5-4EC7-4166-9218-E56EFA1DF40F
29     ^Copyright (C) 2021, 2022 Jason Self <j@@64jxself.org>
30     ^You can change and share this game under the terms of the GNU 
31     Affero General Public License as published by the Free Software 
32     Foundation (FSF), either version 3 of the License, or (at your 
33     option) any later version published by the FSF. See the GNU Affero 
34     General Public License for more details.^^You should have received 
35     a copy of this game's source code along with a copy of the GNU 
36     Affero General Public License so that you can know your rights. 
37     If not, contact the place you got it from.^^";
38 Include "parser";
39 Include "verblib";
40 Release 1;
41 Serial "220531";
42
43 Object  mainroom "Main Room"
44   with  description 
45             "This room is a total wreck - it looks like a major fight 
46             happened in here. There's a ripped up sofa and a broken 
47             old coffee table in the middle of the room. A flat-screen 
48             TV is mounted against the wall, with the screen dangling 
49             out. This cabin has three other rooms. There's an office 
50             area to the east, and a bedroom to the north. A 
51             kitchenette can be found to the west. There's a doorway 
52             in the south wall leading outside.",
53         n_to bedroom,
54         s_to frontdoor,
55         e_to office,
56         w_to kitchenette,
57   has   light;
58
59 Object  frontdoor "front door" mainroom
60   with  name 'door' 'front',
61         description 
62             "The wooden door is made of thick oak wood with the shape 
63             of a bear claw engraved in it.",
64         short_name [;
65             if (location == mainroom)
66                 print "door to the outside";
67             else
68                 print "door to the cabin";
69             return true;
70         ],
71         found_in mainroom southofcabin,
72         door_dir [;
73             if (location == mainroom)
74                 return s_to;
75             else
76                 return n_to;
77         ],
78         door_to [;
79             if (location == mainroom)
80                 return southofcabin;
81             else
82                 return mainroom;
83         ],
84   has   scenery door openable;
85
86 Object  bearclaw "bear claw" mainroom
87   with  name 'bear' 'claw',
88   with  description 
89             "It's in the shape of a thin, sharp claw with three jagged 
90             points at the top of it.",
91   has   scenery;
92
93 Object  sofa "sofa" mainroom
94   with  name 'sofa' 'couch',
95   with  description 
96             "The sofa is in poor shape. The upholstery is ripped and 
97             there are several holes in it.",
98         before [;
99           Take, Pull, Push, PushDir, Turn:
100             print_ret (The) self, " is too heavy for that.";
101         ],
102   has   scenery supporter enterable;
103
104 Object  coffeetable "coffee table" mainroom
105   with  name 'coffee' 'table',
106   with  description 
107             "The old coffee table looks as if it's had quite a bit of 
108             use. There are burn marks covering it and the paint is 
109             worn off in most places.",
110         before [;
111           Take, Pull, Push, PushDir, Turn:
112             print_ret (The) self, " is too heavy for that.";
113         ],
114   has   scenery supporter enterable;
115
116 Object  lantern "copper lantern" coffeetable
117   with  name 'lantern' 'copper' 'lamp',
118         description 
119             "This is an exceptionally beautiful lantern, made of 
120             fired copper, and polished until it shines. About eleven 
121             inches high, with a base of about 5 inches or so in 
122             diameter and a large, brass-closed hook at the top. A 
123             rainbow of unique colors run through the copper. The 
124             glass in the lamp has a fresnel type of design, which is 
125             used to distribute light widely.",
126         time_left,
127         time_out [;
128             if (lantern has on) {
129                 lantern_fuel_left = 0;
130                 give lantern ~on;
131                 give lantern ~light;
132                 StopDaemon(lantern);
133                 print_ret 
134                     "Suddenly, the lantern's flame begins to flicker 
135                     violently within its glass prison and then 
136                     extinguishes itself.";
137             }
138         ],
139         before [;
140           SwitchOn:
141             if (lantern_fuel_left > 0) {
142                 give lantern light;
143                 StartTimer(lantern, lantern_fuel_left);
144             }
145             else {
146                 print_ret 
147                     "You snap the switch a few times, but nothing 
148                     happens.";
149             }
150           SwitchOff:
151             StopTimer(lantern);
152             give lantern ~light;
153         ],
154         daemon [;
155             if (lantern has on)
156                 lantern_fuel_left = lantern.time_left;
157             if (lantern has on && lantern_fuel_left <= 5)
158                 print_ret "The lantern's fuel runs low.";
159         ],
160   has   switchable;
161
162 Object  television "flat-screen TV" mainroom
163   with  name 'TV' 'television' 'flat' 'screen' 'flat-screen',
164   with  description 
165             "The flat-screen TV looks fairly modern but it's been 
166             broken in a fight and the screen is dangling out.",
167         before [;
168           Take, Pull, Push, PushDir, Turn:
169             print_ret (The) self, " is firmly mounted to the wall.";
170           SwitchOn:
171             if (television hasnt visited) {
172                 score = score + 1;
173                 print 
174                     "Despite the significant damage, the television 
175                     comes to life in one last valiant attempt to be 
176                     useful. Your favorite news program is on: U.S. 
177                     News And Grue Report. The news anchor is giving a 
178                     warning of grue sightings in the area of the 
179                     forest before the television finally dies.^";
180                 give television visited;
181             }
182             else {
183                 print 
184                     "The flat-screen TV is broken and can't be 
185                     turned on.^";
186             }
187             return true;
188         ],
189   has   scenery switchable;
190
191 Object  lightsocket "light socket" mainroom
192   with  name 'socket' 'lightsocket',
193         before [;
194           Take, Pull, Push, PushDir, Turn:
195             print_ret 
196                 "You don't have the tools to remove a light 
197                 socket.";
198           Receive:
199             if (noun ~= lightbulb) {
200                 print "Put ";
201                 print (a) noun;
202                 print_ret 
203                     " into the light socket? Maybe you should come 
204                     with a warning label because you contain more than 
205                     a trace amount of nut.";
206             }
207             if (noun == lightbulb && lightbulb has on) {
208                 give mainroom light;
209                 give office light;
210                 give kitchenette light;
211                 give bedroom light;
212                 give eastofcabin light;
213                 give southofcabin light;
214             }
215         ],
216   has   scenery container transparent open;
217
218 Object  lightbulb "light bulb" lightsocket
219   with  name 'light' 'bulb' 'lightbulb',
220         before [;
221           SwitchOn:
222             if (lightbulb in lightsocket) {
223                 if (cabin_has_electricity == 1) {
224                     give mainroom light;
225                     give office light;
226                     give kitchenette light;
227                     give bedroom light;
228                     give eastofcabin light;
229                     give southofcabin light;
230                 }
231                 else {
232                     print_ret 
233                         "You flip the switch a few times, but nothing 
234                         happens.";
235                 }
236             }
237             else {
238                 print_ret 
239                     "Turn on a lightbulb when it's not in the 
240                     socket? What a strange idea.";
241             }
242         ],
243         after [;
244           Take, Pull, Push, PushDir, Turn, SwitchOff:
245             give lightbulb ~on;
246             give mainroom ~light;
247             give office ~light;
248             give kitchenette ~light;
249             give bedroom ~light;
250             give eastofcabin ~light;
251             give southofcabin ~light;
252         ],
253   has   switchable on;
254
255 Object  office "Office"
256   with  description 
257             "There seems to have been quite a fight in here. The room 
258             is a wreck. Holes are in the walls and the window is 
259             broken, letting in the cold air from outside. Chunks of 
260             drywall and insulation cover the floor. The desk has a 
261             bullet hole through the middle.",
262         before [;
263           Go:
264             if (noun == e_obj) {
265                 if (snowshoes has worn)
266                     print_ret 
267                         "You can't fit through the window while 
268                         wearing the snow shoes.";
269             }
270             if (eastofcabin hasnt visited) {
271                 score = score + 1;
272                 give office visited;
273             }
274         ],
275         w_to mainroom,
276         e_to window,
277   has   light;
278
279 Object  desk "solid oak desk" office
280   with  name 'solid' 'oak' 'desk',
281   with  description 
282             "The desk is old and made of solid oak. The right side of 
283             it has been smashed and all of the drawers have been 
284             removed. A bullet hole goes straight through the middle of 
285             the desk.",
286         before [;
287           Take, Pull, Push, PushDir, Turn:
288             print_ret (The) self, " is too heavy for that.";
289         ],
290   has   scenery supporter enterable;
291
292 Object  businesscard "business card" desk
293   with  name 'business' 'card',
294   with  description 
295             "The business card is white and has blacked edges. It 
296             bears the name ~Lasting Solutions~, a local data recovery 
297             company, in bold letters on the top. The company's 
298             website URL is printed in blue at the bottom.";
299
300 Object  salesreceipt "sales receipt" desk
301   with  name 'sales' 'receipt',
302   with  description 
303             "The sales receipt is for $200, dated three years ago. 
304             It's printed on old tractor feed printer paper and bears 
305             the name ~Lasting Solutions~, a local data recovery 
306             company. A handwritten note is scrawled on the bottom: 
307             ~Start working on these hard drives soon.~";
308
309 Object  computer "computer" desk
310   with  name 'computer' 'PC',
311   with  description 
312             "It's a heavy older model that appears to have been 
313             seriously damaged in a fight. It's clearly on its last 
314             legs but is perhaps still useful.",
315         before [;
316           Take, Pull, Push, PushDir, Turn:
317             print_ret (The) self, " is too heavy for that.";
318           SwitchOn:
319             if (computer hasnt visited) {
320                 score = score + 1;
321                 print 
322                     "The computer makes some concerning noises while 
323                     lights on the front also illuminate. The last 
324                     file is quickly displayed. ~If anyone else reads 
325                     this, you're in serious danger. I've been fighting 
326                     a ferocious grue for the last three days. I'm 
327                     almost out of supplies and can't last much 
328                     longer. I'm going to take the last of the supplies 
329                     and escape through the office window in a 
330                     last-ditch effort to get away and get back into 
331                     town. I hope I can make it.~ The computer then 
332                     makes a sickly sound and finally dies as some 
333                     smoke comes out of it.^";
334                 give computer visited;
335             }
336             else {
337                 print 
338                     "The display briefly flickers but nothing 
339                     else happens.^";
340             }
341             return true;
342         ],
343   has   switchable;
344
345 Object  drywall "drywall" office
346   with  name 'drywall' 'dry' 'wall',
347         before [;
348           Take, Pull, Push, PushDir, Turn:
349             print_ret "Taking that would achieve little.";
350         ],
351   has   scenery;
352
353 Object  insulation "insulation" office
354   with  name 'insulation',
355         before [;
356           Take, Pull, Push, PushDir, Turn:
357             print_ret "Taking that would achieve little.";
358         ],
359   has   scenery;
360
361 Object  bullethole "bullet hole" desk
362   with  name 'bullet' 'hole' 'holes',
363   with  description 
364             "Looks to have come from something that's capable of 
365             doing a lot of damage.",
366         found_in desk bedroom,
367   has   scenery;
368
369 Object  window "window" office
370   with  name 'window' 'windows',
371         description 
372             "The window faces the east side of the cabin. It's broken, 
373             letting in the cold air from outside.",
374         short_name [;
375             if (location == office)
376                 print "window";
377             else
378                 print "window into the cabin";
379             return true;
380         ],
381         found_in office eastofcabin,
382         door_dir [;
383             if (location == office)
384                 return e_to;
385             else
386                 return w_to;
387         ],
388         door_to [;
389             if (location == office)
390                 return eastofcabin;
391             else
392                 return office;
393         ],
394         before [;
395           Search:
396             print_ret "The window faces the east side of the cabin.";
397           Open, Close:
398             print_ret 
399                 "The window's broken so it's not clear how 
400                 you'd do that.";
401         ],
402   has   scenery door openable open;
403
404 Object  kitchenette "Kitchenette"
405   with  description 
406             "The kitchenette is empty. A sink, you think, though it's 
407             hard to tell what's a pipe and what's a faucet. A 
408             refrigerator, standing open and empty. The door has been 
409             ripped off. There's no indication as to where it 
410             went. There's no food anywhere in here.",
411         e_to mainroom,
412   has   light;
413
414 Object  refrigerator "refrigerator" kitchenette
415   with  name 'fridge' 'refrigerator',
416   with  description 
417             "An old rusty refrigerator, standing open and empty. The 
418             door has been ripped off. There's no indication as to 
419             where it went.",
420         before [;
421           Take, Pull, Push, PushDir, Turn:
422             print_ret (The) self, " is too heavy for that.";
423           Open, Close:
424             print_ret (The) self, " door is missing.";
425         ],
426   has   scenery enterable container openable open;
427
428 Object  sink "sink" kitchenette
429   with  name 'sink' 'pipe' 'faucet',
430   with  description 
431             "A sink, you think, though it's hard to tell what's a 
432             pipe and what's a faucet.",
433         after [;
434           SwitchOn:
435             print_ret 
436                 "Pipes from in the walls make a groaning sound, 
437                 almost like pain and despair. No water comes out.";
438         ],
439   has   scenery container switchable;
440
441 Object  bedroom "Bedroom"
442   with  description 
443             "This bedroom is small and cramped, and looks like a 
444             major fight happened as the exterior wall has bullet 
445             holes. The bed is lying on the floor, torn to shreds. It 
446             has no sheets, just a bare mattress.",
447         s_to mainroom,
448   has   light;
449
450 Object  bed "bed" bedroom
451   with  name 'bed' 'mattress',
452   with  description "The mattress is bare and empty.",
453         before [;
454           Take, Pull, Push, PushDir, Turn:
455             print_ret (The) self, " is too heavy for that.";
456         ],
457   has   scenery supporter;
458
459 Object  suitcase "suitcase" bedroom
460   with  name 'suitcase' 'case',
461   with  description 
462             "The suitcase is made of a light metallic material that 
463             you can't quite make out. The color of it is somewhere 
464             between silver and grey.",
465   has   container open openable;
466
467 Object  snowsuit "snowsuit" suitcase
468   with  name 'snowsuit' 'snow' 'suit',
469   with  description 
470             "The snowsuit is blue, decorated with white and purple 
471             designs. On the chest are the letters ~CE~ in purple.",
472         before [;
473           Examine:
474             if (snowsuit hasnt visited) {
475                 score = score + 1;
476                 give snowsuit visited;
477             }
478           Wear:
479             if (snowshoes in player && snowshoes has worn) {
480                 print_ret "The snowsuit can't fit over the snowshoes.";
481             }
482           Disrobe, Remove:
483             if (snowshoes in player && snowshoes has worn) {
484                 print_ret "The snowsuit can't be taken off over the snowshoes.";
485             }
486         ],
487         daemon [;
488             if (location ~= mainroom && location ~= office && location ~=
489             kitchenette && location ~= bedroom && location ~= thedark &&
490             snowsuit hasnt worn) {
491                 body_temperature = --body_temperature;
492             }
493             if (location == mainroom || location == office || location ==
494             kitchenette || location == bedroom || snowsuit has worn && body_temperature
495             < 20) {
496                 body_temperature = ++body_temperature;
497             }
498             if (body_temperature == 0) {
499                 deadflag = 4;
500             }
501             if (body_temperature <= 5)
502                 print_ret 
503                     "You're shivering uncontrollably, and it's hard 
504                     to move. You feel very exhausted and drowsy. It's 
505                     all you can do to keep from falling over.";
506             if (body_temperature > 5 && location ~= mainroom && location
507             ~= office && location ~= kitchenette && location ~= bedroom
508             && location ~= thedark && snowsuit hasnt worn) {
509                 switch (body_temperature) {
510                   19:
511                     "The feeling of cold overwhelms you. Surely the cold will get to 
512                     you before anything else does. Right?";
513                   18:
514                     "You can feel yourself getting colder and colder.";
515                   17:
516                     "You can see your own breath freezing in the air, forming little 
517                     clouds.";
518                   16:
519                     "You shiver in the cold.";
520                   15:
521                     "You continue to shiver in the cold.";
522                   14:
523                     "Your hands grow numb from the cold.";
524                   13:
525                     "You continue shivering in order to keep warm.";
526                   12:
527                     "Your shivering grows worse as your body becomes colder by the
528                     minute.";
529                   11:
530                     "Your teeth begin to chatter as you desperately try to warm 
531                     yourself up.";
532                   10:
533                     "Your shivering intensifies as your body begins to freeze over 
534                     from the cold.";
535                   9:
536                     "Your fingers become stiff and you feel sharp pains all over your
537                     body.";
538                   8:
539                     "The cold has gotten to a point where it is too much for you. You 
540                     begin to shiver uncontrollably.";
541                   7:
542                     "Your eyesight begins to fade and you can't even feel yourself 
543                     shivering anymore.";
544                   6:
545                     "You can feel your body shutting down from the cold as you slowly 
546                     begin to lose consciousness.";
547                 }
548             }
549         ],
550   has   clothing;
551
552 Object  snowshoes "snowshoes" bedroom
553   with  name 'snowshoe' 'snowshoes' 'snow' 'boot' 'boots' 'shoe' 'shoes'
554         'metal' 'frame',
555   with  description 
556             "They're light blue in color and have a thick, hard 
557             rubber bottom that's attached to a metal frame that keeps 
558             you from sinking into the snow. They look to be warm and 
559             comfortable.",
560         after [;
561           Wear:
562             print_ret (The) self, 
563                 " fit perfectly and go up to your 
564                 knees.";
565         ],
566         daemon [;
567             if (location ~= mainroom && location ~= office && location ~=
568             kitchenette && location ~= bedroom && location ~= thedark &&
569             location ~= eastofcabin && snowshoes hasnt worn) {
570                 deadflag = 3;
571             }
572         ],
573   has   pluralname clothing;
574
575 Object  southofcabin "South Of Cabin"
576   with  description [;
577             print 
578                 "The wind is howling, and there's snow flying 
579                 everywhere. The snow buildup seems to get higher to 
580                 the west. ";
581             if (snowsuit hasnt worn)
582                 print 
583                     "It's really cold and you're not dressed for 
584                     this weather. ";
585             if (frontdoor has open) {
586                 check_for_cabin_lighting();
587             }
588             if (snowshoes has worn && lantern in player && eastofcabin hasnt
589             visited && lantern_fuel_left > 0) {
590                 throw_rock();
591             }
592             print "^";
593         ],
594         n_to frontdoor,
595         s_to forest,
596         e_to eastofcabin,
597         w_to westofcabin,
598   has   light;
599
600 Object  truckspot "Forest"
601   with  description 
602             "The blizzard is still going on. You don't think it's 
603             letting up any time soon. There is a blue and white 
604             pickup truck here. It looks like it got stuck in the snow 
605             and is slowly being covered by it. The windows are iced 
606             up and you can't see inside.",
607         before [;
608           Go:
609             forest_location = forest_location++;
610             PlayerTo(forest, 1);
611         ];
612
613 Object  truck "blue and white pickup truck" truckspot
614   with  name 'pickup' 'truck' 'door' 'doors',
615   with  description 
616             "The blue and white pickup truck looks old and battered. 
617             The paint has chipped and faded. The windows are iced up 
618             and you can't see inside.",
619         before [;
620           Take, Pull, Push, PushDir, Turn:
621             print_ret (The) self, " is too heavy for that.";
622           Search:
623             print_ret 
624                 "The windows are iced up and you can't see 
625                 inside.";
626           Enter, Open, GoIn:
627             print_ret (The) self, " is frozen shut.";
628         ],
629   has   scenery supporter enterable openable;
630
631 Object  backpacklocation "Forest"
632   with  description 
633             "You keep walking and walking. The snowfall is still as 
634             heavy as ever. As you continue trudging through the snow, 
635             you wonder if you're actually moving in the right 
636             direction. You can't see anything through the blizzard. 
637             You wonder if you might be going in circles and end up 
638             wandering around forever, never finding your way out of 
639             this white void. You're unsure of which way to go. The 
640             snowfall is so thick that you can barely see your hand if 
641             you hold it right in front of your face. You have no idea 
642             how far you've come or in what direction.",
643         before [;
644           Go:
645             forest_location = forest_location++;
646             PlayerTo(forest, 1);
647         ];
648
649 Object  backpack "backpack" backpacklocation
650   with  name 'backpack' 'back' 'pack' 'blood',
651   with  description 
652             "The backpack is of medium size, black, with three white 
653             stripes running vertically on the back. The middle stripe 
654             is broken up by a red line running down the center of it 
655             toward the bottom of the backpack. On the side are the 
656             letters ~CE~ in purple. The backpack is covered in blood, 
657             as if the owner met with an untimely demise.",
658         before [;
659           Examine:
660             if (backpack hasnt visited) {
661                 score = score + 1;
662                 give backpack visited;
663             }
664         ],
665   has   clothing container openable;
666
667 Object  flashlight "flashlight" backpack
668   with  name 'flashlight' 'flash' 'light' 'torch',
669         description 
670             "It looks like a cheap red plastic model, about eight 
671             inches long.",
672         before [;
673           SwitchOn:
674             if (flashlight hasnt visited) {
675                 score = score + 1;
676                 give flashlight visited;
677             }
678             give flashlight light;
679           SwitchOff:
680             give lantern ~light;
681         ],
682   has   switchable;
683
684 [ print_forest_description;
685     if (location ~= thedark) {
686         switch (forest_location) {
687           1:
688             print_ret 
689                 "You push on despite the bitter cold and the heavy 
690                 snowfall as you come to a fork. There are two ways to 
691                 go here, one involves a hill to the south. The 
692                 other way is continuing through the woods to the 
693                 north.";
694           2:
695             print_ret 
696                 "The wind is bitterly cold. You plow through the 
697                 snowfall, which is still as heavy as ever. You can 
698                 barely see where you are going, making it hard to 
699                 tell which direction is which. Out of the corner of 
700                 your eye, you spot a tall, shadowy figure lingering 
701                 at the edge of your vision. When you turn to look at 
702                 it directly, however, it disappears. You continue 
703                 walking. The wind is howling louder than ever. The 
704                 endless snowfall makes it difficult to see where 
705                 you're going. You can't tell where the white sky and 
706                 white ground begin and end.";
707           3:
708             PlayerTo(truckspot);
709           4:
710             print_ret 
711                 "You trudge through the snow. The wind is really 
712                 strong and howling like a banshee. You hear a horrible 
713                 howl in the distance or is it the wind? Looking 
714                 around you see nothing in this barren landscape but 
715                 snow. You're not sure what to make of it, but you 
716                 don't want to stick around to find out. The whole 
717                 world is white. You can barely see five feet ahead of 
718                 you. You hope you're going the right way. This place 
719                 is so desolate and barren.";
720           5:
721             print_ret 
722                 "You think you might can see a large figure stepping 
723                 out of the trees and moving in the distance but the 
724                 wind is blowing hard and whipping up massive amounts 
725                 of snow, making it hard to tell for sure. Your breath 
726                 billows out in huge clouds. If it keeps blowing like 
727                 this, you're not sure if you'll ever be able to get 
728                 back. Snow whirls through the air as a gust of wind 
729                 picks up speed. The howling gets louder and more 
730                 intense. There's no left, right, backward or forward. 
731                 There's nothing but endless, unchanging whiteness.";
732           6:
733             PlayerTo(backpacklocation);
734           7:
735             print_ret 
736                 "It feels like you're lost in a maze of snow without 
737                 a map. You keep trudging through the heavy snowfall, 
738                 not knowing if you're even going in any particular 
739                 direction anymore. The wind is really picking up now 
740                 and the snowfall is getting heavier. You have to keep 
741                 going. You can't let the snowstorm get the best of 
742                 you. You can't give up. You must find a way out of 
743                 this frozen wasteland. The snowstorm has made it 
744                 impossible to see anything more than a few feet in 
745                 front of you.";
746           8:
747             print_ret 
748                 "The wind is now a shrieking banshee, freezing and 
749                 relentless, as it throws the snow into your face, 
750                 blinding you. It's hard to walk against the brutal 
751                 winds. You can't see anything, but you must keep 
752                 going. There is no choice. You continue your way 
753                 through the snowy white void, what with the snow 
754                 piling up around you. The wind screams in your ears 
755                 and you can't see anything. Can't go back. Can't go 
756                 forward. You can't even see where you are. You hope 
757                 that, as long as you keep moving, you'll eventually 
758                 find a way out of this frozen wasteland.";
759           9:
760             print_ret 
761                 "The blizzard rages, but you continue to press on. 
762                 There's nothing here but you, the snowfall, and the 
763                 fierce wind howling through this frozen landscape. 
764                 This isn't just a place of cold and ice - it's 
765                 other-worldly. You trudge on and try to keep your 
766                 spirits up and not let the snowstorm get to you. Every 
767                 step is an effort. You wish you had the powers of a 
768                 superhero right now. You can barely see where you are 
769                 going. The wind knocks you down on your hands and 
770                 knees. You get back up, but you're slipping and 
771                 sliding all over the place.";
772           10:
773             print_ret 
774                 "You wander around in the impenetrable white void. 
775                 The wind is howling louder than ever. You try to 
776                 persevere. You don't know if you're going in circles 
777                 or what, but you start to feel that this frozen, 
778                 lifeless landscape is sucking away your very life 
779                 force. You can't see your hand in front of your face. 
780                 You can barely keep moving. Every step you take is 
781                 hard-fought. You just want this awful nightmare to 
782                 end. You begin to feel sleepy but you're in danger 
783                 here. You have to keep moving. Sleep is not an option 
784                 when you're in a place like this.";
785           11:
786             print_ret 
787                 "You try to remember the survival tips you've read 
788                 on the internet, but frankly, you don't remember most 
789                 of them right now. As you walk you try to keep your 
790                 mind occupied with anything other than the storm. 
791                 Nothing makes any sense and you feel like you're 
792                 starting to go in circles. The wind starts starts to 
793                 pick up as it begins howling louder than ever. You're 
794                 determined to live but the blizzard doesn't seem to 
795                 care whether you live or die. It just keeps howling 
796                 and shrieking. It's not getting any easier to move in 
797                 this blizzard.";
798           12:
799             print_ret 
800                 "You keep walking. The snow is drifting and piling 
801                 up around you, making movement almost impossible. You 
802                 look around the barren landscape, but there's nothing 
803                 nearby except snow. It's almost as if you're lost in 
804                 a white, endless void. You start to get disoriented. 
805                 You don't even know if you're walking in a circle or 
806                 not. The situation is looking very grim. Your life 
807                 feels as if it is slowly ebbing away in the 
808                 relentless grip of the snowstorm. It feels like 
809                 you've been wandering for hours, but that's probably 
810                 just your perception of time slipping away.";
811           13:
812             print_ret 
813                 "You can barely see anything, and you stumble 
814                 forward. You could be wandering aimlessly in any 
815                 direction right now and you wouldn't know the 
816                 difference. It's as if you're in a sea of white. 
817                 You're not sure that you're going in the right 
818                 direction but you can't stop now. There has to be 
819                 something here besides endless snow. You know that 
820                 staying here is a death sentence. You have to escape. 
821                 You're cold, tired, miserable, and desperate to get 
822                 out of this mess. You have no idea where you are. You 
823                 keep wandering through endless whiteness. You won't 
824                 give up.";
825           14:
826             deadflag = 2;
827             print_ret 
828                 "You see something in the distance but can't make it 
829                 out. You walk toward it to find out that it's the 
830                 hotel. You collapse in the lobby as the hotel staff 
831                 rush over to you.";
832         }
833     }
834 ];
835
836 Object  forest "Forest"
837   with  description [;
838             print_forest_description();
839         ],
840         before [;
841           Go:
842             if (location == thedark) {
843                 DarkToDark();
844             }
845             if (noun == d_obj || noun == u_obj) {
846                 print_ret "You can't go that way.";
847             }
848             forest_location = forest_location++;
849         ],
850         cant_go print_forest_description;
851
852 [ throw_rock;
853     if (television has visited || computer has visited) {
854         print 
855             "The grue is waiting behind a snowbank in
856             the distance, away from the light. ";
857     }
858     print 
859         "From somewhere off in the dark distance, far away from the 
860         light, a rock is hurled in your direction. It hits the 
861         lantern, breaking it, and putting it out of commission. ";
862     give lantern ~on;
863     give lantern ~light;
864     lantern_fuel_left = 0;
865     StopDaemon(lantern);
866     score = score - 1;
867 ];
868
869 [ check_for_cabin_lighting;
870     if (lightbulb has on) {
871         print 
872             "The light from inside the cabin only penetrates a few 
873             feet from the building. ";
874     }
875     else
876         if (lantern in player && lantern has on) {
877             print 
878                 "The lantern provides the only source of 
879                 light. ";
880         }
881     if (location has light)
882         print 
883             "The snow stings your face and you can barely see three feet in 
884             front of you. ";
885     if (snowshoes in player && snowshoes has worn) {
886         print 
887             "The snowshoes are doing their job by making sure 
888             you don't sink into the snow. ";
889     }
890 ];
891
892 Object  eastofcabin "East Of Cabin"
893   with  description [;
894             print "It's dark outside. ";
895             check_for_cabin_lighting();
896             if (cabin_has_electricity == 1 && lantern in player && lantern_fuel_left
897             > 0) {
898                 throw_rock();
899             }
900             print "^";
901         ],
902         w_to window,
903         s_to southofcabin,
904         cant_go 
905             "The snow buildup is is too great to continue in that 
906             direction.",
907   has   light;
908
909 Object  roof "Roof"
910   with  description [;
911             print 
912                 "You're on the roof of the cabin, although it's hard 
913                 to tell where the snow buildup ends and the roof 
914                 begins. You can make out the trees around the cabin, 
915                 but you can't see very far out into the snowfield 
916                 beyond them.";
917             if (roof hasnt visited)
918                 print 
919                     " You hear a snowmobile approaching in the 
920                     distance. Is it your salvation? The snowmobile 
921                     quickly zooms by in front of the cabin and 
922                     disappears into the forest.";
923             StartDaemon(snowmobile);
924             if (roof has visited)
925                 print 
926                     " There seems to be no movement, no sound, no 
927                     sign of anything.";
928             new_line;
929         ],
930         n_to northofcabin,
931         cant_go "Walking off the edge of a roof seems unwise.";
932
933 Object  northofcabin "North Of Cabin"
934   with  description 
935             "You're on the north side of the cabin. The wind is 
936             howling and the snow is coming down; falling too fast to 
937             see well. The snow buildup here is so great that it's 
938             almost level with the cabin's roof, which is to the 
939             south.",
940         n_to westofcabin,
941         s_to roof,
942         w_to westofcabin,
943         cant_go "It's too steep to go in that direction safely.",
944         before [;
945           Go:
946             if (noun == s_obj) {
947                 if (roof hasnt visited) {
948                     score = score + 1;
949                     give roof visited;
950                 }
951             }
952         ];
953
954 Object  westofcabin "West Of Cabin"
955   with  description 
956             "The snow is falling so fast that you can barely see 
957             anything. You can't even be sure you're going in the right 
958             direction. The snow buildup gets taller to the north.",
959         s_to southofcabin,
960         n_to northofcabin,
961         cant_go 
962             "The snow buildup is is too great to continue in that 
963             direction.";
964
965 [ Initialise;
966     Location = mainroom;
967     thedark.description = 
968         "It is pitch black. You are likely to be eaten 
969         by a grue.";
970     print 
971         "You're trapped in a snowstorm while visiting the forest 
972         during your vacation to a small rural town. This is the worst 
973         snowstorm in more than 40 years. If only you had listened to 
974         the news. Well, it's too late for that. The snow has been 
975         falling for the past seven hours and shows no signs of 
976         stopping any time soon. You need to get back to your hotel in 
977         the town. You finally manage to find an old cabin in the 
978         woods and get inside but have no idea where you are. You're 
979         not dressed for this weather, and it's getting dark outside.^";
980     StartDaemon(lantern);
981     StartDaemon(snowshoes);
982     StartDaemon(snowsuit);
983     StartDaemon(grue);
984 ];
985
986 [ DeathMessage;
987     if (deadflag == 3)
988         print "You sink into the deep snow and are unable to move.";
989     if (deadflag == 4)
990         print 
991             "Finally, you succumb to the cold. Your mind goes blank as 
992             you slip away into the endless darkness and the deep sleep 
993             of death.";
994 ];
995
996 ! Don't have 'take all' take the lightbulb in the mainroom of the 
997 ! cabin
998
999 [ ChooseObjects obj code;
1000     if (code < 2) {
1001         if (obj has scenery)
1002             return 2;
1003         rfalse;
1004     }
1005     if (obj == lightbulb)
1006         return 0;
1007 ];
1008
1009 [ InScope;
1010     if (location == thedark && real_location == mainroom) {
1011         PlaceInScope(lightsocket);
1012         PlaceInScope(lightbulb);
1013     }
1014     return false;
1015 ];
1016
1017 Object  snowmobile "snowmobile" thedark
1018   with  name 'snowmobile',
1019         daemon [;
1020             snowmobile_location = random(13);
1021             if (location == forest && forest_location == snowmobile_location)
1022             {
1023                 deadflag = 2;
1024                 print_ret 
1025                     "A snowmobile approaches. The person says they 
1026                     saw your light and came to rescue you.";
1027             }
1028             return true;
1029         ],
1030   has   scenery;
1031
1032 Object  grue "grue" thedark
1033   with  article "the",
1034         name 'grue' 'monster',
1035         grue_active_around_cabin,
1036         grue_active_in_the_dark,
1037         daemon [;
1038             if (location == thedark) {
1039                 switch (++(self.grue_active_in_the_dark)) {
1040                   1:
1041                     "^You hear horrible gurgling sounds in the dark.";
1042                   2:
1043                     "^You hear the clink of razor-sharp claws nearby.";
1044                   3:
1045                     deadflag = 1;
1046                     "^Your last memory is of the slavering fangs of the 
1047                     horrible Grue as it claims you for a meal.";
1048                 }
1049             }
1050             if (location == mainroom || location == office || location ==
1051             kitchenette || location == bedroom) {
1052                 switch (++(self.grue_active_around_cabin)) {
1053                   1:
1054                     "^You hear the wind howling outside, if it is the wind.";
1055                   2:
1056                     "^You hear horrible gurgling sounds outside.";
1057                   3:
1058                     "^The noise outside gets louder.";
1059                   4:
1060                     "^You hear the sound of shuffling feet outside.";
1061                   5:
1062                     "^You hear something sniffing around the cabin.";
1063                   6:
1064                     "^You hear a deep guttural sound from outside that sends a chill down your spine.";
1065                   7:
1066                     "^You hear something scratching on the cabin walls from outside.";
1067                   8:
1068                     "^You hear something howl outside. It's a chilling, mournful wail that sends a chill down your spine.";
1069                   9:
1070                     "^A thunderous CRACK can be heard coming from outside.";
1071                   10:
1072                     "^There's a sudden crashing sound as something is thrown against the cabin walls.";
1073                   11:
1074                     "^Something begins to beat against the walls of the cabin, as if trying to to break in. It makes a loud, thunderous noise.";
1075                   12:
1076                     "^The wind is howling and the walls are being beaten so hard it feels like the cabin is shaking.";
1077                   13:
1078                     "^Suddenly, there's ominous silence from outside the cabin.";
1079                 }
1080             }
1081             if (location == mainroom || location == office || location ==
1082             kitchenette || location == bedroom && self.grue_active_around_cabin
1083             == 15) {
1084                 print "^The lights flicker and suddenly go out.^";
1085                 cabin_has_electricity = 0;
1086                 give lightbulb ~on;
1087                 give mainroom ~light;
1088                 give office ~light;
1089                 give kitchenette ~light;
1090                 give bedroom ~light;
1091                 give eastofcabin ~light;
1092                 give southofcabin ~light;
1093             }
1094             return true;
1095         ],
1096   has   scenery;
1097
1098 [ DarkToDark;
1099     deadflag = 1;
1100     "Oh, no! You have walked into the slavering fangs of a lurking 
1101     grue!";
1102 ];
1103
1104 [ PrintRank;
1105     print ", earning you the rank of ";
1106     if (score == 0)
1107         "Novice.";
1108     if (score == 1)
1109         "Trained.";
1110     if (score == 2)
1111         "Skilled.";
1112     if (score == 3)
1113         "Talented.";
1114     if (score == 4)
1115         "Capable.";
1116     if (score == 5)
1117         "Adept.";
1118     if (score == 6)
1119         "Proficient.";
1120     if (score >= 7)
1121         print "Versed.";
1122 ];
1123
1124 [ URL;
1125     print 
1126         "^If you need help try some of the commands from: 
1127         ^https://pr-if.org/doc/play-if-card/^";
1128 ];
1129
1130 [ XyzzySub;
1131     print "Nothing obvious happens.^";
1132     return true;
1133 ];
1134
1135 [ HelpSub;
1136     URL();
1137     return true;
1138 ];
1139
1140 Include "grammar";
1141
1142 Verb 'About'
1143     * -> Version;
1144
1145 Verb 'Info'
1146     * -> Version;
1147
1148 Verb 'Help'
1149     * -> Help;
1150
1151 Verb 'Clue'
1152     * -> Help;
1153
1154 Verb 'Hint'
1155     * -> Help;
1156
1157 Verb 'xyzzy'
1158     * -> Xyzzy;
1159
1160 Verb 'crawl'
1161     * 'through' / 'out' / 'via' noun -> Go;
1162
1163 Verb 'escape'
1164     * 'through' / 'out' / 'via' noun -> Go;
1165
1166 Extend 'jump'
1167     * 'through' / 'out' / 'via' noun -> Go;
1168
1169 Extend 'climb'
1170     * 'through' / 'out' / 'via' noun -> Go;
1171
1172 Extend 'go'
1173     * 'through' / 'out' / 'via' noun -> Go;