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