Exemple #1
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();
        }