Beispiel #1
0
        public void DoubleDown()
        {
            // >>>>>[   Signal: Place additional chips beside the original bet
            //          outside the betting box, and point with one finger.
            //          -----
            NoSurrender();

            FlavorText.Clear();
            ResultText.Clear();

            if (Commands["double down"])
            {
                if (Player.DoubleDown())
                {
                    FlavorText.Add("You place the additional chips beside your original bet--outside the betting box.");
                    FlavorText.Add("Player's bet is now $" + Player.Bet.ToString());

                    Player.AddToHand(Dealer.Deal());
                    Boolean LastHand = (Player.PlayerHand[Player.PlayerHand.Count - 1] == Player.CurrentHand());

                    if (Player.CurrentHand().Bust)
                    {
                        ResultText.Add("And the Player goes bust...");
                        ExitGracefully(LastHand);
                    }
                    else
                    {
                        Player.Stand();
                        ResultText.Add("Player stands.");
                        ExitGracefully(LastHand);
                    }
                }
                else
                {
                    FlavorText.Add("You do not have enough money for that.");
                    View.ModelChanged();
                }
            }
            else
            {
                FlavorText.Add("Command not available.");
                View.ModelChanged();
            }

            void ExitGracefully(Boolean LastHand)
            {
                if (LastHand)
                {
                    View.ModelChanged(true);
                    DealerGo();
                }
                else
                {
                    View.ModelChanged();
                }
            }
        }
Beispiel #2
0
        void Hit(TwitchUser speaker, string message, bool doubleDown = false)
        {
            BlackjackPlayer <TwitchUser> player = GetPlayer(speaker);

            if (player != null)
            {
                string chatMessage = "";
                if (!player.CurrentHandEvaluator.isDone)
                {
                    if (doubleDown)
                    {
                        if (player.DoubleDown())
                        {
                            chatMessage += "Doubled down! ";
                        }
                        else
                        {
                            chatMessage += "Can't afford a double, so you hit instead. ";
                            doubleDown   = false;
                            player.Hit();
                        }
                    }
                    else
                    {
                        player.Hit();
                    }

                    chatMessage += "Dealt a " + player.hand.Last.ToString();

                    if (player.CurrentHandEvaluator.isBust)
                    {
                        chatMessage += " and BUSTED with " + player.CurrentHandEvaluator.cards.ToString() + " (" + player.CurrentHandEvaluator.HandValueString() + ")!";
                    }
                    else if (player.CurrentHandEvaluator.handValue == 21 && player.Stand())
                    {
                        chatMessage += " and you stood with " + player.CurrentHandEvaluator.cards.ToString() + " (" + player.CurrentHandEvaluator.HandValueString() + ")!";
                    }
                    else
                    {
                        chatMessage += ", you have " + player.CurrentHandEvaluator.cards.ToString() + ".";
                    }

                    chatMessage += AnnounceSplitHand(player);
                    controller.room.SendWhisper(speaker, chatMessage);

                    if (controller.game.ReadyToEnd())
                    {
                        controller.SetState(this, typeof(BJStateDealerPlaying));
                    }
                }
                else
                {
                    controller.room.SendWhisper(speaker, "Too late, you are standing with " + player.CurrentHandEvaluator.HandValueString());
                }
            }
        }