Beispiel #1
0
        private static void CombatEvent(UFO ship)
        {
            Console.WriteLine("Dang, they've brought a tank!");

            while (!ship.Destroyed && ship.EngagedInCombat)
            {
                Console.WriteLine("Will you use the LASERS or the CANNON ?");
                switch (Console.ReadLine().ToLower())
                {
                case "cannon":
                    ship.Attack(3);
                    break;

                case "lasers":
                    ship.Attack(1, 5);
                    Console.Beep();
                    break;

                default:
                    Console.WriteLine("You don't have a weapon like that!");
                    continue;
                }

                if (ship.TankHealth > 0)
                {
                    ship.TakeDamage();
                    Console.WriteLine("The tank shot you back!");
                    if (ship.ShipHealth == 7)
                    {
                        Console.WriteLine("You're losing your armor!");
                    }
                    if (ship.ShipHealth == 4)
                    {
                        Console.WriteLine("The ship isn't looking good!");
                    }
                    if (ship.ShipHealth == 1)
                    {
                        Console.WriteLine("One more hit and you're done for!");
                    }
                }
                else
                {
                    Console.WriteLine("You've destroyed the tank! Time to move on!");
                    ship.destroyHumans();
                }
            }
        }