Пример #1
0
        /// <summary>
        /// Accepts the scoring category for the current roll onto the scorecard.
        /// </summary>
        /// <param name="category"> Scoring category to accept. </param>
        /// <returns> True is accepted; false otherwise. </returns>
        public bool AcceptScore(ScoringCategory category)
        {
            if (gameState.AcceptScore(this, scoreCard, category, rollScores))
            {
                roller     = new DiceRoller();
                rollScores = ScoreCalculator.CalculateDice(roller.SortedDice);
                scoreCard.AcceptScore(ScoringCategory.Bonus, ScoreCalculator.CalculateBonus(scoreCard.Scores));
                rollScores.Add(ScoringCategory.Bonus, ScoreCalculator.CalculateBonus(scoreCard.Scores));

                return(true);
            }
            return(false);
        }
Пример #2
0
        /// <summary>
        /// Attempts to roll dice that are not marked to be kept.
        /// </summary>
        /// <param name="game"> Reference to game manager. </param>
        /// <param name="roller"> Reference to current game's dice roller. </param>
        /// <returns> True if the dice were rolled; false otherwise. </returns>
        public virtual bool RollDice(GameManager game, DiceRoller roller)
        {
            roller.RollDice();

            switch (roller.RollsRemaining)
            {
            case 2:
                game.NextState(new SecondMoveState());
                break;

            case 1:
                game.NextState(new ThirdMove());
                break;

            default:
                game.NextState(new FinalMoveState());
                break;
            }

            return(true);
        }
Пример #3
0
 public override bool SetWillKeep(GameManager game, DiceRoller roller, int die, bool keep)
 {
     return(false);
 }
Пример #4
0
 public override bool RollDice(GameManager game, DiceRoller diceRoller)
 {
     return(false);
 }
Пример #5
0
 /// <summary>
 /// Marks the die roll to be kept through rerolls.
 /// </summary>
 /// <param name="game"> Reference to game manager. </param>
 /// <param name="roller"> Reference to current game's dice roller. </param>
 /// <param name="die"> Index of die to set the keep. </param>
 /// <param name="keep"> If the die should be kept. </param>
 /// <returns></returns>
 public virtual bool SetWillKeep(GameManager game, DiceRoller roller, int die, bool keep)
 {
     roller.KeepDie(die, keep);
     return(true);
 }