Beispiel #1
0
        public void PopCards(int amount, string message)
        {
            if (amount > 0) //Pop the appropriate number of cards from the top of the deck
            {
                var sb = new StringBuilder();

                sb.Append("The " + message + " shows: ");

                for (int i = 0; i < amount; ++i)
                {
                    Card popped = Deck.Pop();

                    if (i == 2 || amount == 1)
                    {
                        sb.Append(popped.Name + ".");
                    }
                    else
                    {
                        sb.Append(popped.Name + ", ");
                    }

                    CommunityCards.Add(popped);
                }

                PokerMessage(Dealer, sb.ToString());
            }
        }
Beispiel #2
0
        // Methods

        /// <summary>
        /// Draw the community cards to be displayed on the table.
        /// Creates temporary card, and puts into the ObservableCollection<Card> CommunityCards
        /// as well as the static PlayerCommCards parameter in PlayerModel that is used so all players know what they have.
        /// </summary>
        /// <param name="numCards"></param>
        public void DrawCommunityCards(int numCards)
        {
            for (int i = 0; i < numCards; i++)
            {
                Card tempCard = dealer.DrawCard();
                CommunityCards.Add(tempCard);
                PlayerModel.PlayerCommCards.Add(tempCard);
            }
        }
 private void SetCommunityCards(BoardCards communityCards)
 {
     foreach (var card in communityCards)
     {
         var newCard = new ReplayerCardViewModel();
         newCard.CardId = card.CardIntValue;
         CommunityCards.Add(newCard);
     }
 }
Beispiel #4
0
        public void DoRoundAction() //Happens once State is changed (once per state)
        {
            if (State == PokerGameState.Showdown)
            {
                DoShowdown(false);
            }
            else if (State == PokerGameState.DealHoleCards)
            {
                DealHoleCards();
                State           = PokerGameState.PreFlop;
                NeedsGumpUpdate = true;
            }
            else if (!IsBettingRound)
            {
                int    numberOfCards = 0;
                string round         = String.Empty;

                switch (State)
                {
                case PokerGameState.Flop:
                {
                    numberOfCards += 3;
                    round          = "flop";
                    State          = PokerGameState.PreTurn;
                }
                break;

                case PokerGameState.Turn:
                {
                    ++numberOfCards;
                    round = "turn";
                    State = PokerGameState.PreRiver;
                }
                break;

                case PokerGameState.River:
                {
                    ++numberOfCards;
                    round = "river";
                    State = PokerGameState.PreShowdown;
                }
                break;
                }

                if (numberOfCards != 0) //Pop the appropriate number of cards from the top of the deck
                {
                    var sb = new StringBuilder();

                    sb.Append("The " + round + " shows: ");

                    for (int i = 0; i < numberOfCards; ++i)
                    {
                        Card popped = Deck.Pop();

                        if (i == 2 || numberOfCards == 1)
                        {
                            sb.Append(popped.Name + ".");
                        }
                        else
                        {
                            sb.Append(popped.Name + ", ");
                        }

                        CommunityCards.Add(popped);
                        PokerHand.Community.Add(popped);
                    }

                    PokerMessage(Dealer, sb.ToString());
                    Players.Turn.Clear();
                    NeedsGumpUpdate = true;
                }
            }
            else
            {
                if (Players.Turn.Count == Players.Round.Count)
                {
                    switch (State)
                    {
                    case PokerGameState.PreFlop:
                        State = PokerGameState.Flop;
                        break;

                    case PokerGameState.PreTurn:
                        State = PokerGameState.Turn;
                        break;

                    case PokerGameState.PreRiver:
                        State = PokerGameState.River;
                        break;

                    case PokerGameState.PreShowdown:
                        State = PokerGameState.Showdown;
                        break;
                    }
                }
                else if (Players.Turn.Count == 0 && State != PokerGameState.PreFlop)
                //We need to initiate betting for this round
                {
                    CurrentBet = Dealer.BigBlind;
                    NextRaise  = 0;
                    ResetPlayerActions();
                    CheckLonePlayer();
                    AssignNextTurn();
                }
                else if (Players.Turn.Count == 0 && State == PokerGameState.PreFlop)
                {
                    CheckLonePlayer();
                    AssignNextTurn();
                }
            }
        }
Beispiel #5
0
 private void OnCommunityHasBeedDealtACard(CommunityHasBeenDealtACardEvent e)
 {
     logger.Debug("Community card dealt: {0}", e.Card);
     CommunityCards.Add(e.Card);
 }
Beispiel #6
0
 public void Draw(Card communityCard)
 {
     CommunityCards.Add(communityCard);
 }
Beispiel #7
0
 public void AddCommunityCard(Card card)
 {
     CommunityCards.Add(card);
 }