Exemplo n.º 1
0
 public void DealHoleCards()
 {
     for (int i = 0; i < 2; ++i)               //Simulate passing one card out at a time, going around the circle of players 2 times
     {
         foreach (PokerPlayer player in m_Players.Round)
         {
             player.AddCard(m_Deck.Pop());
         }
     }
 }
Exemplo n.º 2
0
 public void DealHoleCards()
 {
     for (int i = 0; i < 2; ++i)
     //Simulate passing one card out at a time, going around the circle of players 2 times
     {
         foreach (PokerPlayer player in Players.Round)
         {
             Card card = Deck.Pop();
             player.AddCard(card);
             PokerPlayers.Find(x => x.Serial == player.Mobile.Serial).HoleCards.Add(card);
         }
     }
 }
Exemplo n.º 3
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();
                }
            }
        }