Exemplo n.º 1
0
        //检查能否叫地主 火箭为8分,炸弹为6分,大王4分,小王3分,2为2分
        public bool CheckCall()
        {
            int        bigCardValue = 0;
            List <int> cards        = GetUserCard();
            int        times        = mTableData.MultipleNum / 2;
            List <int> bombCards    = new List <int>();
            CardVector bombVec      = new CardVector(DeckType.Bomb);

            GetBombCard(cards, ref bombVec);
            bombCards.AddRange(bombVec.GetList());
            CardVector wangVec = new CardVector(DeckType.WangBomb);

            GetWangBombCard(cards, ref wangVec);
            bombCards.AddRange(wangVec.GetList());
            CardVector c2Vec = new CardVector(DeckType.Single);

            GetCard(cards, mC2, ref c2Vec);
            int c2Count = c2Vec.GetList().Count;

            if (2 == wangVec.GetCount())
            {
                bigCardValue += 8;
            }

            bigCardValue += bombVec.GetCount() * 6;

            if (0 == bombCards.Count)
            {
                GetCard(cards, mCW1, ref wangVec);
                GetCard(cards, mCW2, ref wangVec);
                if (wangVec.HasKey(mCW2))
                {
                    bigCardValue += 4;
                }
                if (wangVec.HasKey(mCW1))
                {
                    bigCardValue += 3;
                }
            }
            if (4 > c2Count)
            {
                bigCardValue += c2Count * 2;
            }

            if ((7 <= bigCardValue && 3 > times) || (5 <= bigCardValue && 2 > times) || (2 <= bigCardValue && 1 > times))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
 //取出大于3连对至Vector对象,返回剩余牌
 public List <int> GetShunTwoCard(List <int> handCard, ref CardVector vec)
 {
     if (6 < handCard.Count)
     {
         CardVector twoVec = new CardVector(DeckType.Double);
         GetTwoCard(handCard, ref twoVec);
         if (3 < twoVec.GetCount())
         {
             List <int> arr = GetMoreThanCardVal(ref twoVec, 0, 4, 20);
             GetSameCard(arr, 2, ref vec);
             foreach (int card in arr)
             {
                 handCard.Remove(card);
             }
         }
     }
     return(handCard);
 }
Exemplo n.º 3
0
 //取出飞机对象至Vector对象,返回剩余的牌
 public List <int> GetFlyCard(List <int> handCard, ref CardVector vec)
 {
     if (5 < handCard.Count)
     {
         CardVector threeVec = new CardVector(DeckType.Three);
         GetThreeCard(handCard, ref threeVec);
         if (1 < threeVec.GetCount())
         {
             List <int> arr = GetMoreThanCardVal(ref threeVec, 0, 2, 20);
             GetSameCard(arr, 3, ref vec);
             foreach (int card in arr)
             {
                 handCard.Remove(card);
             }
         }
     }
     return(handCard);
 }
Exemplo n.º 4
0
        //去除对子至Vector对象,返回剩余牌
        public List <int> GetTwoCard(List <int> handCard, ref CardVector vec, bool matchThree = false)
        {
            List <int> lastCards = GetSameCard(handCard, 2, ref vec);

            if (matchThree)
            {
                CardVector threeVec = new CardVector(DeckType.Three);
                lastCards = GetSameCard(handCard, 3, ref threeVec);
                if (0 < threeVec.GetCount())
                {
                    List <CardSize> keys = threeVec.GetKeys();
                    foreach (CardSize key in keys)
                    {
                        List <int> val = threeVec.Get(key);
                        List <int> arr = new List <int>();
                        CopyList(val, ref arr, 0, 2);
                        vec.Add(key, arr);
                    }
                }
            }

            return(lastCards);
        }