Beispiel #1
0
        //玩家出牌
        public static void PlayCard(this FiveStarPlayer fiveStarPlayer, int card)
        {
            if (!fiveStarPlayer.IsCanPlayCard)
            {
                return;                                                        //不是这个玩家 出牌 直接return
            }
            if (fiveStarPlayer.IsLiangDao && fiveStarPlayer.MoEndHand != card) //如果玩家亮倒 就只能出 最后摸的一张牌
            {
                Log.Error("玩家亮倒后 出的牌 不是 最后摸的牌" + card);
                card = fiveStarPlayer.MoEndHand;//直接帮他出最后摸到的牌
            }
            if (fiveStarPlayer.IsLiangDao && fiveStarPlayer.MoEndHand == card)
            {
                //如果是亮倒 状态下 并且出的是摸的最后一张牌 就不要检测 是不是放炮牌
            }
            else
            {
                if (fiveStarPlayer.FiveStarRoom.LiangDaoCanHuCards.Contains(card))
                {
                    for (int i = 0; i < fiveStarPlayer.Hands.Count; i++)
                    {
                        if (!fiveStarPlayer.FiveStarRoom.LiangDaoCanHuCards.Contains(fiveStarPlayer.Hands[i]))
                        {
                            Log.Error("玩家打出的牌 有亮倒玩家胡");//在没有亮倒情况 除非手中所有的牌都是放炮的牌 就不会进来 就不会return 才可以打
                            return;
                        }
                    }
                }
            }

            if (!fiveStarPlayer.Hands.Contains(card))
            {
                Log.Error("玩家出的牌手牌中没有" + card);
                return;
            }
            if (fiveStarPlayer.FiveStarRoom.CanPlayCardPlayerIndex == fiveStarPlayer.SeatIndex)
            {
                if (fiveStarPlayer.Hands.Contains(card))
                {
                    fiveStarPlayer.Hands.Remove(card);
                    Actor_FiveStar_PlayCardResult actorFiveStarPlayCardResult = new Actor_FiveStar_PlayCardResult()
                    {
                        SeatIndex = fiveStarPlayer.SeatIndex,
                        Card      = card
                    };
                    fiveStarPlayer.FiveStarRoom.RecordChuCard(actorFiveStarPlayCardResult);//记录出牌消息
                    fiveStarPlayer.FiveStarRoom.BroadcastMssagePlayers(actorFiveStarPlayCardResult);
                }
            }
            fiveStarPlayer.PlayCards.Add(card);
            fiveStarPlayer.FiveStarRoom.PlayerPlayCard(fiveStarPlayer.SeatIndex, card);
            fiveStarPlayer.IsCanPlayCard = false;
            fiveStarPlayer.SendNewestHands();   //发送玩家最新的手牌信息
            fiveStarPlayer.AIPlayCardDispose(); //AI出牌处理
        }
Beispiel #2
0
        //操作完成后续
        public static void OperateFinishFollow(this FiveStarPlayer fiveStarPlayer, FiveStarOperateInfo operateInfo)
        {
            //执行碰 明杠 放冲胡 玩家 最后打牌要被数组移除
            switch (operateInfo.OperateType)
            {
            case FiveStarOperateType.Peng:
            case FiveStarOperateType.MingGang:
            case FiveStarOperateType.FangChongHu:
                fiveStarPlayer.FiveStarRoom.FiveStarPlayerDic[fiveStarPlayer.FiveStarRoom.CurrChuPaiIndex].PlayCardByEatOff();    //玩家打出牌被吃掉
                break;
            }
            //操作完成后续
            switch (operateInfo.OperateType)
            {
            case FiveStarOperateType.None:    //玩家不操作
                if (fiveStarPlayer.FiveStarRoom.QiOperateNextStep == FiveStarOperateType.MoCard)
                {
                    fiveStarPlayer.FiveStarRoom.PlayerMoPai();    //可出牌的人 和当前出牌的是同一个 证明 刚刚摸牌玩家已经出牌了 所以按正常流程摸牌
                }
                else if (fiveStarPlayer.FiveStarRoom.QiOperateNextStep == FiveStarOperateType.ChuCard)
                {
                    fiveStarPlayer.FiveStarRoom.FiveStarPlayerDic[fiveStarPlayer.FiveStarRoom.LastMoPaiSeatIndex].CanChuPai();     //最后摸牌的玩家可以出牌
                }
                break;

            case FiveStarOperateType.Peng:
                fiveStarPlayer.SendNewestHands(); //发送玩家最新的手牌信息
                fiveStarPlayer.CanChuPai();       //碰了就可以出牌
                break;

            case FiveStarOperateType.MingGang:
            case FiveStarOperateType.AnGang:
            case FiveStarOperateType.CaGang:
                fiveStarPlayer.SendNewestHands();                                  //发送玩家最新的手牌信息
                fiveStarPlayer.FiveStarRoom.PlayerMoPai(fiveStarPlayer.SeatIndex); //杠的话就摸一张牌
                break;
            }
        }