コード例 #1
0
ファイル: WarService.cs プロジェクト: sfvicente/Dictator
        /// <summary>
        ///     Calculates the strength of the Ritimba republic in a scenario of war.
        /// </summary>
        /// <returns>The total strength of Ritimba in a scenario of war.</returns>
        public int CalculateRitimbaStrength()
        {
            int totalStrength = 0;

            Group[] groups = groupService.GetGroups();

            // Sum the strength of the army, peasants and landowners if they have minimal popularity
            for (int i = 0; i < 3; i++)
            {
                if (groups[i].Popularity > governmentService.GetMonthlyMinimalPopularityAndStrength())
                {
                    totalStrength += groups[i].Strength;
                }
            }

            Group secretPoliceGroup = groupService.GetGroupByType(GroupType.SecretPolice);

            // Add the strength of the secret police strength if they have minimal popularity
            if (secretPoliceGroup.Popularity > governmentService.GetMonthlyMinimalPopularityAndStrength())
            {
                totalStrength += secretPoliceGroup.Strength;
            }

            // Add the strength of the player to the total
            totalStrength += governmentService.GetPlayerStrength();

            return(totalStrength);
        }
コード例 #2
0
ファイル: ReportService.cs プロジェクト: sfvicente/Dictator
        /// <summary>
        ///     Retrieves the police report with the current month, revolution strength, player strength and group information.
        /// </summary>
        /// <returns>The police report with the current month, revolution strength, player strength and group information.</returns>
        public PoliceReport GetPoliceReport()
        {
            PoliceReport policeReport = new PoliceReport
            {
                Month                     = governmentService.GetMonth(),
                Groups                    = groupService.GetGroups().AsReadOnly(),
                PlayerStrength            = governmentService.GetPlayerStrength(),
                MonthlyRevolutionStrength = governmentService.GetMonthlyRevolutionStrength()
            };

            return(policeReport);
        }