Files
hjha-server/GameFix/Common/Card/StyleChecker/Helper/CardStyle3311SpecialHelper.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) +
game logic (GameFix/GameDAL/ServerData) +
network layer (NetWorkMessage) +
data layer (ObjectModel) +
utilities (MrWu/Core/Config/CloudAPI/dll) +
adapters (zyxAdapter/base)

.NET 8.0 C# solution, 16 projects, 958 source files
2026-07-07 12:02:15 +08:00

71 lines
2.7 KiB
C#

using System.Collections.Generic;
using GameMessage;
namespace GameFix.Poker
{
/// <summary>
/// 飞机 带 4张
/// 最后一手牌可以少带或者不带
/// </summary>
public class CardStyle3311SpecialHelper : CardStyleBaseHelper
{
public override int CardStyle => DataCardConst.CardStyle3311;
public override int CardCnt => 10;
private readonly CardStyle3311Helper _cardStyle3311 = new();
internal override bool CheckStyleNormal(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
{
cardStyleInfo = null;
// 手牌对象才检测
if (group is not CardHandGroup) return false;
// 只要是飞机就可以带剩下得牌
// 先过滤是否看有三个得牌
var cardList = new List<CardGroupList>();
foreach (var cardGroup in group.SelfCardGroupDic)
{
if (cardGroup.Key >= 3)
cardList.AddRange(cardGroup.Value);
}
if (cardList.Count >= 2)
{
if (group.SelfCards.Count == group.Cards.Count)
{
// 剩下得牌都出完
if (IsMaxContinuous(group.CardGroupList, 3, out var shunValueList)
&& shunValueList.Count >= 2
&& shunValueList.Count * 5 >= group.Cards.Count)
{
cardStyleInfo = new CardStyleInfo(CardStyle, shunValueList[0], group.Cards.Count);
return true;
}
return false;
}
return _cardStyle3311.CheckStyleNormal(group, out cardStyleInfo);
}
return false;
}
internal override List<CardGroupList> GetAllEatTipGroup(CardBaseGroup group, CardStyleInfo eatStyleInfo)
{
// 一定要检测手牌
var ret = new List<CardGroupList>();
if (group is not CardHandGroup handGroup) return ret;
if (group.SelfCardGroupDic.TryGetValue(3, out var cardList)
&& cardList.Count >= 2)
{
// 手上得牌是否可以成为飞机
var cardStyle = handGroup.GetCardStyleInfo(group.SelfCards);
if (cardStyle.CardStyle == CardStyle)
{
ret.Add(new CardGroupList(group.SelfCards));
return ret;
}
return _cardStyle3311.GetAllEatTipGroup(group, eatStyleInfo);
}
return ret;
}
}
}