Fix scoring problem
[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 "220612";
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                 if (eastofcabin hasnt visited) {
300                     score = score + 1;
301                     give office visited;
302                 }
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. There's a bare mattress, torn to shreds. The main 
477             room is to the south.",
478         s_to mainroom,
479   has   light;
480
481 Object  bed "bed" bedroom
482   with  name 'bed' 'mattress',
483   with  description "The mattress is bare and empty.",
484         before [;
485           Take, Pull, Push, PushDir, Turn:
486             print_ret (The) self, " is too heavy for that.";
487         ],
488   has   scenery supporter;
489
490 Object  suitcase "suitcase" bedroom
491   with  name 'suitcase' 'case',
492   with  description 
493             "The suitcase is made of a light metallic material that 
494             you can't quite make out. The color of it is somewhere 
495             between silver and grey.",
496   has   container open openable;
497
498 Object  snowsuit "snowsuit" suitcase
499   with  name 'snowsuit' 'snow' 'suit',
500   with  description 
501             "The snowsuit is blue, decorated with white and purple 
502             designs. On the chest are the letters ~CE~ in purple.",
503         before [;
504           Examine:
505             if (snowsuit hasnt visited) {
506                 score = score + 1;
507                 give snowsuit visited;
508             }
509           Wear:
510             if (snowshoes in player && snowshoes has worn) {
511                 print_ret 
512                     "The snowsuit can't fit over the 
513                     snowshoes.";
514             }
515           Disrobe, Remove:
516             if (snowshoes in player && snowshoes has worn) {
517                 print_ret 
518                     "The snowsuit can't be taken off over the 
519                     snowshoes.";
520             }
521         ],
522         daemon [;
523             if (location ~= mainroom && location ~= office && location ~=
524             kitchenette && location ~= bedroom && location ~= thedark &&
525             snowsuit hasnt worn) {
526                 body_temperature = --body_temperature;
527             }
528             if (location == mainroom || location == office || location ==
529             kitchenette || location == bedroom || snowsuit has worn && body_temperature
530             < 20) {
531                 body_temperature = ++body_temperature;
532             }
533             if (body_temperature == 0) {
534                 deadflag = 4;
535             }
536             if (body_temperature <= 5)
537                 print_ret 
538                     "You're shivering uncontrollably, and it's hard 
539                     to move. You feel very exhausted and drowsy. It's 
540                     all you can do to keep from falling over.";
541             if (body_temperature > 5 && location ~= mainroom && location
542             ~= office && location ~= kitchenette && location ~= bedroom
543             && location ~= thedark && snowsuit hasnt worn) {
544                 switch (body_temperature) {
545                   19:
546                     "The feeling of cold overwhelms you. Surely the 
547                     cold will get to you before anything else does. 
548                     Right?";
549                   18:
550                     "You can feel yourself getting colder and 
551                     colder.";
552                   17:
553                     "You can see your own breath freezing in the air, 
554                     forming little clouds.";
555                   16:
556                     "You shiver in the cold.";
557                   15:
558                     "You continue to shiver in the cold.";
559                   14:
560                     "Your hands grow numb from the cold.";
561                   13:
562                     "You continue shivering in order to keep warm.";
563                   12:
564                     "Your shivering grows worse as your body becomes 
565                     colder by the minute.";
566                   11:
567                     "Your teeth begin to chatter as you desperately 
568                     try to warm yourself up.";
569                   10:
570                     "Your shivering intensifies as your body begins 
571                     to freeze over from the cold.";
572                   9:
573                     "Your fingers become stiff and you feel sharp 
574                     pains all over your body.";
575                   8:
576                     "The cold has gotten to a point where it is too 
577                     much for you. You begin to shiver 
578                     uncontrollably.";
579                   7:
580                     "Your eyesight begins to fade and you can't even 
581                     feel yourself shivering anymore.";
582                   6:
583                     "You can feel your body shutting down from the 
584                     cold as you slowly begin to lose consciousness.";
585                 }
586             }
587         ],
588   has   clothing;
589
590 Object  snowshoes "snowshoes" bedroom
591   with  name 'snowshoe' 'snowshoes' 'snow' 'boot' 'boots' 'shoe' 'shoes'
592         'metal' 'frame',
593   with  description 
594             "They're light blue in color and have a thick, hard 
595             rubber bottom that's attached to a metal frame that keeps 
596             you from sinking into the snow. They look to be warm and 
597             comfortable.",
598         after [;
599           Wear:
600             print_ret (The) self, 
601                 " fit perfectly and go up to your 
602                 knees.";
603         ],
604         daemon [;
605             if (location ~= mainroom && location ~= office && location ~=
606             kitchenette && location ~= bedroom && location ~= thedark &&
607             location ~= eastofcabin && snowshoes hasnt worn) {
608                 deadflag = 3;
609             }
610         ],
611   has   pluralname clothing;
612
613 Object  southofcabin "South Of Cabin"
614   with  description [;
615             print 
616                 "The wind is howling, and there's snow flying 
617                 everywhere. The snow buildup seems to get higher to 
618                 the west. ";
619             if (snowsuit hasnt worn)
620                 print 
621                     "It's really cold and you're not dressed for 
622                     this weather. ";
623             if (frontdoor has open) {
624                 check_for_cabin_lighting();
625             }
626             if (snowshoes has worn && lantern in player && eastofcabin hasnt
627             visited && lantern_fuel_left > 0) {
628                 throw_rock();
629             }
630             print "^";
631         ],
632         n_to frontdoor,
633         s_to forest,
634         e_to eastofcabin,
635         w_to westofcabin,
636   has   light;
637
638 Object  truckspot "Forest"
639   with  description 
640             "The blizzard is still going on. You don't think it's 
641             letting up any time soon. There is a blue and white 
642             pickup truck here. It looks like it got stuck in the snow 
643             and is slowly being covered by it. The windows are iced 
644             up and you can't see inside.",
645         before [;
646           Go:
647             forest_location = forest_location++;
648             PlayerTo(forest, 1);
649         ];
650
651 Object  truck "blue and white pickup truck" truckspot
652   with  name 'pickup' 'truck' 'door' 'doors',
653   with  description 
654             "The blue and white pickup truck looks old and battered. 
655             The paint has chipped and faded. The windows are iced up 
656             and you can't see inside.",
657         before [;
658           Take, Pull, Push, PushDir, Turn:
659             print_ret (The) self, " is too heavy for that.";
660           Search:
661             print_ret 
662                 "The windows are iced up and you can't see 
663                 inside.";
664           Enter, Open, GoIn:
665             print_ret (The) self, " is frozen shut.";
666         ],
667   has   scenery supporter enterable openable;
668
669 Object  backpacklocation "Forest"
670   with  description 
671             "You keep walking and walking. The snowfall is still as 
672             heavy as ever. As you continue trudging through the snow, 
673             you wonder if you're actually moving in the right 
674             direction. You can't see anything through the blizzard. 
675             You wonder if you might be going in circles and end up 
676             wandering around forever, never finding your way out of 
677             this white void. You're unsure of which way to go. The 
678             snowfall is so thick that you can barely see your hand if 
679             you hold it right in front of your face. You have no idea 
680             how far you've come or in what direction.",
681         before [;
682           Go:
683             forest_location = forest_location++;
684             PlayerTo(forest, 1);
685         ];
686
687 Object  backpack "backpack" backpacklocation
688   with  name 'backpack' 'back' 'pack' 'blood',
689   with  description 
690             "The backpack is of medium size, black, with three white 
691             stripes running vertically on the back. The middle stripe 
692             is broken up by a red line running down the center of it 
693             toward the bottom of the backpack. On the side are the 
694             letters ~CE~ in purple. The backpack is covered in blood, 
695             as if the owner met with an untimely demise.",
696         before [;
697           Examine:
698             if (backpack hasnt visited) {
699                 score = score + 1;
700                 give backpack visited;
701             }
702         ],
703   has   clothing container openable;
704
705 Object  flashlight "flashlight" backpack
706   with  name 'flashlight' 'flash' 'light' 'torch',
707         description 
708             "It looks like a cheap red plastic model, about eight 
709             inches long.",
710         before [;
711           SwitchOn:
712             if (flashlight hasnt visited) {
713                 score = score + 1;
714                 give flashlight visited;
715             }
716             give flashlight light;
717           SwitchOff:
718             give lantern ~light;
719         ],
720   has   switchable;
721
722 [ print_forest_description;
723     if (location ~= thedark) {
724         switch (forest_location) {
725           1:
726             print_ret 
727                 "You push on despite the bitter cold and the heavy 
728                 snowfall as you come to a fork. There are two ways to 
729                 go here, one involves a hill to the south. The 
730                 other way is continuing through the woods to the 
731                 north.";
732           2:
733             print_ret 
734                 "The wind is bitterly cold. You plow through the 
735                 snowfall, which is still as heavy as ever. You can 
736                 barely see where you are going, making it hard to 
737                 tell which direction is which. Out of the corner of 
738                 your eye, you spot a tall, shadowy figure lingering 
739                 at the edge of your vision. When you turn to look at 
740                 it directly, however, it disappears. You continue 
741                 walking. The wind is howling louder than ever. The 
742                 endless snowfall makes it difficult to see where 
743                 you're going. You can't tell where the white sky and 
744                 white ground begin and end.";
745           3:
746             PlayerTo(truckspot);
747           4:
748             print_ret 
749                 "You trudge through the snow. The wind is really 
750                 strong and howling like a banshee. You hear a 
751                 horrible howl in the distance or is it the wind? 
752                 Looking around you see nothing in this barren 
753                 landscape but snow. You're not sure what to make of 
754                 it, but you don't want to stick around to find out. 
755                 The whole world is white. You can barely see five 
756                 feet ahead of you. You hope you're going the right 
757                 way. This place is so desolate and barren.";
758           5:
759             print_ret 
760                 "You think you might can see a large figure stepping 
761                 out of the trees and moving in the distance but the 
762                 wind is blowing hard and whipping up massive amounts 
763                 of snow, making it hard to tell for sure. Your breath 
764                 billows out in huge clouds. If it keeps blowing like 
765                 this, you're not sure if you'll ever be able to get 
766                 back. Snow whirls through the air as a gust of wind 
767                 picks up speed. The howling gets louder and more 
768                 intense. There's no left, right, backward or forward. 
769                 There's nothing but endless, unchanging whiteness.";
770           6:
771             PlayerTo(backpacklocation);
772           7:
773             print_ret 
774                 "It feels like you're lost in a maze of snow without 
775                 a map. You keep trudging through the heavy snowfall, 
776                 not knowing if you're even going in any particular 
777                 direction anymore. The wind is really picking up now 
778                 and the snowfall is getting heavier. You have to keep 
779                 going. You can't let the snowstorm get the best of 
780                 you. You can't give up. You must find a way out of 
781                 this frozen wasteland. The snowstorm has made it 
782                 impossible to see anything more than a few feet in 
783                 front of you.";
784           8:
785             print_ret 
786                 "The wind is now a shrieking banshee, freezing and 
787                 relentless, as it throws the snow into your face, 
788                 blinding you. It's hard to walk against the brutal 
789                 winds. You can't see anything, but you must keep 
790                 going. There is no choice. You continue your way 
791                 through the snowy white void, what with the snow 
792                 piling up around you. The wind screams in your ears 
793                 and you can't see anything. Can't go back. Can't go 
794                 forward. You can't even see where you are. You hope 
795                 that, as long as you keep moving, you'll eventually 
796                 find a way out of this frozen wasteland.";
797           9:
798             print_ret 
799                 "The blizzard rages, but you continue to press on. 
800                 There's nothing here but you, the snowfall, and the 
801                 fierce wind howling through this frozen landscape. 
802                 This isn't just a place of cold and ice - it's 
803                 other-worldly. You trudge on and try to keep your 
804                 spirits up and not let the snowstorm get to you. 
805                 Every step is an effort. You wish you had the powers 
806                 of a superhero right now. You can barely see where 
807                 you are going. The wind knocks you down on your hands 
808                 and knees. You get back up, but you're slipping and 
809                 sliding all over the place.";
810           10:
811             print_ret 
812                 "You wander around in the impenetrable white void. 
813                 The wind is howling louder than ever. You try to 
814                 persevere. You don't know if you're going in circles 
815                 or what, but you start to feel that this frozen, 
816                 lifeless landscape is sucking away your very life 
817                 force. You can't see your hand in front of your face. 
818                 You can barely keep moving. Every step you take is 
819                 hard-fought. You just want this awful nightmare to 
820                 end. You begin to feel sleepy but you're in danger 
821                 here. You have to keep moving. Sleep is not an option 
822                 when you're in a place like this.";
823           11:
824             print_ret 
825                 "You try to remember the survival tips you've read 
826                 on the internet, but frankly, you don't remember most 
827                 of them right now. As you walk you try to keep your 
828                 mind occupied with anything other than the storm. 
829                 Nothing makes any sense and you feel like you're 
830                 starting to go in circles. The wind starts starts to 
831                 pick up as it begins howling louder than ever. You're 
832                 determined to live but the blizzard doesn't seem to 
833                 care whether you live or die. It just keeps howling 
834                 and shrieking. It's not getting any easier to move in 
835                 this blizzard.";
836           12:
837             print_ret 
838                 "You keep walking. The snow is drifting and piling 
839                 up around you, making movement almost impossible. You 
840                 look around the barren landscape, but there's nothing 
841                 nearby except snow. It's almost as if you're lost in 
842                 a white, endless void. You start to get disoriented. 
843                 You don't even know if you're walking in a circle or 
844                 not. The situation is looking very grim. Your life 
845                 feels as if it is slowly ebbing away in the 
846                 relentless grip of the snowstorm. It feels like 
847                 you've been wandering for hours, but that's probably 
848                 just your perception of time slipping away.";
849           13:
850             print_ret 
851                 "You can barely see anything, and you stumble 
852                 forward. You could be wandering aimlessly in any 
853                 direction right now and you wouldn't know the 
854                 difference. It's as if you're in a sea of white. 
855                 You're not sure that you're going in the right 
856                 direction but you can't stop now. There has to be 
857                 something here besides endless snow. You know that 
858                 staying here is a death sentence. You have to escape. 
859                 You're cold, tired, miserable, and desperate to get 
860                 out of this mess. You have no idea where you are. You 
861                 keep wandering through endless whiteness. You won't 
862                 give up.";
863           14:
864             print_ret 
865                 "You're so cold that you begin to hallucinate, first 
866                 seeing the words ~Ventilation Control Room~ and then 
867                 yourself at a console. The hallucination quickly 
868                 fades.";
869           15:
870             deadflag = 2;
871             print_ret 
872                 "You see something in the distance but can't make it 
873                 out. You walk toward it to find out that it's the 
874                 hotel. You collapse in the lobby as the hotel staff 
875                 rush over to you.";
876         }
877     }
878 ];
879
880 Object  forest "Forest"
881   with  description [;
882             print_forest_description();
883         ],
884         before [;
885           Go:
886             if (location == thedark) {
887                 DarkToDark();
888             }
889             if (noun == d_obj || noun == u_obj) {
890                 print_ret "You can't go that way.";
891             }
892             forest_location = forest_location++;
893         ],
894         cant_go print_forest_description;
895
896 [ throw_rock;
897     if (television has visited || computer has visited) {
898         print 
899             "The grue is waiting behind a snowbank in
900             the distance, away from the light. ";
901     }
902     print 
903         "From somewhere off in the dark distance, far away from the 
904         light, a rock is hurled in your direction. It hits the 
905         lantern, breaking it, and putting it out of commission. ";
906     give lantern ~on;
907     give lantern ~light;
908     lantern_fuel_left = 0;
909     StopDaemon(lantern);
910     score = score - 1;
911 ];
912
913 [ check_for_cabin_lighting;
914     if (lightbulb has on) {
915         print 
916             "The light from inside the cabin only penetrates a few 
917             feet from the building. ";
918     }
919     else
920         if (lantern in player && lantern has on) {
921             print 
922                 "The lantern provides the only source of 
923                 light. ";
924         }
925     if (location has light)
926         print 
927             "The snow stings your face and you can barely see three 
928             feet in front of you. ";
929     if (snowshoes in player && snowshoes has worn) {
930         print 
931             "The snowshoes are doing their job by making sure 
932             you don't sink into the snow. ";
933     }
934 ];
935
936 Object  eastofcabin "East Of Cabin"
937   with  description [;
938             print "It's dark outside. ";
939             check_for_cabin_lighting();
940             if (cabin_has_electricity == 1 && lantern in player && lantern_fuel_left
941             > 0) {
942                 throw_rock();
943             }
944             print "^";
945         ],
946         w_to window,
947         s_to southofcabin,
948         cant_go 
949             "The snow buildup is is too great to continue in that 
950             direction.",
951   has   light;
952
953 Object  roof "Roof"
954   with  description [;
955             print 
956                 "You're on the roof of the cabin, although it's hard 
957                 to tell where the snow buildup ends and the roof 
958                 begins. You can make out the trees around the cabin, 
959                 but you can't see very far out into the snowfield 
960                 beyond them.";
961             if (roof hasnt visited)
962                 print 
963                     " You hear a snowmobile approaching in the 
964                     distance. Is it your salvation? The snowmobile 
965                     quickly zooms by in front of the cabin and 
966                     disappears into the forest.";
967             StartDaemon(snowmobile);
968             if (roof has visited)
969                 print 
970                     " There seems to be no movement, no sound, no 
971                     sign of anything.";
972             new_line;
973         ],
974         n_to northofcabin,
975         cant_go "Walking off the edge of a roof seems unwise.";
976
977 Object  northofcabin "North Of Cabin"
978   with  description [;
979             print 
980                 "You're on the north side of the cabin. The wind is 
981                 howling and the snow is coming down; falling too fast 
982                 to see well.";
983             if (northofcabin hasnt visited)
984                 print 
985                     " That might be a tree in the distance or a 
986                     shadowy figure - It's hard to tell in this 
987                     storm.";
988             print_ret 
989                 " The snow buildup here is so great that it's 
990                 almost level with the cabin's roof, which is to the 
991                 south.";
992         ],
993         n_to westofcabin,
994         s_to roof,
995         w_to westofcabin,
996         cant_go "It's too steep to go in that direction safely.",
997         before [;
998           Go:
999             if (noun == s_obj) {
1000                 if (roof hasnt visited) {
1001                     score = score + 1;
1002                 }
1003             }
1004         ];
1005
1006 Object  westofcabin "West Of Cabin"
1007   with  description [;
1008             print 
1009                 "The snow is falling so fast that you can barely see 
1010                 anything. You can't even be sure you're going in the 
1011                 right direction.";
1012             if (westofcabin hasnt visited)
1013                 print 
1014                     " Then you hear a shuffling noise in the snow. 
1015                     There was something there and now it's gone. Or 
1016                     was it always there and you just never saw it?";
1017             print_ret " The snow buildup gets taller to the north.";
1018         ],
1019         s_to southofcabin,
1020         n_to northofcabin,
1021         cant_go 
1022             "The snow buildup is is too great to continue in that 
1023             direction.";
1024
1025 [ Initialise;
1026     Location = mainroom;
1027     thedark.description = 
1028         "It is pitch black. You are likely to be eaten 
1029         by a grue.";
1030     print 
1031         "You're trapped in a snowstorm while visiting the forest 
1032         during your vacation to a small rural town. This is the worst 
1033         snowstorm in more than 40 years. If only you had listened to 
1034         the news. Well, it's too late for that. The snow has been 
1035         falling for the past seven hours and shows no signs of 
1036         stopping any time soon. You need to get back to your hotel in 
1037         the town. You finally manage to find an old cabin in the 
1038         woods and get inside but have no idea where you are. You're 
1039         not dressed for this weather, and it's getting dark 
1040         outside.^";
1041     StartDaemon(lantern);
1042     StartDaemon(snowshoes);
1043     StartDaemon(snowsuit);
1044     StartDaemon(grue);
1045 ];
1046
1047 [ DeathMessage;
1048     if (deadflag == 3)
1049         print "You sink into the deep snow and are unable to move.";
1050     if (deadflag == 4)
1051         print 
1052             "Finally, you succumb to the cold. Your mind goes blank as 
1053             you slip away into the endless darkness and the deep sleep 
1054             of death.";
1055 ];
1056
1057 ! Don't have 'take all' take the lightbulb in the mainroom of the 
1058 ! cabin
1059
1060 [ ChooseObjects obj code;
1061     if (code < 2) {
1062         if (obj has scenery)
1063             return 2;
1064         rfalse;
1065     }
1066     if (obj == lightbulb)
1067         return 0;
1068 ];
1069
1070 [ InScope;
1071     if (location == thedark && real_location == mainroom) {
1072         PlaceInScope(lightsocket);
1073         PlaceInScope(lightbulb);
1074     }
1075     return false;
1076 ];
1077
1078 Object  cabin "cabin" mainroom
1079   with  name 'cabin',
1080         found_in mainroom bedroom office kitchenette southofcabin eastofcabin
1081         northofcabin westofcabin,
1082         before [;
1083           Enter, Exit:
1084             print_ret 
1085                 "You'll have to say which compass direction to go 
1086                 in.";
1087         ],
1088   has   scenery;
1089
1090 Object  snowmobile "snowmobile" thedark
1091   with  name 'snowmobile',
1092         daemon [;
1093             snowmobile_location = random(14);
1094             if (location == forest && forest_location == snowmobile_location)
1095             {
1096                 deadflag = 2;
1097                 print_ret 
1098                     "A snowmobile approaches. The person says they 
1099                     saw your light and came to rescue you.";
1100             }
1101             return true;
1102         ],
1103   has   scenery;
1104
1105 Object  grue "grue" thedark
1106   with  article "the",
1107         name 'grue' 'monster',
1108         grue_active_around_cabin,
1109         grue_active_in_the_dark,
1110         daemon [;
1111             if (location == thedark) {
1112                 switch (++(self.grue_active_in_the_dark)) {
1113                   1:
1114                     "^You hear horrible gurgling sounds in the 
1115                     dark.";
1116                   2:
1117                     "^You hear the clink of razor-sharp claws 
1118                     nearby.";
1119                   3:
1120                     deadflag = 1;
1121                     "^Your last memory is of the slavering fangs of 
1122                     the horrible Grue as it claims you for a meal.";
1123                 }
1124             }
1125             if (location == mainroom || location == office || location ==
1126             kitchenette || location == bedroom) {
1127                 switch (++(self.grue_active_around_cabin)) {
1128                   1:
1129                     "^You hear the wind howling outside, if it is the 
1130                     wind.";
1131                   2:
1132                     "^You hear horrible gurgling sounds outside.";
1133                   3:
1134                     "^The noise outside gets louder.";
1135                   4:
1136                     "^You hear the sound of shuffling feet outside.";
1137                   5:
1138                     "^You hear something sniffing around the cabin.";
1139                   6:
1140                     "^You hear a deep guttural sound from outside 
1141                     that sends a chill down your spine.";
1142                   7:
1143                     "^You hear something scratching on the cabin 
1144                     walls from outside.";
1145                   8:
1146                     "^You hear something howl outside. It's a 
1147                     chilling, mournful wail that sends a chill down 
1148                     your spine.";
1149                   9:
1150                     "^A thunderous CRACK can be heard coming from 
1151                     outside.";
1152                   10:
1153                     "^There's a sudden crashing sound as something is 
1154                     thrown against the cabin walls.";
1155                   11:
1156                     "^Something begins to beat against the walls of 
1157                     the cabin, as if trying to to break in. It makes a 
1158                     loud, thunderous noise.";
1159                   12:
1160                     "^The wind is howling and the walls are being 
1161                     beaten so hard it feels like the cabin is 
1162                     shaking.";
1163                   13:
1164                     "^Suddenly, there's ominous silence from outside 
1165                     the cabin.";
1166                 }
1167             }
1168             if (location == mainroom || location == office || location ==
1169             kitchenette || location == bedroom && self.grue_active_around_cabin
1170             == 15) {
1171                 print "^The lights flicker and suddenly go out.^";
1172                 cabin_has_electricity = 0;
1173                 give lightbulb ~on;
1174                 give mainroom ~light;
1175                 give office ~light;
1176                 give kitchenette ~light;
1177                 give bedroom ~light;
1178                 give eastofcabin ~light;
1179                 give southofcabin ~light;
1180             }
1181             return true;
1182         ],
1183   has   scenery;
1184
1185 [ DarkToDark;
1186     deadflag = 1;
1187     "Oh, no! You have walked into the slavering fangs of a lurking 
1188     grue!";
1189 ];
1190
1191 [ PrintRank;
1192     print ", earning you the rank of ";
1193     if (score == 0)
1194         "Novice.";
1195     if (score == 1)
1196         "Trained.";
1197     if (score == 2)
1198         "Skilled.";
1199     if (score == 3)
1200         "Talented.";
1201     if (score == 4)
1202         "Capable.";
1203     if (score == 5)
1204         "Adept.";
1205     if (score == 6)
1206         "Proficient.";
1207     if (score >= 7)
1208         print "Versed.";
1209 ];
1210
1211 [ URL;
1212     print 
1213         "^If you need help try some of the commands from: 
1214         ^https://pr-if.org/doc/play-if-card/^";
1215 ];
1216
1217 [ XyzzySub;
1218     print "Nothing obvious happens.^";
1219     return true;
1220 ];
1221
1222 [ HelpSub;
1223     URL();
1224     return true;
1225 ];
1226
1227 [ TearSub;
1228     print_ret "Doing that would achieve little.";
1229 ];
1230
1231 Include "grammar";
1232
1233 Verb 'About'
1234     * -> Version;
1235
1236 Verb 'Info'
1237     * -> Version;
1238
1239 Verb 'Help'
1240     * -> Help;
1241
1242 Verb 'Clue'
1243     * -> Help;
1244
1245 Verb 'Hint'
1246     * -> Help;
1247
1248 Verb 'xyzzy'
1249     * -> Xyzzy;
1250
1251 Verb 'tear'
1252     * noun -> Tear;
1253
1254 Extend 'tear'
1255     * 'up' / 'open' noun -> Tear;
1256
1257 Verb 'rip'
1258     * noun -> Tear;
1259
1260 Extend 'rip'
1261     * 'up' / 'open' noun -> Tear;
1262
1263 Verb 'crawl'
1264     * 'through' / 'out' / 'via' noun -> Enter;
1265
1266 Verb 'escape'
1267     * 'through' / 'out' / 'via' noun -> Enter;
1268
1269 Extend 'jump'
1270     * 'through' / 'out' / 'via' noun -> Enter;
1271
1272 Extend 'climb'
1273     * 'through' / 'out' / 'via' noun -> Climb;
1274
1275 Extend 'go'
1276     * 'through' / 'out' / 'via' noun -> Enter;
1277
1278 Extend 'go' first
1279     * 'out' / 'outside' -> VagueGo;
1280
1281 Extend 'go' first
1282     * 'out' / 'outside' / 'outside' 'of' noun -> VagueGo;
1283
1284 Extend 'go' first
1285     * 'in' / 'into' / 'inside' -> VagueGo;
1286
1287 Extend 'go' first
1288     * 'in' / 'into' / 'inside' / 'inside' 'of' noun -> VagueGo;
1289
1290 Extend 'exit' first
1291     * noun -> VagueGo;
1292
1293 Extend 'leave' first
1294     * noun -> VagueGo;