diff --git a/PdkFriendServer/Logic/IsmctsBot.cs b/PdkFriendServer/Logic/IsmctsBot.cs index c7529c81..61cff56d 100644 --- a/PdkFriendServer/Logic/IsmctsBot.cs +++ b/PdkFriendServer/Logic/IsmctsBot.cs @@ -315,62 +315,67 @@ namespace PdkFriendServer.Logic private static void AddMultiCardLeads(TCardInfoPdkF[] hand, int pos, List<(PlayOutCardPdkF play, bool isMulti)> candidates, ref int multiCount) { - // 获取炸弹 + // 炸弹 if (PokerLogic.GetPlayZhaDans(hand, out var bombs) && bombs != null) - { foreach (var bomb in bombs) - { - candidates.Add((new PlayOutCardPdkF - { - Pos = (byte)pos, GameNum = bomb[0].GameNum, - Ids = bomb.Select(c => c.ID).ToArray(), - Type = CardType1.None - }, true)); - multiCount++; - } - } + AddCandidate(bomb, pos, candidates, ref multiCount); - // 获取对子(2张相同) - var pairs = GetMultiGroups(hand, 2); - foreach (var pair in pairs) - { - candidates.Add((new PlayOutCardPdkF - { - Pos = (byte)pos, GameNum = pair[0].GameNum, - Ids = pair.Select(c => c.ID).ToArray(), - Type = CardType1.None - }, true)); - multiCount++; - } + // 对子(2张相同) + foreach (var pair in GetMultiGroups(hand, 2)) + AddCandidate(pair, pos, candidates, ref multiCount); - // 获取三张 + // 三张 / 三带二 var triples = GetMultiGroups(hand, 3); foreach (var t in triples) { - candidates.Add((new PlayOutCardPdkF + // 三带二: 三张 + 附带最小的两张其他牌 + var remainder = hand.Where(c => c.GameNum != t[0].GameNum).OrderBy(c => c.GameNum).ToList(); + if (remainder.Count >= 2) { - Pos = (byte)pos, GameNum = t[0].GameNum, - Ids = t.Select(c => c.ID).ToArray(), - Type = CardType1.None - }, true)); - multiCount++; - } - - // 获取顺子(≥5 张连续) - var straights = PokerLogic.GetShunZi(hand); - if (straights != null) - { - foreach (var s in straights) + var sd2 = t.Concat(remainder.Take(2)).ToList(); + AddCandidate(sd2, pos, candidates, ref multiCount); + } + else { - candidates.Add((new PlayOutCardPdkF - { - Pos = (byte)pos, GameNum = s[0].GameNum, - Ids = s.Select(c => c.ID).ToArray(), - Type = CardType1.None - }, true)); - multiCount++; + AddCandidate(t, pos, candidates, ref multiCount); // 手牌不够带,纯三张 } } + + // 四带二 / 四带三 + var quads = GetMultiGroups(hand, 4); + foreach (var q in quads) + { + var remainder = hand.Where(c => c.GameNum != q[0].GameNum).OrderBy(c => c.GameNum).ToList(); + if (remainder.Count >= 3) + { + var sd3 = q.Concat(remainder.Take(3)).ToList(); + AddCandidate(sd3, pos, candidates, ref multiCount); + } + else if (remainder.Count >= 2) + { + var sd2 = q.Concat(remainder.Take(2)).ToList(); + AddCandidate(sd2, pos, candidates, ref multiCount); + } + // else: 炸弹已在上面处理 + } + + // 顺子(≥5 张连续) + var straights = PokerLogic.GetShunZi(hand); + if (straights != null) + foreach (var s in straights) + AddCandidate(s, pos, candidates, ref multiCount); + } + + private static void AddCandidate(List cards, int pos, + List<(PlayOutCardPdkF play, bool isMulti)> candidates, ref int multiCount) + { + candidates.Add((new PlayOutCardPdkF + { + Pos = (byte)pos, GameNum = cards[0].GameNum, + Ids = cards.Select(c => c.ID).ToArray(), + Type = CardType1.None + }, true)); + multiCount++; } /// 获取指定数量的同面值组合(对子=2,三张=3) diff --git a/exe/PdkFriendServer/PdkFriendServer.dll b/exe/PdkFriendServer/PdkFriendServer.dll index 310b29db..fbb1a1cb 100644 Binary files a/exe/PdkFriendServer/PdkFriendServer.dll and b/exe/PdkFriendServer/PdkFriendServer.dll differ diff --git a/exe/PdkFriendServer/PdkFriendServer.pdb b/exe/PdkFriendServer/PdkFriendServer.pdb index cea4a073..2f0bd0ab 100644 Binary files a/exe/PdkFriendServer/PdkFriendServer.pdb and b/exe/PdkFriendServer/PdkFriendServer.pdb differ diff --git a/exe/hjha-console/PdkFriendServer.dll b/exe/hjha-console/PdkFriendServer.dll index 310b29db..fbb1a1cb 100644 Binary files a/exe/hjha-console/PdkFriendServer.dll and b/exe/hjha-console/PdkFriendServer.dll differ diff --git a/exe/hjha-console/PdkFriendServer.pdb b/exe/hjha-console/PdkFriendServer.pdb index cea4a073..2f0bd0ab 100644 Binary files a/exe/hjha-console/PdkFriendServer.pdb and b/exe/hjha-console/PdkFriendServer.pdb differ diff --git a/exe/hjha-console/hjha-console.dll b/exe/hjha-console/hjha-console.dll index 1390e683..5205ec97 100644 Binary files a/exe/hjha-console/hjha-console.dll and b/exe/hjha-console/hjha-console.dll differ diff --git a/exe/hjha-console/hjha-console.pdb b/exe/hjha-console/hjha-console.pdb index 6aa70681..9a778837 100644 Binary files a/exe/hjha-console/hjha-console.pdb and b/exe/hjha-console/hjha-console.pdb differ