Beispiel #1
0
 private bool check_chow(Brand brand)
 {
     // 有沒有人要吃
     for (int i = 0; i < 3; i++)
     {
         all.next();
         CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
         CheckBrands w = new CheckBrands(brand, all.NowPlayer);
         Ai.setPlayer(brand, all.NowPlayer);
         // 只有下家能吃
         if (c.Chow() && i == 0)
         {
             // 如果是真實玩家
             if (NowPlayer_is_Real_Player)
             {
                 CheckUser check = new Control.CheckUser((c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win(), true, brand);
                 toUser(check);
                 if (Player_Pass_Brand)
                 {
                     Player_Pass_Brand = false;
                 }
                 else
                 {
                     return(true);
                 }
             }
             else if (Ai.Chow)
             {
                 setInforamtion();
                 if (PlayerSound)
                 {
                     soundplayer.Stream = Resources.chow;
                     soundplayer.Play();
                 }
                 if (showMessageBox)
                 {
                     ShowMessage(Mahjong.Properties.Settings.Default.Chow);
                 }
                 all.chow_pong(brand, c.SuccessPlayer);
                 updatePlayer_Table();
                 Chow_Pong_Brand = true;
                 return(true);
             }
         }
     }
     all.next();
     return(false);
 }
Beispiel #2
0
        /// <summary>
        /// 玩家按下吃事件呼叫
        /// </summary>
        internal void chow(Brand brand)
        {
            CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);

            if (c.Chow())
            {
                if (c.ChowLength == 1)
                {
                    PlayerSort p = new PlayerSort(c.SuccessPlayer);
                    all.chow_pong(brand, p.getPlayer);
                }
                else
                {
                    if (all.State == table.place.Down)
                    {
                        ChowBrandCheck cbc = new ChowBrandCheck(c.ChowPlayer);
                        cbc.ShowDialog();
                        PlayerSort p = new PlayerSort(cbc.SelectBrandPlayer);
                        all.chow_pong(brand, p.getPlayer);
                    }
                    else
                    {
                        chat.SendObject(c.ChowPlayer);
                    }
                }
            }
            Chow_Pong_Brand = true;
            updatePlayer_Table();
        }
