Exemplo n.º 1
0
        public override void Initialize()
        {
            Name = "stream";
            Synonyms.Are("stream", "water", "brook", "river", "lake", "small", "tumbling",
                         "splashing", "babbling", "rushing", "reservoir");

            //TODO: FoundIn<InPit>();
            //TODO: FoundIn<InCavernWithWaterfall>();
            //TODO: FoundIn<AtReservoir>();

            Before <Drink>(() =>
            {
                Print("You have taken a drink from the stream. " +
                      "The water tastes strongly of minerals, but is not unpleasant. " +
                      "It is extremely cold.");
                return(true);
            });

            Before <Take>(() =>
            {
                var bottle = Objects.Get <Bottle>();
                if (!bottle.InInventory)
                {
                    Print("You have nothing in which to carry the water.");
                }
                else
                {
                    bottle.Fill();
                }
                return(true);
            });


            Before <Receive>(() =>
            {
                if (Noun.Is <Bottle>())
                {
                    var bottle = Objects.Get <Bottle>();
                    bottle.Fill();
                    return(true);
                }

                return(false);
            });
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            Name        = "Inside Building";
            Description = "You are inside a building, a well house for a large spring.";
            CantGo      = "The stream flows out through a pair of 1 foot diameter sewer pipes. The only exit is to the west.";

            WestTo <EndOfRoad>();
            OutTo <EndOfRoad>();


            Has <SetOfKeys>();
            Has <TastyFood>();
            Has <BrassLantern>();
            Has <Bottle>();
            Has <Stream>();
            Has <WellHouse>();
            Has <Spring>();
            Has <SewerPipes>();

            Before <Enter>(() =>
            {
                if (Noun.Is <Spring>() || Noun.Is <SewerPipes>())
                {
                    Print("The stream flows out through a pair of 1 foot diameter sewer pipes. " +
                          "It would be advisable to use the exit.");
                    return(true);
                }

                return(false);
            });

            Before <Xyzzy>(() =>
            {
                var debrisRoom = Room <DebrisRoom>();

                if (debrisRoom.Visited)
                {
                    L.MovePlayerTo <DebrisRoom>();
                    return(false);
                }

                Print(L.DoNotUnderstand);
                return(true);
            });
        }
Exemplo n.º 3
0
        public override void Initialize()
        {
            Name = "small bottle";
            Synonyms.Are("bottle", "jar", "flask");
            IsOpen             = true;
            InitialDescription = "There is an empty bottle here.";
            Article            = "the";

            Before <Fill>(() =>
            {
                Fill();
                return(true);
            }
                          );

            Before <Empty>(() =>
            {
                if (IsEmpty)
                {
                    Print("The bottle is already empty!");
                }
                else
                {
                    Empty();
                    Print("Your bottle is now empty and the ground is now wet.");
                }

                return(true);
            }
                           );

            Before <Receive>(() =>
            {
                if (Noun.Is <Stream>() || Noun.Is <Oil>())
                {
                    Execute("fill bottle");
                }
                else
                {
                    Print("The bottle is only supposed to hold liquids.");
                }
                return(true);
            });
        }
Exemplo n.º 4
0
        public override void Initialize()
        {
            Name = "At Top of Small Pit";
            Synonyms.Are("top", "of", "small", "pit");
            Description =
                "At your feet is a small pit breathing traces of white mist. " +
                "A west passage ends here except for a small crack leading on.\n\n" +
                "Rough stone steps lead down the pit.";

            EastTo <BirdChamber>();

            WestTo(() =>
            {
                Print("That crack is far too small for you to follow.");
                return(this);
            });

            DownTo(() =>
            {
                if (Player.Has <LargeGoldNugget>())
                {
                    //deadflag = 1;
                    Print("You are at the bottom of the pit with a broken neck.");
                    return(null);
                }

                return(null);    // HallOfMists
            });

            Before <Enter>(() =>
            {
                if (Noun.Is <PitCrack>())
                {
                    Print("The crack is far too small for you to follow.");
                    return(true);
                }

                return(false);
            });

            Has <SmallPit>();
            Has <PitCrack>();
            Has <Mist>();
        }
Exemplo n.º 5
0
        public override void Initialize()
        {
            Name = "brass lantern";
            Synonyms.Are("lamp", "headlamp", "headlight", "lantern", "light", "shiny", "brass");
            IsOn           = false;
            IsSwitchable   = true;
            DaemonStarted  = true;
            PowerRemaining = 330;

            Describe = () =>
            {
                if (IsOn)
                {
                    return("Your lamp is here, gleaming brightly.");
                }
                return("There is a shiny brass lamp nearby.");
            };

            Daemon = () =>
            {
                if (!IsOn)
                {
                    DaemonStarted = false;
                    return;
                }

                int t = PowerRemaining - 1;
                if (t == 0)
                {
                    HasLight = false;
                    IsOn     = false;
                }

                if (InScope)
                {
                    string result = null;

                    if (t == 0)
                    {
                        result = "Your lamp has run out of power. ";
                        if (freshBatteries.InInventory && !Location.HasLight)
                        {
                            // deadflag = 3;
                            result += "You can't explore the cave without a lamp. So let's call it a day.";
                            Print(result);
                        }
                        else
                        {
                            result += ReplaceBatteries();
                            Print("\n");
                        }

                        Print(result);
                    }

                    if (t == 30)
                    {
                        result = "Your lamp is getting dim.";
                        if (freshBatteries.HaveBeenUsed)
                        {
                            result += " You're also out of spare batteries. You'd best start wrapping this up.";
                        }

//                    if (fresh_batteries in VendingMachine && Dead_End_14 has visited)
//                        " You'd best start wrapping this up,
//                         unless you can find some fresh batteries.
//                         I seem to recall there's a vending machine in the maze.
//                         Bring some coins with you.";
//                    if (fresh_batteries notin VendingMachine or player or location)
//                        " You'd best go back for those batteries.";
//                    new_line;
//                    rtrue;
                    }
                }
            };

            Before <Examine>(() =>
            {
                string result = "It is a shiny brass lamp";
                if (!IsOn)
                {
                    result += ". It is not currently lit.";
                }
                else if (PowerRemaining < 30)
                {
                    result += ", glowing dimly.";
                }
                else
                {
                    result += ", glowing brightly.";
                }
                Print(result);
                return(true);
            });

            Before <Rub>(() =>
            {
                Print("Rubbing the electric lamp is not particularly rewarding. Anyway, nothing exciting happens.");
                return(true);
            });

            Before <Receive>(() =>
            {
                if (Noun.Is <OldBatteries>())
                {
                    Print("Those batteries are dead; they won't do any good at all.");
                }
                else if (Noun.Is <FreshBatteries>())
                {
                    Print(ReplaceBatteries());
                }
                else
                {
                    Print("The only thing you might successfully put in the lamp is a fresh pair of batteries.");
                }
                return(true);
            });

            Before <SwitchOn>(() =>
            {
                if (PowerRemaining <= 0)
                {
                    Print("Unfortunately, the batteries seem to be dead.");
                    return(true);
                }
                return(false);
            });

            After <SwitchOn>(() =>
            {
                HasLight      = true;
                DaemonStarted = true;
                return(false);
            });

            After <SwitchOff>(() =>
            {
                HasLight = false;
                return(false);
            });
        }