Exemplo n.º 1
0
        protected bool Count(int i)
        {
            if (feeFieCount != i)
            {
                feeFieCount = 0;
                return(Print("Get it right, dummy!"));
            }

            if (feeFieCount++ == 3)
            {
                feeFieCount = 0;

                var insideBuilding = Rooms.Get <InsideBuilding>();
                var giantRoom      = Rooms.Get <GiantRoom>();
                var eggs           = Objects.Get <GoldenEggs>();

                if (giantRoom.Contains(eggs))
                {
                    return(Print("Nothing happens."));
                }

                if (Inventory.Contains(eggs) || eggs.InRoom)
                {
                    Print("The nest of golden eggs has vanished!\n");
                }
                else
                {
                    Print("Done!");
                }

                if (Inventory.Contains(eggs))
                {
                    Score.Add(-5);
                }

                if (insideBuilding.Contains(eggs))
                {
                    Score.Add(-eggs.DepositPoints);
                }

                Move <GoldenEggs> .To <GiantRoom>();

                if (CurrentRoom.Is <GiantRoom>())
                {
                    Print("\n\nA large nest full of golden eggs suddenly appears out of nowhere!");
                }
            }
            else
            {
                Print("Ok.");
            }

            return(true);
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            Name = "rickety bridge";
            Synonyms.Are("bridge", "rickety", "unstable", "wobbly", "rope");
            Description = "It just looks like an ordinary, but unstable, bridge.";
            Open        = true;

            FoundIn <SwSideOfChasm, NeSideOfChasm>();

            Describe = () =>
            {
                var result =
                    "A rickety wooden bridge extends across the chasm, vanishing into the mist. " +
                    "\n\nA sign posted on the bridge reads, \"Stop! Pay troll!\"\n";

                var troll = Get <BurlyTroll>();

                if (!troll.InRoom)
                {
                    result += "The troll is nowhere to be seen.";
                }

                return(result);
            };

            DoorDirection(() =>
            {
                if (CurrentRoom.Is <SwSideOfChasm>())
                {
                    return(Direction <Northeast>());
                }

                return(Direction <Southwest>());
            });

            DoorTo(() =>
            {
                if (CurrentRoom.Is <SwSideOfChasm>())
                {
                    return(Rooms.Get <NeSideOfChasm>());
                }

                return(Rooms.Get <SwSideOfChasm>());
            });
        }
Exemplo n.º 3
0
        public override void Initialize()
        {
            Name = "black rod with a rusty star on the end";
            Synonyms.Are("rod", "star", "black", "rusty", "star", "three", "foot", "iron");
            Description        = "It's a three foot black rod with a rusty star on an end.";
            InitialDescription = "A three foot black rod with a rusty star on one end lies nearby.";

            Before <Wave>(() =>
            {
                var westSideOfFissure = Rooms.Get <WestSideOfFissure>();
                var eastBankOfFissure = Rooms.Get <EastBankOfFissure>();

                if (CurrentRoom.Is <WestSideOfFissure>() || CurrentRoom.Is <EastBankOfFissure>())
                {
                    // TODO: caves closed
                    // if (caves_closed) "Peculiar. Nothing happens.";

                    if (CurrentRoom.Has <CrystalBridge>())
                    {
                        Room <WestSideOfFissure>().BridgeDisappears();
                        Room <EastBankOfFissure>().BridgeDisappears();
                        Print("The crystal bridge has vanished!");
                    }
                    else
                    {
                        Room <WestSideOfFissure>().BridgeAppears();
                        Room <EastBankOfFissure>().BridgeAppears();
                        Print("A crystal bridge now spans the fissure.");
                    }

                    return(true);
                }

                Print("Nothing happens.");

                return(true);
            });
        }