Beispiel #3
0
        private bool check_pong_kong(Brand brand)
        {
            // 測試是否被 槓 碰
            for (int i = 0; i < 3; i++)
            {
                all.next();
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                Ai.setPlayer(brand, all.NowPlayer);
                // 如果是玩家
                if (NowPlayer_is_Real_Player)
                {
                    if (c.Pong() || c.Kong())
                    {
                        toUser(brand, (c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win());
                        if (Player_Pass_Brand)
                        {
                            Player_Pass_Brand = false;
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    // 槓
                    if (c.Kong() && Ai.Kong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.kong;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                        {
                            ShowMessage(Mahjong.Properties.Settings.Default.Kong);
                        }
                        all.kong(brand, c.SuccessPlayer);
                        Chow_Pong_Brand = false;
                        updatePlayer_Table();
                        return(true);
                    }
                    // 碰
                    else if (c.Pong() && Ai.Pong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.pon;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                        {
                            ShowMessage(Mahjong.Properties.Settings.Default.Pong);
                        }
                        all.chow_pong(brand, c.SuccessPlayer);
                        updatePlayer_Table();
                        Chow_Pong_Brand = true;

                        return(true);
                    }
                }
            }
            all.next();
            return(false);
        }
Beispiel #4
0
        public CheckTest()
        {
            BrandPlayer a = new BrandPlayer();

            //a.add(new TenThousandBrand(5));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(8));

            //a.add(new RopeBrand(4));
            //a.add(new RopeBrand(5));
            //a.add(new RopeBrand(6));

            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(5));
            //a.add(new TubeBrand(8));
            //a.add(new TubeBrand(8));

            //FlowerBrand f = new FlowerBrand(1);
            //f.Team = 1;
            //a.add(f);

            //WordBrand r = new WordBrand(9);
            ////r.Team = 2;
            //a.add(r);
            //a.add(r);
            //a.add(r);
            ////a.add(r);

            //TubeBrand t = new TubeBrand(9);
            //t.Team = 3;
            //a.add(t);
            //a.add(t);
            //a.add(t);

            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(9));
            //a.add(new TubeBrand(9));
            //WordBrand w = new WordBrand(6);
            //w.Team = 2;
            //a.add(w);
            //a.add(w);
            //a.add(w);
            //a.add(w);

            //Brand b = new TubeBrand(2);
            //CheckUser c = new Check(b,a);
            printplayer(a);
            CheckBrands c = new CheckBrands(new TubeBrand(2), a);

            a.add(new TubeBrand(2));
            CheckBrands d = new CheckBrands(a);

            //if (c.Win())
            //{
            //    Console.WriteLine("有胡!!");
            //    printplayer(c.SuccessPlayer);
            //}
            if (c.Chow())
            {
                Console.WriteLine("===========");
                Console.WriteLine("\n有吃");
                Console.WriteLine(c.ChowLength);
                printplayer(c.SuccessPlayer);
                printplayer(c.ChowPlayer[0]);
                printplayer(c.ChowPlayer[1]);
                printplayer(c.ChowPlayer[2]);
                Console.WriteLine("===========");
            }
            if (c.Pong())
            {
                Console.WriteLine("\n有碰");
                printplayer(c.SuccessPlayer);
            }
            if (c.Kong())
            {
                Console.WriteLine("\n有槓");
                printplayer(c.SuccessPlayer);
            }
            if (d.DarkKong())
            {
                Console.WriteLine("\n有暗槓");
                printplayer(c.SuccessPlayer);
            }

            if (//!c.Win() &&
                !c.Chow() && !c.Pong() && !c.Kong() && !c.DarkKong())
            {
                Console.WriteLine("\n都沒");
            }
            printplayer(a);
        }
Beispiel #5
0
 /// <summary>
 /// ���a���U�Y�ƥ�I�s
 /// </summary>
 internal void chow(Brand brand)
 {
     CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
     if (c.Chow())
         if (c.ChowLength == 1)
         {
             PlayerSort p = new PlayerSort(c.SuccessPlayer);
             all.chow_pong(brand, p.getPlayer);
         }
         else
         {
             if (all.State == table.place.Down)
             {
                 ChowBrandCheck cbc = new ChowBrandCheck(c.ChowPlayer);
                 cbc.ShowDialog();
                 PlayerSort p = new PlayerSort(cbc.SelectBrandPlayer);
                 all.chow_pong(brand, p.getPlayer);
             }
             else
             {
                 chat.SendObject(c.ChowPlayer);
             }
         }
     Chow_Pong_Brand = true;
     updatePlayer_Table();
 }
Beispiel #6
0
        private bool check_pong_kong(Brand brand)
        {
            // ���լO�_�Q �b �I
            for (int i = 0; i < 3; i++)
            {
                all.next();
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                Ai.setPlayer(brand, all.NowPlayer);
                // �p�G�O���a
                if (NowPlayer_is_Real_Player)
                {
                    if (c.Pong() || c.Kong())
                    {
                        toUser(brand, (c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win());
                        if (Player_Pass_Brand)
                            Player_Pass_Brand = false;
                        else
                            return true;
                    }
                }
                else
                {
                    // �b
                    if (c.Kong() && Ai.Kong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.kong;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.Kong);
                        all.kong(brand, c.SuccessPlayer);
                        Chow_Pong_Brand = false;
                        updatePlayer_Table();
                        return true;
                    }
                    // �I
                    else if (c.Pong() && Ai.Pong)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.pon;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.Pong);
                        all.chow_pong(brand, c.SuccessPlayer);
                        updatePlayer_Table();
                        Chow_Pong_Brand = true;

                        return true;
                    }
                }
            }
            all.next();
            return false;
        }
