Ejemplo 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);
 }
Ejemplo 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);
                        }
                    }
                }
            }
        }
Ejemplo 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;
        }
Ejemplo n.º 4
0
 public abstract void ProcessThrow(Throw @throw, ref Player player);
Ejemplo n.º 5
0
 private void SetAdditionalInfo(ref Player player)
 {
     player.AdditionalInfo = "";
 }
Ejemplo n.º 6
0
 private void EndRound(ref Player player)
 {
     player.CurrentScore = ScoreAtBeginningOfRoundOfCurrentPlayer;
     player.CurrentThrow = 4;
 }
Ejemplo 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
                                    };
     }
 }
Ejemplo n.º 8
0
 public override void ProcessThrow(Throw @throw, ref Player player)
 {
     player.CurrentThrow++;
     CalculateScore(@throw, ref player);
 }