Exemplo n.º 4
0
        public override void Initialize()
        {
            Name = "threatening little dwarf";
            Synonyms.Are("dwarf", "threatening", "nasty", "little", "mean");
            Description        = "It's probably not a good idea to get too close. Suffice it to say the little guy's pretty aggressive.";
            InitialDescription = "A threatening little dwarf hides in the shadows.";
            Animate            = true;

            Before <Attack>(() => "Not with your bare hands. No way.");

            Before <Kick>(() => "You boot the dwarf across the room. He curses, then gets up and brushes himself off. Now he's madder than ever!");

            Before <Give>(Give);

            Before <ThrowAt>(() =>
            {
                if (Noun is Axe)
                {
                    if (Random.Number(1, 3) != 1)
                    {
                        Remove();
                        Noun.MoveToLocation();
                        number--;
                        return(Print("You killed a little dwarf! The body vanishes in a cloud of greasy black smoke."));
                    }

                    Noun.MoveToLocation();

                    return(Print("Missed! The little dwarf dodges out of the way of the axe."));
                }

                return(Give());
            });

            Daemon = () =>
            {
                if (CurrentRoom.Is <Darkness>())
                {
                    return;
                }

                if (number == 0)
                {
                    DaemonStarted = false;
                    return;
                }

                var location = Location;

                if (location == null)
                {
                    var room = CurrentRoom.Location;

                    if (((BelowGround)room).NoDwarf || room.Light)
                    {
                        return;
                    }

                    if (Random.Number(1, 100) <= number)
                    {
                        var bear  = Get <Bear>();
                        var troll = Get <BurlyTroll>();

                        if (IsHere <Bear>() || IsHere <BurlyTroll>())
                        {
                            return;
                        }

                        Print("\n");

                        if (IsHere <Dragon>())
                        {
                            number--;
                            Print("A dwarf appears, but with one casual blast the dragon vapourises him!");
                            return;
                        }

                        MoveToLocation();
                        Print("A threatening little dwarf comes out of the shadows!");
                    }

                    return;
                }

                if (location != CurrentRoom.Location)
                {
                    if (location is Darkness)
                    {
                        return;
                    }

                    if (((BelowGround)location).NoDwarf || location.Light)
                    {
                        return;
                    }

                    if (Random.Number(1, 100) <= 96 && location is not MirrorCanyon)
                    {
                        MoveToLocation();
                        Print("\nThe dwarf stalks after you...\n");
                    }
                    else
                    {
                        Remove();
                    }

                    return;
                }

                if (Random.Number(1, 100) < 75)
                {
                    Print("\n");

                    if (!hasThrownAxe)
                    {
                        var axe = Get <Axe>();
                        hasThrownAxe = true;
                        axe.MoveToLocation();
                        Remove();
                        Print("The dwarf throws a nasty little axe at you, misses, curses, and runs away.");
                        return;
                    }

                    if (location is MirrorCanyon)
                    {
                        Print("The dwarf admires himself in the mirror.");
                        return;
                    }

                    var throws = "The dwarf throws a nasty little knife at you, ";

                    if (Random.Number(1, 1000) < 95)
                    {
                        Print($"{throws} and hits!");
                        GameOver.Dead();
                        return;
                    }

                    Print($"{throws} but misses!");
                    return;
                }

                if (Random.Number(1, 3) == 1)
                {
                    Remove();
                    Print("\nTiring of this, the dwarf slips away.");
                }
            };
        }