Beispiel #7
0
        private bool check_chow(Brand brand)
        {
            // ���S���H�n�Y
            for (int i = 0; i < 3; i++)
            {
                all.next();
                CheckBrands c = new CheckBrands(brand, NowPlayer_removeTeam);
                CheckBrands w = new CheckBrands(brand, all.NowPlayer);
                Ai.setPlayer(brand, all.NowPlayer);
                // �u���U�a��Y
                if (c.Chow() && i == 0)
                {
                    // �p�G�O�u�ꪱ�a
                    if (NowPlayer_is_Real_Player)
                    {
                        toUser(brand, (c.Chow() && i == 0), c.Pong(), c.Kong(), false, w.Win());
                        if (Player_Pass_Brand)
                            Player_Pass_Brand = false;
                        else
                            return true;
                    }
                    else if (Ai.Chow)
                    {
                        setInforamtion();
                        if (PlayerSound)
                        {
                            soundplayer.Stream = Resources.chow;
                            soundplayer.Play();
                        }
                        if (showMessageBox)
                            ShowMessage(Mahjong.Properties.Settings.Default.Chow);
                        all.chow_pong(brand, c.SuccessPlayer);
                        updatePlayer_Table();
                        Chow_Pong_Brand = true;
                        return true;
                    }
                }

            }
            all.next();
            return false;
        }
Beispiel #8
0
        public CheckTest()
        {
            BrandPlayer a = new BrandPlayer();
            //a.add(new TenThousandBrand(5));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(6));
            //a.add(new TenThousandBrand(7));
            //a.add(new TenThousandBrand(8));

            //a.add(new RopeBrand(4));
            //a.add(new RopeBrand(5));
            //a.add(new RopeBrand(6));

            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(5));
            //a.add(new TubeBrand(8));
            //a.add(new TubeBrand(8));

            //FlowerBrand f = new FlowerBrand(1);
            //f.Team = 1;
            //a.add(f);

            //WordBrand r = new WordBrand(9);
            ////r.Team = 2;
            //a.add(r);
            //a.add(r);
            //a.add(r);
            ////a.add(r);

            //TubeBrand t = new TubeBrand(9);
            //t.Team = 3;
            //a.add(t);
            //a.add(t);
            //a.add(t);

            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(2));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(3));
            //a.add(new TubeBrand(9));
            //a.add(new TubeBrand(9));
            //WordBrand w = new WordBrand(6);
            //w.Team = 2;
            //a.add(w);
            //a.add(w);
            //a.add(w);
            //a.add(w);

            //Brand b = new TubeBrand(2);
            //CheckUser c = new Check(b,a);
            printplayer(a);
            CheckBrands c = new CheckBrands(new TubeBrand(2), a);
            a.add(new TubeBrand(2));
            CheckBrands d = new CheckBrands(a);
            //if (c.Win())
            //{
            //    Console.WriteLine("有胡!!");
            //    printplayer(c.SuccessPlayer);
            //}
            if (c.Chow())
            {
                Console.WriteLine("===========");
                Console.WriteLine("\n有吃");
                Console.WriteLine(c.ChowLength);
                printplayer(c.SuccessPlayer);
                printplayer(c.ChowPlayer[0]);
                printplayer(c.ChowPlayer[1]);
                printplayer(c.ChowPlayer[2]);
                Console.WriteLine("===========");
            }
            if (c.Pong())
            {
                Console.WriteLine("\n有碰");
                printplayer(c.SuccessPlayer);
            }
            if (c.Kong())
            {
                Console.WriteLine("\n有槓");
                printplayer(c.SuccessPlayer);
            }
            if (d.DarkKong())
            {
                Console.WriteLine("\n有暗槓");
                printplayer(c.SuccessPlayer);
            }

            if (//!c.Win() &&
                !c.Chow() && !c.Pong() && !c.Kong() && !c.DarkKong())
                Console.WriteLine("\n都沒");
            printplayer(a);
        }