Esempio n. 1
0
 public override void ProcessThrow(Throw @throw, ref Player player)
 {
     if (player.CurrentThrow == 1)
     {
         ScoreAtBeginningOfRoundOfCurrentPlayer = player.CurrentScore;
     }
     player.CurrentThrow++;
     CalculateScore(@throw, ref player);
     SetAdditionalInfo(ref player);
 }
Esempio n. 2
0
        private void CalculateScore(Throw @throw, ref Player player)
        {
            if (NotDoubledInIfActivated(player.CurrentScore, @throw.Multiplier))
            {
            }
            else
            {
                player.CurrentScore -= @throw.Value * @throw.Multiplier;
            }

            if (player.CurrentScore < 0)
            {
                EndRound(ref player);
            }
            else
            {
                if (OutMode == X01OutMode.OutMode.StraightOut && player.CurrentScore == 0)
                {
                    player.HasFinished = true;
                }
                else if (OutMode == X01OutMode.OutMode.DoubleOut || OutMode == X01OutMode.OutMode.MasterOut)
                {
                    if (player.CurrentScore == 1)
                    {
                        EndRound(ref player);
                    }
                    else if (player.CurrentScore == 0)
                    {
                        if (@throw.Multiplier == 2 || (OutMode == X01OutMode.OutMode.MasterOut && @throw.Multiplier == 3))
                        {
                            player.HasFinished = true;
                        }
                        else
                        {
                            EndRound(ref player);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        private void CalculateScore(Throw @throw, ref Player player)
        {
            var newScore = player.CurrentScore;

            if (@throw.Value == player.CurrentScore || (JokersActivated && ThrowIsJoker(@throw.Value)))
            {
                if (SkipsActivated)
                {
                    newScore += @throw.Multiplier * 1;
                }
                else
                {
                    newScore++;
                }

                if (newScore > ScoreToReach)
                {
                    newScore = ScoreToReach;
                    player.HasFinished = true;
                }
            }

            player.CurrentScore = newScore;
        }
Esempio n. 4
0
 public abstract void ProcessThrow(Throw @throw, ref Player player);
Esempio n. 5
0
 private void SetAdditionalInfo(ref Player player)
 {
     player.AdditionalInfo = "";
 }
Esempio n. 6
0
 private void EndRound(ref Player player)
 {
     player.CurrentScore = ScoreAtBeginningOfRoundOfCurrentPlayer;
     player.CurrentThrow = 4;
 }
Esempio n. 7
0
 private void CreatePlayers()
 {
     Players = new Player[Game.PlayerCount];
     for (var playerIndex = 0; playerIndex < Game.PlayerCount; playerIndex++)
     {
         Players[playerIndex] = new Player
                                    {
                                        CurrentThrow = playerIndex == 0 ? 1 : 0,
                                        CurrentScore = Game.InitialScore,
                                        Number = playerIndex + 1
                                    };
     }
 }
Esempio n. 8
0
 public override void ProcessThrow(Throw @throw, ref Player player)
 {
     player.CurrentThrow++;
     CalculateScore(@throw, ref player);
 }