Example #1
0
        public void ShowPlayerCards(bool hideOneCard = false)
        {
            if (hideOneCard) // This should be set to true only if the player is the dealer AND all players have played.
            {
                log.DealerCard(Name);
                if (Hands.FirstOrDefault().Cards.FirstOrDefault() != null)
                {
                    Hands.First().Cards.First().DisplayCard();
                }
            }
            else
            {
                foreach (Hand hand in Hands)
                {
                    if (Name != "Dealer")
                    {
                        if (hand.Status == HandStatus.Bust)
                        {
                            log.PlayerHasBust(Name, Bet);
                        }
                        else if (hand.Status == HandStatus.BlackJack)
                        {
                            log.PlayerGotBlackJack(Name, Bet * blackJackPayout);
                        }
                        else if (hand.Status == HandStatus.Won)
                        {
                            log.PlayerHasWon(Name, Bet);
                        }
                        else if (hand.Status == HandStatus.Lost)
                        {
                            log.PlayerResult(Name, "lost");
                        }
                        else if (hand.Status == HandStatus.BlackJack)
                        {
                            log.PlayerHasWon(Name, Bet * 1.5);
                        }
                        else if (hand.Status == HandStatus.Push && Name != "Dealer")
                        {
                            log.PlayerHasTied(Name);
                        }
                        else if (hand.Status == HandStatus.InPlay)
                        {
                            log.PlayerCardsInPlay(Name);
                        }
                        else
                        {
                            log.PlayerCards(Name);
                        }
                    }
                    else
                    {
                        if (hand.Status == HandStatus.Bust)
                        {
                            log.PlayerResult(Name, "bust");
                        }
                        else
                        {
                            log.PlayerCards(Name);
                        }
                    }

                    foreach (Card card in hand.Cards)
                    {
                        card.DisplayCard();
                    }

                    log.Total(hand.Total);
                }
            }
            log.SkipLine();
        }