Beispiel #1
0
        private static void MakeNextMove(UFO ship)
        {
            Console.WriteLine("You'll need to abduct " + (ship.AbductionQuota - ship.CowsAbducted) + " cows before you can head home.");
            Console.WriteLine("Where do you want to look for cows? The FIELD, FOREST, QUARRY, CITY, or MOUNTAIN?");

            Dictionary <string, Action> places = new Dictionary <string, Action>()
            {
                { "field", () => ship.AbductionEvent(10, 5) },
                { "forest", () => ship.AbductionEvent(6, 8) },
                { "city", () => ship.AbductionEvent(4, 3) },
                { "quarry", () => ship.AbductionEvent(4, 10) },
                { "mountain", () => ship.AbductionEvent(2, 15) },
            };

            string command = Console.ReadLine().ToLower();

            if (places.ContainsKey(command))
            {
                places[command].Invoke();
                Console.WriteLine("You've found " + ship.NumberAbducted + " cows!");
            }
            else
            {
                Console.WriteLine("There's no place like that around here");
            }

            while (ship.EngagedInCombat)
            {
                CombatEvent(ship);
            }
        }