Beispiel #1
0
        public override void Initialize()
        {
            Name = "dragon";
            Synonyms.Are("monster", "beast", "lizard", "huge", "green", "fierce", "scaly", "giant", "ferocious");
            Description        = "I wouldn't mess with it if I were you.";
            InitialDescription = "A huge green fierce dragon bars the way!";
            Animate            = true;

            FoundIn <SecretCanyon>();

            Before <Attack>(() =>
            {
                IsBeingAttacked = true;
                Print("With what? Your bare hands?");
                return(true);
            });

            Before <Give>(() =>
            {
                Print("The dragon is implacable.");
                return(true);
            });

            Before <ThrowAt>(() =>
            {
                if (Noun is Axe)
                {
                    Noun.MoveToLocation();
                    Print("The axe bounces harmlessly off the dragon's thick scales.");
                }
                else
                {
                    Print("You'd probably be better off using your bare hands than that thing!");
                }

                return(true);
            });
        }
Beispiel #2
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.");
                }
            };
        }