コード例 #1
0
        private void CalculateHandsAndTrump(Player player, Suit trump)
        {
            OldTrump = trump;
            player.StateHandsAndTrump(ref OldTrump, ref NewTrump, ref OldHands, ref NewHands);
            // check if new hands is greater than old hands
            // if it is we need to check with the other players hands
            bool changeTrump = false;
            if (NewHands > OldHands)
            {
                changeTrump = true;

                for (int index = 0; index < HandsStated.Count; index++)
                {
                    if (NewHands < HandsStated[index])
                    {
                        changeTrump = false;
                    }
                }
            }

            if (changeTrump)
            {
                // the trump can be changed now
                HandSummary.Add(player.Name + " changed the trump to " + NewTrump + ".");
                deck.Trump = NewTrump;
                HandSummary.Add(player.Name + " stated " + NewHands + " hands.");
                player.SetTrumpAndInitialize(NewTrump);
                player.HandsStated = NewHands;
                HandsStated.Add(NewHands);
            }
            else
            {
                deck.Trump = OldTrump;
                HandSummary.Add(player.Name + " stated " + OldHands + " hands.");
                player.SetTrumpAndInitialize(OldTrump);
                player.HandsStated = OldHands;
                HandsStated.Add(OldHands);
            }
            SummaryShown = false;
        }