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