feat: AddMultiCardLeads 补全 — 三带二/四带二/四带三

引擎支持(GetOutCard已验证): DanZhang/DuiZi/SanDai2/ShunZi/LianDui/
  FeiJi/ZhaDan/SiDai2/SiDai3/FeijiDai2

AddMultiCardLeads 新增:
- 三带二: 三张相同 + 附带手牌最小的2张
- 四带二: 四张相同 + 附带2张 (优先四带三)

10局验证: DuiZi 54 | DanZhang 53 | ShunZi 16 | SanDai2 13 | SiDai 2
单张比例: 100% → 38%
This commit is contained in:
2026-07-07 14:22:48 +08:00
parent 5547f75b5a
commit 2dd0bc3f78
7 changed files with 50 additions and 45 deletions

View File

@ -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<TCardInfoPdkF> 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++;
}
/// <summary>获取指定数量的同面值组合(对子=2三张=3</summary>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.