diff --git a/PdkFriendServer/Logic/SOIsmctsBot.cs b/PdkFriendServer/Logic/SOIsmctsBot.cs index af6e39c2..ba1eb1c4 100644 --- a/PdkFriendServer/Logic/SOIsmctsBot.cs +++ b/PdkFriendServer/Logic/SOIsmctsBot.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using GameFix.PaoDeKuaiF; +using GameFix.Poker; using GameMessage; using GameMessage.PaoDeKuaiF; @@ -273,19 +274,41 @@ namespace PdkFriendServer.Logic foreach (var t in tips) candidates.Add((MakePlay(t, view.MyPos), t.Count > 1)); if (isFirstPlay) - { - var pairs = hand.GroupBy(c => c.GameNum).Where(g => g.Count() >= 2); - foreach (var g in pairs) - { - var p = g.Take(2).ToList(); - candidates.Add((new PlayOutCardPdkF { Pos = (byte)view.MyPos, GameNum = p[0].GameNum, Ids = p.Select(c => c.ID).ToArray(), Type = CardType1.DuiZi }, true)); - } - } + AddMultiCardLeads(hand, view.MyPos, candidates); if (!isFirstPlay) candidates.Add((Pass(view), false)); return candidates; } + // 复用 IsmctsBot 的多牌枚举(对子/三张/顺子/飞机/炸弹/连对) + private static void AddMultiCardLeads(TCardInfoPdkF[] hand, int pos, + List<(PlayOutCardPdkF, bool)> candidates) + { + var make = (List cards) => candidates.Add(( + new PlayOutCardPdkF { Pos = (byte)pos, GameNum = cards[0].GameNum, Ids = cards.Select(c => c.ID).ToArray(), Type = InferType(cards) }, true)); + + if (PokerLogic.GetPlayZhaDans(hand, out var bombs) && bombs != null) + foreach (var b in bombs) make(b); + foreach (var g in hand.GroupBy(c => c.GameNum).Where(g => g.Count() >= 2)) + make(g.Take(2).ToList()); + foreach (var g in hand.GroupBy(c => c.GameNum).Where(g => g.Count() >= 3)) + make(g.Take(3).ToList()); + var straights = PokerLogic.GetShunZi(hand); + if (straights != null) foreach (var s in straights) make(s); + } + + private static CardType1 InferType(List cards) + { + int n = cards.Count; + if (n == 1) return CardType1.DanZhang; + if (n == 2) return CardType1.DuiZi; + var cnts = cards.GroupBy(c => c.GameNum).Select(g => g.Count()).OrderByDescending(x => x).ToList(); + if (cnts[0] == 4) { if (n == 4) return CardType1.ZhaDan; if (n == 6) return CardType1.SiDai2; if (n == 7) return CardType1.SiDai3; } + if (cnts[0] >= 3) return CardType1.SanZhang; + if (cnts[0] == 2 && n % 2 == 0) return CardType1.LianDui; + return CardType1.ShunZi; + } + private static PlayOutCardPdkF MakePlay(List cards, int pos) => new PlayOutCardPdkF { Pos = (byte)pos, GameNum = cards[0].GameNum, Ids = cards.Select(x => x.ID).ToArray(), Type = CardType1.DanZhang }; diff --git a/exe/PdkFriendServer/PdkFriendServer.dll b/exe/PdkFriendServer/PdkFriendServer.dll index ce9a6698..7d2ad18d 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 927624e9..f32b7781 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 ce9a6698..7d2ad18d 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 927624e9..f32b7781 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 8d28fcc7..db94b882 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 2ca9a579..5b4768fc 100644 Binary files a/exe/hjha-console/hjha-console.pdb and b/exe/hjha-console/hjha-console.pdb differ