//检测能不能胡 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); }
//玩家胡牌获取胡牌的类型和 总倍数 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); }
//获取打这张牌的胡牌倍数 public int GetCardInMultiple(int winCard, int chuCard = -1) { if (_HuCardInMultiple.ContainsKey(chuCard)) { if (_HuCardInMultiple[chuCard].ContainsKey(winCard)) { return(_HuCardInMultiple[chuCard][winCard]); } } RepeatedField <int> copyHand = new RepeatedField <int>() { _NewestHands }; if (chuCard > 0) { copyHand.Remove(chuCard); } copyHand.Add(winCard); int multiple = CardFiveStarHuPaiLogic.GetMultiple(copyHand, CardFiveStarRoom.Ins.GetUserPlayerInfo()._PengGangArray, winCard); if (_HuCardInMultiple.ContainsKey(chuCard)) { _HuCardInMultiple[chuCard].Add(winCard, multiple); } else { _HuCardInMultiple.Add(chuCard, new Dictionary <int, int>() { { winCard, multiple } }); } return(multiple); }