示例#1
0
        /// <summary>
        /// Demote Captains to Privates
        /// </summary>
        private void DemoteNecessaryCaptainsToPrivates()
        {
            _writer.WriteMessage($"You can't have more than {MaxCaptainCount} Captains!");

            for (int i = CaptainCount; i > MaxCaptainCount; i--)
            {
                var captainToDemote = Recruits.First(s => s.Rank == Rank.Captain);
                captainToDemote.Rank = Rank.Private;
                _writer.WriteMessage($"{captainToDemote.Name} has been demoted from {Rank.Captain} to {Rank.Private}");
            }
        }
示例#2
0
        /// <summary>
        /// Demote Sergeants to Privates
        /// </summary>
        private void DemoteNecessarySergeantsToPrivates()
        {
            _writer.WriteMessage($"You can't have more than {MaxSergeantCount} Sergeant(s)!");

            for (int i = SergeantCount; i > MaxSergeantCount; i--)
            {
                var sergeantToDemote = Recruits.First(s => s.Rank == Rank.Sergeant);
                sergeantToDemote.Rank = Rank.Private;
                _writer.WriteMessage($"{sergeantToDemote.Name} has been demoted from {Rank.Sergeant} to {Rank.Private}");
            }
        }
示例#3
0
        /// <summary>
        /// Demote Generals to Captains
        /// </summary>
        private void DemoteNecessaryGeneralsToCaptains()
        {
            _writer.WriteMessage($"You can't have more than {MaxGeneralCount} General!");

            for (int i = GeneralCount; i > MaxGeneralCount; i--)
            {
                var generalToDemote = Recruits.First(s => s.Rank == Rank.General);
                generalToDemote.Rank = Rank.Captain;
                _writer.WriteMessage($"{generalToDemote.Name} has been demoted from {Rank.General} to {Rank.Captain}");
            }
        }