コード例 #1
0
        /// <summary>
        ///     Retrieves the score for the player based on the current game state.
        /// </summary>
        /// <returns>The current score.</returns>
        public Score GetCurrentScore()
        {
            int totalPopularity         = groupService.GetTotalPopularity();
            int monthsInOffice          = governmentService.GetMonth();
            int pointsForMonthsInOffice = monthsInOffice * 3;
            int moneyGrabbed            = accountService.GetSwissBankAccountBalance();
            int pointsForMoneyGrabbing  = moneyGrabbed / 10;
            int highestScore            = governmentService.GetLastScore();
            int pointsForStayingAlive   = governmentService.IsPlayerAlive() ? 10 : 0;
            int totalScore = totalPopularity + pointsForMonthsInOffice + pointsForMoneyGrabbing + pointsForStayingAlive;

            Score score = new Score()
            {
                TotalPopularity         = totalPopularity,
                MonthsInOffice          = monthsInOffice,
                PointsForMonthsInOffice = pointsForMonthsInOffice,
                MoneyGrabbed            = moneyGrabbed,
                PointsForMoneyGrabbing  = pointsForMoneyGrabbing,
                HighestScore            = highestScore,
                PointsForStayingAlive   = pointsForStayingAlive,
                TotalScore = totalScore
            };

            return(score);
        }
コード例 #2
0
 /// <summary>
 ///     Applies the effects that result of a player crushing a revolution. It boosts ally popularity, prevents revolutions
 ///     for the next two months and resets all group status and allies from previous plots.
 /// </summary>
 public void ApplyRevolutionCrushedEffects()
 {
     BoostAllyPopularity();
     governmentService.SetPlotBonus(governmentService.GetMonth() + 2);  // Prevent revolutions for the next two months
     groupService.ResetStatusAndAllies();
     // TODO: reset player's ally and revolution properties?
 }
コード例 #3
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);
        }
コード例 #4
0
ファイル: LoanService.cs プロジェクト: sfvicente/Dictator
        /// <summary>
        ///     Determines if it is too early in the game to ask for foreign help.
        /// </summary>
        /// <returns><c>true</c> if it is too early in the game to receive a loan; otherwise, <c>false</c>.</returns>
        private bool IsTooEarlyForLoan()
        {
            Random random = new Random();
            int    minimumRandomMonthRequirement = random.Next(0, 5) + 3;

            if (governmentService.GetMonth() <= minimumRandomMonthRequirement)
            {
                return(true);
            }

            return(false);
        }
コード例 #5
0
ファイル: PlotService.cs プロジェクト: sfvicente/Dictator
        /// <summary>
        ///     Checks for the required conditions and changes que appropriate group status
        ///     to the revolution and assassination modes.
        /// </summary>
        public void Plot()
        {
            // Do not trigger assassinations or revolutions after failed revolution
            if (governmentService.GetMonth() < governmentService.GetPlotBonus())
            {
                return;
            }

            // Do not trigger assassinations or revolutions in the first 2 months of government
            if (governmentService.GetMonth() > 2)
            {
                groupService.ResetStatusAndAllies();

                Group[] groups = groupService.GetGroups();
                int     monthlyMinimalPopularityAndStrength = governmentService.GetMonthlyMinimalPopularityAndStrength();
                int     monthlyRevolutionStrength           = governmentService.GetMonthlyRevolutionStrength();

                // Perform internal plot logic
                ExecutePlot(groups, monthlyMinimalPopularityAndStrength, monthlyRevolutionStrength);
            }
        }
コード例 #6
0
 /// <summary>
 ///     Retrieves the month number of the current game.
 /// </summary>
 /// <returns>The current month number.</returns>
 public int GetMonth()
 {
     return(governmentService.GetMonth());
 }