Пример #1
0
        override public void displayEncounter(Monster monster, String message)
        {
            Player player = fEngine.getCurrentPlayer();
            String str    = "";

            if (monster.isAlive())
            {
                str = monster.getEncounterDescription(player.isAlive());
            }
            else
            {
                Utility.Assert(monster is Dragon, "Console.displayEncounter - monster is Dragon");
                str  = "The Dragon rushes at you...\n";
                str += "But before it had time to roast you, you slew it with a fierceful swing with the mighty Sword\n";
                str += "You are now a DRAGON-SLAYER.";
            }
            if (message.Length > 0)
            {
                str += "\r\n" + message;
            }
            System.Console.WriteLine(str);
            fEngine.doEncounters();
        }
Пример #2
0
        override public void displayKill(Monster[] monsters, Room room, Staff staff, bool splinter)
        {
            fShotsFired++;
            bool magic = false;

            if (staff != null)
            {
                magic = true;
            }
            Player player = fEngine.getCurrentPlayer();
            String str    = "";

            if (player.fRoom == room)
            {
                if (magic)
                {
                    str = "You fire a lightning bolt with your " + Staff.TYPE_STRING[staff.getType()] + " staff!\n";
                }
            }
            else
            {
                if (magic)
                {
                    str = "You fire a lightning bolt to cavern " + room.getRoomNumber() + ".\n";
                }
                else
                {
                    str = "You fire an arrow to cavern " + room.getRoomNumber() + ".\n";
                }
            }

            if (splinter)
            {
                str += "Your " + Staff.TYPE_STRING[staff.getType()] + " staff splintered!\n";
                if (fShooting)
                {
                    fShotsFired = player.getNumBolts();
                }
                else
                {
                    fShotsFired = player.getNumBalls();
                }
                int damage = GameEngine.rand.range(0, 2);
                player.applyDamage(damage);
                if (!player.isAlive())
                {
                    str += "\nYou're dead.\n";
                }
                player.makeNoise(Player.kFightNoise);
            }

            if (monsters.Length == 0)
            {
                str += "That wasn't very clever, was it?";
            }

            for (int i = 0; i < monsters.Length; i++)
            {
                Monster monster = monsters[i];
                if (monster.isAlive())
                {
                    str += "You wounded ";
                }
                else
                {
                    str += "You killed ";
                }
                str += monster.getMonsterDescription() + "\n";
            }
            System.Console.WriteLine(str);

            if (fShooting)
            {
                if (fEngine.hasAdjacentMonster(player.fRoom))
                {
                    if (!magic && fShotsFired < player.getMaxNumShots() && player.fArrows > 0)
                    {
                        fEngine.doCommandShootArrow();
                        return;
                    }
                    if (magic && fShotsFired < player.getNumBolts() && player.hasChargedStaff())
                    {
                        fEngine.doCommandCastLightningBolt();
                        return;
                    }
                }
            }
            else
            {
                if (fEngine.hasMonster(player.fRoom))
                {
                    if (magic && fShotsFired < player.getNumBalls() && player.hasChargedStaff())
                    {
                        fEngine.doCommandCastFireball();
                        return;
                    }
                }
            }

            fEngine.processNextPlayer();
        }