Beispiel #1
0
 private void CRcomon()
 {
     //ディーラーのカード表示
     showcard(DHands, DHands1.Location.X, DHands1.Location.Y);
     //ディーラーの役及び表示
     dre          = Judge(DHands);
     dra          = RankJudge(DHands);
     DResult.Text = dre.ToString() + "(" + dra + ")";
     //勝ち負け判定及びコイン処理
     #region 勝ち負け処理
     if (pre > dre)//役で勝ち
     {
         MessageBox.Show("You win!!\nコイン" + (bet * 2).ToString() + "枚獲得!!");
         coin        += bet * 2;
         lblCoin.Text = coin.ToString() + "枚";
     }
     else if (pre < dre)//役で負け
     {
         MessageBox.Show("You lose...\nコイン" + bet.ToString() + "枚失った...");
     }
     else//役は引き分け
     {
         if (Ranktoint(pra) > Ranktoint(dra))//数字で勝ち
         {
             MessageBox.Show("You win!!\nコイン" + (bet * 2).ToString() + "枚獲得!!");
             coin        += bet * 2;
             lblCoin.Text = coin.ToString() + "枚";
         }
         else if (Ranktoint(pra) < Ranktoint(dra))//数字で負け
         {
             MessageBox.Show("You lose...\nコイン" + bet.ToString() + "枚失った...");
         }
         else//数字でも引き分け
         {
             MessageBox.Show("Draw\n賭けた分のコイン" + bet.ToString() + "枚獲得");
             coin        += bet;
             lblCoin.Text = coin.ToString() + "枚";
         }
     }
     #endregion
     //終了処理
     bet                    = 0;
     btnCall.Enabled        = false;
     btnRaise.Enabled       = false;
     numericUpDown1.Enabled = true;
     btnBet.Enabled         = true;
     lblBet.Text            = "ベッティングタイム";
     label7.Text            = "現在" + bet.ToString() + "枚\n賭けられています";
     numericUpDown1.Maximum = coin;
     lblCoin.Text           = coin.ToString() + "枚";
     PHands1.BringToFront();
     PHands2.BringToFront();
     PHands3.BringToFront();
     PHands4.BringToFront();
     PHands5.BringToFront();
     DHands1.BringToFront();
     DHands2.BringToFront();
     DHands3.BringToFront();
     DHands4.BringToFront();
     DHands5.BringToFront();
     PResult.Text = "";
     DResult.Text = "";
 }
Beispiel #2
0
        private void btnDraw_Click(object sender, EventArgs e)
        {
            #region 共通する初期処理
            //手札交換
            for (int i = 0; i < 5; i++)
            {
                if (!PHolds[i])
                {
                    Snow--;
                    PHands[i] = Stack[Snow];
                }
            }
            lblStackCount.Text = "残り" + Snow.ToString() + "枚";
            //カード表示
            showcard(PHands, PHands1.Location.X, PHands1.Location.Y);
            //役の判定及び表示
            pre          = Judge(PHands);
            pra          = RankJudge(PHands);
            PResult.Text = pre.ToString() + "(" + pra + ")";
            #endregion
            switch (gamemode)
            {
                #region gamemodo = MODE_ALONE
            case mode.MODE_ALONE:
                //コインの配布
                MessageBox.Show("コイン" + (((int)Judge(PHands) + 1) * 10).ToString() + "枚獲得!!");
                coin        += ((int)Judge(PHands) + 1) * 10;
                lblCoin.Text = coin.ToString() + "枚";
                //終了処理
                btnStart.Enabled = true;
                PHands1.BringToFront();
                PHands2.BringToFront();
                PHands3.BringToFront();
                PHands4.BringToFront();
                PHands5.BringToFront();
                PResult.Text = "";
                break;

                #endregion
                #region gamemode = MODE_VS
            case mode.MODE_VS:
                //DEALER交換
                for (int i = 0; i < 5; i++)
                {
                    DHolds[i] = false;
                }
                for (int i = 0; i < 5; i++)
                {
                    if (DHands[i] == 53 || DHands[i] == 54)
                    {
                        DHolds[i] = true;    //JOKERは交換しない
                    }
                }
                switch (Judge(PHands))    //交換するものを判定
                {
                case result.HighCards:    //もっと考えた行動を目標に

                    break;

                case result.OnePair:
                case result.TwoPair:
                case result.ThereeCard:
                case result.FourCard:
                    for (int i = 0; i < 4; i++)
                    {
                        for (int j = i + 1; j < 5; j++)
                        {
                            if (getsuit(DHands[i]) != suit.SUIT_JOKER || getsuit(DHands[j]) != suit.SUIT_JOKER)
                            {
                                if (getrank(DHands[i], 0) == getrank(DHands[j], 0))
                                {
                                    DHolds[i] = true;
                                    DHolds[j] = true;
                                }
                            }
                        }
                    }
                    for (int i = 0; i < 5; i++)
                    {
                        if (DHolds[i] == false)
                        {
                            Snow--;
                            DHands[i] = Stack[Snow];
                        }
                    }
                    break;

                default:
                    for (int i = 0; i < 5; i++)
                    {
                        DHolds[i] = true;
                    }
                    break;
                }
                //終了処理
                lblStackCount.Text = "残り" + Snow.ToString() + "枚";
                btnCall.Enabled    = true;
                btnRaise.Enabled   = true;
                break;

                #endregion
            default:
                break;
            }
            #region 共通する終了処理
            btnDraw.Enabled = false;
            lblDraw.Visible = false;
            #endregion
        }