Exemplo n.º 1
0
        /// <summary>
        /// Gets the player's initial armed forces distribution.
        /// </summary>
        /// <param name="computerForces">
        /// The computer's initial armed forces.
        /// </param>
        public static ArmedForces GetInitialForces(ArmedForces computerForces)
        {
            var playerForces = default(ArmedForces);

            // BUG: This loop allows the player to assign negative values to
            //  some branches, leading to strange results.
            do
            {
                View.ShowDistributeForces();

                View.PromptArmySize(computerForces.Army);
                var army = InputInteger();

                View.PromptNavySize(computerForces.Navy);
                var navy = InputInteger();

                View.PromptAirForceSize(computerForces.AirForce);
                var airForce = InputInteger();

                playerForces = new ArmedForces
                {
                    Army     = army,
                    Navy     = navy,
                    AirForce = airForce
                };
            }while (playerForces.TotalTroops > computerForces.TotalTroops);

            return(playerForces);
        }