Example #1
0
        public Throw DetectThrow(int mouseX, int mouseY, int centerX, int centerY)
        {
            var @throw = new Throw();
            var gridX = mouseX - centerX;
            var gridY = mouseY - centerY;

            for (var circleIndex = 0; circleIndex < _circlePieces.Count; circleIndex++)
            {
                var circle = _circlePieces[circleIndex];
                if (circle.GraphicsPath.IsVisible(gridX, gridY))
                {
                    @throw.Multiplier = circle.Value;
                    if (circleIndex < 2)
                    {
                        @throw.Value = 25;
                        return @throw;
                    }

                    break;
                }
            }

            foreach (var slice in _slicePieces)
            {
                if (slice.GraphicsPath.IsVisible(gridX, gridY))
                {
                    @throw.Value = slice.Value;
                    return @throw;
                }
            }

            return @throw;
        }
Example #2
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);
 }
Example #3
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);
                        }
                    }
                }
            }
        }
Example #4
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;
        }
 public abstract void ProcessThrow(Throw @throw, ref Player player);
Example #6
0
        public void ProcessThrow(Throw @throw)
        {
            if (!CurrentPlayer.HasFinished)
            {
                var currentPlayer = CurrentPlayer;
                Game.ProcessThrow(@throw, ref currentPlayer);
                if (CurrentPlayer.HasFinished)
                {
                    LastRound = true;
                }
            }

            if (CurrentPlayer.CurrentThrow > 3 || CurrentPlayer.HasFinished)
            {
                var nextPlayerIndex = CurrentPlayer.Number;
                if (nextPlayerIndex >= Players.Length)
                {
                    if (LastRound)
                    {
                        GameInProgress = false;
                        return;
                    }

                    nextPlayerIndex = 0;
                }

                CurrentPlayer = Players[nextPlayerIndex];
                CurrentPlayer.CurrentThrow = 1;
            }
        }
Example #7
0
 private void ProcessThrow(Throw @throw)
 {
     _gameManagement.ProcessThrow(@throw);
     RefreshPanels();
 }
Example #8
0
 public override void ProcessThrow(Throw @throw, ref Player player)
 {
     player.CurrentThrow++;
     CalculateScore(@throw, ref player);
 }