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