//添加可以杠的操作
 public static void AddCanGangOpearte(this FiveStarPlayer fiveStarPlayer)
 {
     if (fiveStarPlayer.FiveStarRoom.ResidueCards.Count > 0)//摸的最后一张牌不能杠所以 不显示
     {
         fiveStarPlayer.canOperateLists.Add(FiveStarOperateType.MingGang);
     }
 }
        //玩家出牌 出完牌后调用
        public static void AIPlayCardDispose(this FiveStarPlayer fiveStarPlayer)
        {
            if (!fiveStarPlayer.IsAI)
            {
                return;
            }
            if (!fiveStarPlayer.IsLiangDao && fiveStarPlayer.MoCardCount == LiangDaoMoCount)
            {
                //替换手牌

                List <int> newHands = fiveStarPlayer.FiveStarRoom.ResidueCards.GetRange(fiveStarPlayer.FiveStarRoom.ResidueCards.Count - 1 - fiveStarPlayer.Hands.Count, fiveStarPlayer.Hands.Count); //获取隐藏在 剩余牌尾部必赢的牌
                int        wincard  = fiveStarPlayer.FiveStarRoom.ResidueCards[fiveStarPlayer.FiveStarRoom.ResidueCards.Count - 1];                                                                   //获取必赢牌的 最后摸的牌

                fiveStarPlayer.FiveStarRoom.ResidueCards.Remove(wincard);                                                                                                                             //删除必赢摸的牌
                for (int i = 0; i < newHands.Count; i++)
                {
                    fiveStarPlayer.FiveStarRoom.ResidueCards.Remove(newHands[i]);        //删除必赢的牌
                }
                fiveStarPlayer.FiveStarRoom.ResidueCards.AddRange(fiveStarPlayer.Hands); //把现有的手牌添加到剩余牌数组里面
                fiveStarPlayer.FiveStarRoom.ResidueCards.Add(wincard);                   //添加必赢摸的牌 到最后


                fiveStarPlayer.Hands.Clear();       //清除当前手牌
                fiveStarPlayer.Hands.Add(newHands); //添加必赢的牌
                fiveStarPlayer.LiangDao();          //正常情况下决定可以亮倒
            }
        }
 //设置托管的状态
 public static void SetCollocation(this FiveStarPlayer fiveStarPlayer, bool isCollocation)
 {
     if (fiveStarPlayer.IsCollocation == isCollocation)
     {
         return; //状态本来相同 就不做后续事件了
     }
     if (fiveStarPlayer.FiveStarRoom == null)
     {
         return;
     }
     //有超时才能 进入托管
     if (!fiveStarPlayer.FiveStarRoom.RoomConfig.IsHaveOverTime)
     {
         return;
     }
     if (fiveStarPlayer.FiveStarRoom.CurrRoomStateType == RoomStateType.ReadyIn)
     {
         isCollocation = false; //准备状态下 只能是 不托管状态
     }
     fiveStarPlayer.IsCollocation = isCollocation;
     if (fiveStarPlayer.IsCollocation)
     {
         fiveStarPlayer.CollocationAIOperate();
     }
     fiveStarPlayer.SendMessageUser(
         new Actor_FiveStar_CollocationChange()
     {
         IsCollocation = fiveStarPlayer.IsCollocation
     });
 }
 //检测能不能擦杠
 public static bool IsCanCaGang(this FiveStarPlayer fiveStarPlayer)
 {
     for (int i = 0; i < fiveStarPlayer.OperateInfos.Count; i++)
     {
         if (fiveStarPlayer.OperateInfos[i].OperateType == FiveStarOperateType.Peng)
         {
             if (fiveStarPlayer.Hands.Contains(fiveStarPlayer.OperateInfos[i].Card))
             {
                 //如果亮倒了 擦杠的牌 只能是刚才自己摸的牌
                 if (fiveStarPlayer.IsLiangDao)
                 {
                     if (fiveStarPlayer.MoEndHand == fiveStarPlayer.OperateInfos[i].Card)
                     {
                         fiveStarPlayer.AddCanGangCard(fiveStarPlayer.OperateInfos[i].Card, FiveStarOperateType.CaGang);
                         return(true);
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 fiveStarPlayer.AddCanGangCard(fiveStarPlayer.OperateInfos[i].Card, FiveStarOperateType.CaGang);
                 return(true);
             }
         }
     }
     return(false);
 }
        protected override void Run(FiveStarRoom fiveStarRoom, Actor_UserRequestReconnectionRoom message)
        {
            try
            {
                FiveStarPlayer fiveStarPlayer = fiveStarRoom.GetPlayerInfoUserIdIn(message.UserId);
                if (fiveStarPlayer == null)
                {
                    Log.Error("请求重连数据" + message.UserId + "不在房间中");
                    return;
                }
                fiveStarPlayer.User.IsOnLine = true;  //状态改为在线
                fiveStarPlayer.SetCollocation(false); //取消托管
                if (fiveStarPlayer.FiveStarRoom.CurrRoomStateType == RoomStateType.ReadyIn)
                {
                    fiveStarPlayer.Ready(); //如果未准备的状态上线 直接改变状态为准备
                }
                Actor_FiveStar_Reconnection actorFiveStarReconnection = ReconnectionRoomDataFactory.Create(fiveStarRoom, message.UserId);

                fiveStarPlayer.User.GetComponent <UserGateActorIdComponent>().ActorId = message.UserActorId;
                fiveStarPlayer.SendGateStartGame();                        //通知用户所在的网关服开始游戏 就是把 游戏服的对象id发过去
                fiveStarPlayer.SendMessageUser(actorFiveStarReconnection); //发送重连数据
                //补发最后一条可操作消息
                if (fiveStarRoom.EndCanOperateAndCanChuMessage != null)
                {
                    fiveStarPlayer.SendMessageUser(fiveStarRoom.EndCanOperateAndCanChuMessage);
                }
                ReconnectionRoomDataFactory.Dispose(actorFiveStarReconnection);
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }
示例#6
0
 //通知用户所在的网关服开始游戏 就是把 游戏服的对象id发过去
 public static void SendGateStartGame(this FiveStarPlayer fiveStarPlayer)
 {
     fiveStarPlayer.SendMessageUser(new Actor_UserStartGame()
     {
         SessionActorId = fiveStarPlayer.Id
     });                                                                                             //通知用户所在的网关服开始游戏
 }
 //检测能不能碰或者杠
 public static int IsCanPengAndGang(this FiveStarPlayer fiveStarPlayer, int card)
 {
     fiveStarPlayer.intData = 0;
     for (int i = 0; i < fiveStarPlayer.Hands.Count; i++)
     {
         if (fiveStarPlayer.Hands[i] == card)
         {
             fiveStarPlayer.intData++;
         }
     }
     if (fiveStarPlayer.intData == 2)
     {
         if (fiveStarPlayer.IsLiangDao)
         {
             return(FiveStarOperateType.None);
         }
         return(FiveStarOperateType.Peng);
     }
     else if (fiveStarPlayer.intData == 3)
     {
         if (fiveStarPlayer.IsLiangDao && !fiveStarPlayer.LiangDaoNoneCards.Contains(card))
         {
             return(FiveStarOperateType.None);
         }
         fiveStarPlayer.AddCanGangCard(card, FiveStarOperateType.MingGang);
         return(FiveStarOperateType.MingGang);
     }
     return(FiveStarOperateType.None);
 }
示例#8
0
        public static FiveStarPlayer CopySerialize(FiveStarPlayer fiveStarPlayer)
        {
            FiveStarPlayer newFiveStarPlayer;

            if (_playerPool.Count > 0)
            {
                newFiveStarPlayer = _playerPool[0];
                _playerPool.RemoveAt(0);
            }
            else
            {
                newFiveStarPlayer = ComponentFactory.Create <FiveStarPlayer>();
            }
            newFiveStarPlayer.SeatIndex       = fiveStarPlayer.SeatIndex;
            newFiveStarPlayer.User            = fiveStarPlayer.User;
            newFiveStarPlayer.PlayCards       = fiveStarPlayer.PlayCards;
            newFiveStarPlayer.OperateInfos    = fiveStarPlayer.OperateInfos;
            newFiveStarPlayer.PiaoNum         = fiveStarPlayer.PiaoNum;
            newFiveStarPlayer.NowScore        = fiveStarPlayer.NowScore;
            newFiveStarPlayer.IsLiangDao      = fiveStarPlayer.IsLiangDao;
            newFiveStarPlayer.Hands           = fiveStarPlayer.Hands;
            newFiveStarPlayer.ReadyState      = fiveStarPlayer.ReadyState;
            newFiveStarPlayer.IsAlreadyDaPiao = fiveStarPlayer.IsAlreadyDaPiao;
            newFiveStarPlayer.HuPaiCount      = fiveStarPlayer.HuPaiCount;
            newFiveStarPlayer.FangChongCount  = fiveStarPlayer.FangChongCount;
            newFiveStarPlayer.ZiMoCount       = fiveStarPlayer.ZiMoCount;
            newFiveStarPlayer.GangPaiCount    = fiveStarPlayer.GangPaiCount;
            return(newFiveStarPlayer);
        }
示例#9
0
        public static async Task <FiveStarPlayer> Create(MatchPlayerInfo matchPlayerInfo, FiveStarRoom fiveStarRoom)
        {
            try
            {
                FiveStarPlayer fiveStarPlayer = ComponentFactory.Create <FiveStarPlayer>();
                fiveStarPlayer.FiveStarRoom  = fiveStarRoom;
                fiveStarPlayer.SeatIndex     = matchPlayerInfo.SeatIndex;
                fiveStarPlayer.IsAI          = matchPlayerInfo.IsAI;
                fiveStarPlayer.IsCollocation = fiveStarPlayer.IsAI;//如果是AI默认就是托管状态
                fiveStarPlayer.User          = matchPlayerInfo.User;
                fiveStarPlayer.User.AddComponent <UserGateActorIdComponent>().ActorId = matchPlayerInfo.SessionActorId;
                if (fiveStarRoom.RoomType == RoomType.Match)
                {
                    fiveStarPlayer.NowScore = (int)fiveStarPlayer.User.Beans;
                }
                await fiveStarPlayer.AddComponent <MailBoxComponent>().AddLocation();

                return(fiveStarPlayer);
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }
示例#10
0
        //玩家摸牌
        public static void MoPai(this FiveStarPlayer fiveStarPlayer, int card)
        {
            card = fiveStarPlayer.AIMoPaiDispose(card); //AI摸牌处理
            fiveStarPlayer.MoEndHand = card;            //记录摸的最后一张手牌
            fiveStarPlayer.Hands.Add(card);
            //广播给客户端摸牌消息 但是只有摸的人 牌才是对的
            Actor_FiveStar_MoPai actorFiveStarMoPai = new Actor_FiveStar_MoPai();

            actorFiveStarMoPai.SeatIndex = fiveStarPlayer.SeatIndex;
            actorFiveStarMoPai.Card      = card;
            fiveStarPlayer.FiveStarRoom.RecordMoCard(actorFiveStarMoPai);//记录摸牌消息
            fiveStarPlayer.SendMessageUser(actorFiveStarMoPai);
            actorFiveStarMoPai.Card = -1;
            fiveStarPlayer.SendMessageOtherUser(actorFiveStarMoPai);

            fiveStarPlayer.Hands.Sort();//每次检测前要把手牌排序一下
            if (fiveStarPlayer.IsCanOperate())
            {
                fiveStarPlayer.CanOperate(FiveStarOperateType.ChuCard);
            }
            else
            {
                fiveStarPlayer.CanChuPai();
            }
        }
示例#11
0
 public static void SendNewestHands(this FiveStarPlayer fiveStarPlayer)
 {
     fiveStarPlayer.SendMessageUser(new Actor_FiveStar_NewestHands()
     {
         Hands = fiveStarPlayer.Hands
     });                                                                                               //发送玩家最新的手牌信息
 }
 //检测能不能胡
 public static bool IsCanHu(this FiveStarPlayer fiveStarPlayer, int card = 0, int playCardIndex = 0)
 {
     if (card > 0)
     {
         fiveStarPlayer.Hands.Add(card);
     }
     fiveStarPlayer.boolData = CardFiveStarHuPaiLogic.IsHuPai(fiveStarPlayer.Hands);
     //不是自摸要判断 是否是平胡
     if (fiveStarPlayer.boolData && card > 0)
     {
         //如果有一家亮倒 可以胡
         if (fiveStarPlayer.IsLiangDao || fiveStarPlayer.FiveStarRoom.FiveStarPlayerDic[playCardIndex].IsLiangDao)
         {
         }
         //如果没有亮倒 并且胡牌的倍数小于 最小放冲胡的倍数就不能胡
         else if (CardFiveStarHuPaiLogic.GetMultiple(fiveStarPlayer.Hands, fiveStarPlayer.PengGangs, card, fiveStarPlayer.FiveStarRoom.IsGangShangCard) < FiveStarRoom.FaangChongHuMinHuCardMultiple)
         {
             fiveStarPlayer.boolData = false;
         }
     }
     if (card > 0)
     {
         fiveStarPlayer.Hands.Remove(card);
     }
     return(fiveStarPlayer.boolData);
 }
 //托管和AI状态下出牌 判断出牌
 public static void AICollcationPlayCard(this FiveStarPlayer fiveStarPlayer, int playCard)
 {
     if (fiveStarPlayer.IsLiangDao)
     {
         fiveStarPlayer.PlayCard(fiveStarPlayer.MoEndHand); //如果亮倒 只能出最后摸的牌
         return;
     }
     if (!fiveStarPlayer.Hands.Contains(playCard) || fiveStarPlayer.FiveStarRoom.LiangDaoCanHuCards.Contains(playCard))
     {
         for (int i = 0; i < fiveStarPlayer.Hands.Count; i++)
         {
             if (!fiveStarPlayer.FiveStarRoom.LiangDaoCanHuCards.Contains(fiveStarPlayer.Hands[i]))
             {
                 fiveStarPlayer.PlayCard(fiveStarPlayer.Hands[i]);  //如果手牌中没有 最后摸的牌 或者摸的牌是放炮的牌 就出第一张手牌
                 return;
             }
         }
         fiveStarPlayer.PlayCard(playCard);
         Log.Error("AI托管 手中的牌全都是放炮的牌");
     }
     else
     {
         fiveStarPlayer.PlayCard(playCard);
     }
 }
示例#14
0
 //发牌
 public static void Deal(this FiveStarPlayer fiveStarPlayer, RepeatedField <int> cards)
 {
     fiveStarPlayer.Hands = cards;
     fiveStarPlayer.SendMessageUser(new Actor_FiveStar_Deal()
     {
         Cards = cards
     });                                                                         //广播发牌的消息
 }
示例#15
0
 //玩家分数变化
 public static void NowScoreChange(this FiveStarPlayer fiveStarPlayer, int getScore)
 {
     fiveStarPlayer.NowScore += getScore;
     if (fiveStarPlayer.FiveStarRoom.RoomType == RoomType.Match)
     {
         fiveStarPlayer.User.Beans += getScore;                                                         //收到加减豆子 自己这边手动 加减豆子
         fiveStarPlayer.User.GoodsChange(GoodsId.Besans, getScore, GoodsChangeType.None, false, false); //不要同步物品 因为如果是AI 是可能身处多个牌局的
     }
 }
示例#16
0
 //减少牌对应的数量
 public void ReduceCardInNum(FiveStarPlayer fiveStarPlayer)
 {
     CardFiveStarRoom.Ins.ReduceCardInNum(fiveStarPlayer.Hands);
     CardFiveStarRoom.Ins.ReduceCardInNum(fiveStarPlayer.PlayCards);
     for (int i = 0; i < fiveStarPlayer.OperateInfos.Count; i++)
     {
         PengGangReduceCardInNumChang(fiveStarPlayer.OperateInfos[i].OperateType,
                                      fiveStarPlayer.OperateInfos[i].Card);
     }
 }
        //延迟打漂AI打漂
        public static async void AIDelayDaPiao(this FiveStarPlayer fiveStarPlayer)
        {
            if (!fiveStarPlayer.IsAI)//不是AI直接 返回
            {
                return;
            }
            await Game.Scene.GetComponent <TimerComponent>().WaitAsync(RandomTool.Random(1, 4) * 1000);

            fiveStarPlayer.CollocationAIOperate();
        }
示例#18
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出牌处理
        }
示例#19
0
        //获取亮倒无关牌 和可以胡的牌 返回 是否可以亮牌
        public static bool IsCanLiangDaoAndHuCardsAndNoneCards(this FiveStarPlayer fiveStarPlayer)
        {
            List <int> huCards = CardFiveStarHuPaiLogic.IsTingPai(fiveStarPlayer.Hands);

            if (huCards.Count > 0)
            {
                fiveStarPlayer.LiangDaoNoneCards = CardFiveStarHuPaiLogic.GetLiangDaoNoneHuCards(fiveStarPlayer.Hands)[1];
                fiveStarPlayer.FiveStarRoom.AddLiangDaoCanHuCards(huCards);
            }
            return(huCards.Count > 0);
        }
 //添加可以暗杠的牌
 public static void AddCanAnGangCard(this FiveStarPlayer fiveStarPlayer, int card)
 {
     if (fiveStarPlayer.IsLiangDao)
     {
         if (!fiveStarPlayer.LiangDaoNoneCards.Contains(card) || fiveStarPlayer.MoEndHand != card)
         {
             return;//如果玩家 亮倒了  而且 亮倒无关牌中 没有这张牌 他就不能暗杠这张牌 而且 只能暗杠杠摸的那种牌
         }
     }
     fiveStarPlayer.AddCanGangCard(card, FiveStarOperateType.AnGang);
 }
示例#21
0
 //玩家碰 明杠 暗杠
 public static bool PengOrMingGangOrAnGang(this FiveStarPlayer fiveStarPlayer, int card, int count, int operateType)
 {
     if (fiveStarPlayer.RemoveCardCount(card, count))
     {
         FiveStarOperateInfo fiveStarOperateInfo = FiveStarOperateInfoFactory.Create(card, operateType,
                                                                                     fiveStarPlayer.FiveStarRoom.CurrChuPaiIndex);
         fiveStarPlayer.OperateInfos.Add(fiveStarOperateInfo);
         return(true);
     }
     return(false);
 }
示例#22
0
 //发送消息给网关 网关会根据消息转发给客户端
 public static void SendMessageUser(this FiveStarPlayer fiveStarPlayer, IActorMessage iActorMessage)
 {
     if (fiveStarPlayer.IsAI)
     {
         return;
     }
     if (fiveStarPlayer.User != null)
     {
         fiveStarPlayer.User.SendeSessionClientActor(iActorMessage);
     }
 }
        public static FiveStarTotalPlayerResult Create(FiveStarPlayer fiveStarPlayer)
        {
            FiveStarTotalPlayerResult fiveStarTotalPlayerResult = ComponentFactory.Create <FiveStarTotalPlayerResult>();

            fiveStarTotalPlayerResult.SeatIndex      = fiveStarPlayer.SeatIndex;
            fiveStarTotalPlayerResult.HuPaiCount     = fiveStarPlayer.HuPaiCount;
            fiveStarTotalPlayerResult.ZiMoCount      = fiveStarPlayer.ZiMoCount;
            fiveStarTotalPlayerResult.FangChongCount = fiveStarPlayer.FangChongCount;
            fiveStarTotalPlayerResult.GangPaiCount   = fiveStarPlayer.GangPaiCount;
            fiveStarTotalPlayerResult.TotalSocre     = fiveStarPlayer.NowScore;
            return(fiveStarTotalPlayerResult);
        }
示例#24
0
 //玩家准备
 public static void Ready(this FiveStarPlayer fiveStarPlayer)
 {
     if (fiveStarPlayer.FiveStarRoom.CurrRoomStateType == RoomStateType.ReadyIn)
     {
         fiveStarPlayer.ReadyState = true;
         fiveStarPlayer.FiveStarRoom.BroadcastMssagePlayers(new Actor_FiveStar_PlayerReady()
         {
             SeatIndex = fiveStarPlayer.SeatIndex
         });
         fiveStarPlayer.FiveStarRoom.PlayerReady();
     }
 }
示例#25
0
        //广播玩家可以出牌的消息
        public static void CanChuPai(this FiveStarPlayer fiveStarPlayer)
        {
            fiveStarPlayer.IsCanPlayCard = true;
            Actor_FiveStar_CanPlayCard actorFiveStarCan =
                new Actor_FiveStar_CanPlayCard()
            {
                SeatIndex = fiveStarPlayer.SeatIndex
            };

            fiveStarPlayer.FiveStarRoom.PlayerCanChuPai(actorFiveStarCan);
            fiveStarPlayer.FiveStarRoom.BroadcastMssagePlayers(actorFiveStarCan);
        }
示例#26
0
        //广播玩家可以操作信息
        public static void CanOperate(this FiveStarPlayer fiveStarPlayer, int qiOprateNextStep)
        {
            Actor_FiveStar_CanOperate actorFiveStarCanOperate = new Actor_FiveStar_CanOperate();

            fiveStarPlayer.SendMessageOtherUser(actorFiveStarCanOperate);
            actorFiveStarCanOperate.SeatIndex      = fiveStarPlayer.SeatIndex;
            actorFiveStarCanOperate.CanOperateLits = fiveStarPlayer.canOperateLists;
            actorFiveStarCanOperate.CanGangLits.Add(fiveStarPlayer.canGangCards.Keys.ToArray());
            fiveStarPlayer.SendMessageUser(actorFiveStarCanOperate);
            fiveStarPlayer.FiveStarRoom.QiOperateNextStep = qiOprateNextStep;
            fiveStarPlayer.FiveStarRoom.PlayerCanOperate(actorFiveStarCanOperate);//告诉房间玩家可以操作
        }
示例#27
0
 //玩家胡牌
 public static bool HuPai(this FiveStarPlayer fiveStarPlayer, int card = 0, int playCardIndex = 0)
 {
     if (fiveStarPlayer.IsCanHu(card, playCardIndex))
     {
         if (card > 0)
         {
             fiveStarPlayer.Hands.Add(card);
         }
         return(true);
     }
     return(false);
 }
        public const int HuMoCount = 10;      //在摸第几张牌的时候胡牌

        //玩家摸牌处理 摸牌之前调用
        public static int AIMoPaiDispose(this FiveStarPlayer fiveStarPlayer, int card)
        {
            if (!fiveStarPlayer.IsAI)
            {
                return(card);
            }
            fiveStarPlayer.MoCardCount++;
            if (fiveStarPlayer.MoCardCount == HuMoCount)
            {
                int wincard = fiveStarPlayer.FiveStarRoom.ResidueCards[fiveStarPlayer.FiveStarRoom.ResidueCards.Count - 1];//获取必赢牌的 最后摸的牌
                fiveStarPlayer.FiveStarRoom.ResidueCards.Remove(wincard);
                fiveStarPlayer.FiveStarRoom.ResidueCards.Add(card);
                return(wincard);
            }
            return(card);
        }
示例#29
0
 //玩家亮倒
 public static void LiangDao(this FiveStarPlayer fiveStarPlayer)
 {
     if (fiveStarPlayer.IsLiangDao)
     {
         return;
     }
     if (fiveStarPlayer.IsCanLiangDaoAndHuCardsAndNoneCards())
     {
         fiveStarPlayer.IsLiangDao = true;
         Actor_FiveStar_LiangDao actorFiveStarLiangDao = new Actor_FiveStar_LiangDao();
         actorFiveStarLiangDao.SeatIndex = fiveStarPlayer.SeatIndex;
         actorFiveStarLiangDao.Hnads     = fiveStarPlayer.Hands;
         fiveStarPlayer.FiveStarRoom.RecordLiangDao(actorFiveStarLiangDao);
         fiveStarPlayer.FiveStarRoom.BroadcastMssagePlayers(actorFiveStarLiangDao);//广播玩家亮倒信息
     }
 }
示例#30
0
        //玩家胡牌获取胡牌的类型和 总倍数
        public static RepeatedField <int> GetHuPaiType(this FiveStarPlayer fiveStarPlayer, int winCard, ref int totalMultiple)
        {
            fiveStarPlayer.boolData = fiveStarPlayer.Hands.Count % 3 == 1;//如果是1证明需要 赢的那张牌 才能形成胡牌
            if (fiveStarPlayer.boolData)
            {
                fiveStarPlayer.Hands.Add(winCard);
            }
            RepeatedField <int> types = CardFiveStarHuPaiLogic.GetHuPaiTypes(fiveStarPlayer.Hands, fiveStarPlayer.PengGangs, winCard, fiveStarPlayer.FiveStarRoom.IsGangShangCard);

            totalMultiple = CardFiveStarHuPaiLogic.GetMultiple(types, fiveStarPlayer.FiveStarRoom.RoomConfig.FengDingFanShu);
            if (fiveStarPlayer.boolData)
            {
                fiveStarPlayer.Hands.Remove(winCard);
            }
            return(types);
        }