Beispiel #1
0
        /// <summary>
        /// An attempt to jump start the game when no player can act and the game is not yet over.
        /// Plays one card each from their closed stacks on hand to respective open stack.
        /// </summary>
        public void Draw()
        {
            // Stale mate, players pick up the respective stack. Two cards are needed to do a draw.
            if ((PlayerOne.Hand.Cards.Count + PlayerTwo.Hand.Cards.Count) < 2)
            {
                while (LeftStack.Cards.Count > 0)
                {
                    PlayerOne.PickUpCard(LeftStack.DrawCard());
                }
                while (RightStack.Cards.Count > 0)
                {
                    PlayerTwo.PickUpCard(RightStack.DrawCard());
                }
            }

            // If one player has an empty hand, and the other player has more than one card on hand
            // the player without a card will draw one from the other players hand.
            if (PlayerOne.Hand.Cards.Count == 0 && PlayerTwo.Hand.Cards.Count > 1)
            {
                PlayerOne.Hand.Cards.Push(PlayerTwo.Hand.DrawCard());
            }

            else if (PlayerTwo.Hand.Cards.Count == 0 && PlayerOne.Hand.Cards.Count > 1)
            {
                PlayerTwo.Hand.Cards.Push(PlayerOne.Hand.DrawCard());
            }

            LeftStack.AddCard(PlayerOne.Hand.DrawCard(), true);
            RightStack.AddCard(PlayerTwo.Hand.DrawCard(), true);
        }
Beispiel #2
0
        private Player PlayerCallsStressEvent(Player player)
        {
            Player stressEventLoser;

            if (LeftStack.TopCard.Rank == RightStack.TopCard.Rank)
            {
                // Legit stress event, calling player wins
                if (player.IsPlayerOne)
                {
                    stressEventLoser = PlayerTwo;
                }
                else
                {
                    stressEventLoser = PlayerOne;
                }
            }
            else
            {
                // Not a legit stress event, calling player loses
                if (player.IsPlayerOne)
                {
                    stressEventLoser = PlayerOne;
                }
                else
                {
                    stressEventLoser = PlayerTwo;
                }
            }

            // Loser picks upp both stacks
            while (LeftStack.Cards.Count > 0)
            {
                stressEventLoser.PickUpCard(LeftStack.DrawCard());
            }
            while (RightStack.Cards.Count > 0)
            {
                stressEventLoser.PickUpCard(RightStack.DrawCard());
            }

            Draw();
            return(stressEventLoser);
        }