Exemplo n.º 1
0
        /// <summary>
        /// Gets the military branch for the user's next attack.
        /// </summary>
        public static MilitaryBranch GetAttackBranch(WarState state, bool isFirstTurn)
        {
            if (isFirstTurn)
            {
                View.PromptFirstAttackBranch();
            }
            else
            {
                View.PromptNextAttackBranch(state.ComputerForces, state.PlayerForces);
            }

            // If the user entered an invalid branch number in the original
            // game, the code fell through to the army case.  We'll preserve
            // that behaviour here.
            return(Console.ReadLine() switch
            {
                "2" => MilitaryBranch.Navy,
                "3" => MilitaryBranch.AirForce,
                _ => MilitaryBranch.Army
            });