Exemplo n.º 5
0
        public override void Initialize()
        {
            Name = "giant clam";
            Synonyms.Are("giant", "clam", "oyster", "bivalve");

            Describe = () =>
            {
                if (HasBeenOpened)
                {
                    return("There is an enormous oyster here with its shell tightly closed.");
                }

                return("There is an enormous clam here with its shell tightly closed.");
            };

            FoundIn <ShellRoom>();

            Before <Attack>(() => "The shell is very strong and is impervious to attack.");

            Before <Open>(() => "You aren't strong enough to open the clam with your bare hands.");

            Before <Examine>(() =>
            {
                if (CurrentRoom.Is <NeEnd>() || CurrentRoom.Is <SwEnd>())
                {
                    return
                    ("Interesting. " +
                     "There seems to be something written on the underside of the oyster: " +
                     "\n\n " +
                     "\"There is something strange about this place, " +
                     "such that one of the curses I've always known now has a new effect.\"");
                }

                return("A giant bivalve of some kind.");
            });

            Before <Unlock>(() =>
            {
                if (!(Second is JeweledTrident))
                {
                    return(Print($"The {Second.Name} isn't strong enough to open the clam."));
                }

                if (!HasBeenOpened)
                {
                    Print("The oyster creaks open, revealing nothing but oyster inside. It promptly snaps shut again.");

                    HasBeenOpened = true;

                    Move <GlisteningPearl> .To <CulDeSac>();

                    Print(
                        "A glistening pearl falls out of the clam and rolls away. " +
                        "Goodness, this must really be an oyster. " +
                        "(I never was very good at identifying bivalves.) " +
                        "Whatever it is, it has now snapped shut again."
                        );

                    return(true);
                }

                return(false);
            });
        }
Exemplo n.º 6
0
        public override void Initialize()
        {
            Name = "large cave bear";
            Synonyms.Are("bear", "large", "tame", "ferocious", "cave");
            Animate = true;

            FoundIn <BarrenRoom>();

            Describe = () =>
            {
                if (IsFollowingYou)
                {
                    return("You are being followed by a very large, tame bear.");
                }

                if (!IsFriendly)
                {
                    return("There is a ferocious cave bear eyeing you from the far end of the room!");
                }

                if (In <BarrenRoom>())
                {
                    return("There is a gentle cave bear sitting placidly in one corner.");
                }

                return("There is a contented-looking bear wandering about nearby.");
            };

            Before <Attack>(() =>
            {
                if (IsCarrying <Axe>())
                {
                    return(ThrowAt(Noun));
                }

                if (IsFriendly)
                {
                    return(Print("The bear is confused; he only wants to be your friend."));
                }

                return(Print("With what? Your bare hands? Against *his* bear hands??"));
            });

            Before <ThrowAt>(() => ThrowAt(Noun));

            Before <Give>(() => Give(Noun));

            Before <Order, Ask, Answer>(() => Print("This is a Bear of very little brain."));

            Before <Examine>(() =>
            {
                const string large = "The bear is extremely large, ";

                if (IsFriendly)
                {
                    return(Print($"{large}, but appears to be friendly."));
                }

                return(Print($"{large}, and seems quite ferocious!"));
            });

            Before <Take, Catch>(() =>
            {
                var chain = Get <GoldenChain>();

                if (!IsFriendly)
                {
                    return(Print("Surely you're joking!"));
                }

                if (chain.Locked)
                {
                    return(Print("The bear is still chained to the wall."));
                }

                IsFollowingYou = true;
                DaemonStarted  = true;

                return(Print("Ok, the bear's now following you around."));
            });

            Before <Drop, Release>(() =>
            {
                if (!IsFollowingYou)
                {
                    return(Print("What?"));
                }

                IsFollowingYou = false;
                DaemonStarted  = false;

                var troll = Get <BurlyTroll>();

                if (troll.InRoom)
                {
                    troll.Remove();
                    return(Print("The bear lumbers toward the troll, who lets out a startled shriek and scurries away. " +
                                 "The bear soon gives up the pursuit and wanders back."));
                }

                return(Print("The bear wanders away from you."));
            });

            Daemon = () =>
            {
                var bear = Get <Bear>();

                if (CurrentRoom.Location is Darkness)
                {
                    return;
                }

                if (bear.InRoom)
                {
                    if (CurrentRoom.Is <BreathtakingView>())
                    {
                        Print("\nThe bear roars with delight.");
                    }

                    return;
                }

                bear.MoveToLocation();

                Print("\nThe bear lumbers along behind you.");
            };
        }