Exemplo n.º 1
0
        // TODO: check if we should apply this function for blinds posting
        private void PutChipsToPot(Player player, int amount)
        {
            Pot potToPutChips = null;

            foreach (Pot pot in CurrentHand.Pots)
            {
                bool hasPlayersAllIn = false;
                foreach (Player playerInPot in pot.PlayersInPot)
                {
                    if (playerInPot.IsAllIn)
                    {
                        hasPlayersAllIn = true;
                        break;
                    }
                }
                if (!hasPlayersAllIn)
                {
                    potToPutChips = pot;
                    break;
                }
            }

            if (potToPutChips == null)
            {
                Pot newPot = new Pot();
                CurrentHand.AddPot(newPot);
                GameController.Instance.AddPot();
                potToPutChips = newPot;
            }

            player.PutChipsToPot(potToPutChips, amount);
        }