Files
hjha-server/GameFix/Common/Card/StyleChecker/Helper/CardStyle510KHelper.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

82 lines
3.1 KiB
C#

using System.Collections.Generic;
using System.Linq;
using GameMessage;
namespace GameFix.Poker
{
public class CardStyle510KHelper : CardStyleBaseHelper
{
public override int CardStyle => DataCardConst.CardStyle510K;
public override int CardCnt => 3;
protected List<int> V_510K = new List<int>(){DataCardConst.CardValue5, DataCardConst.CardValue10, DataCardConst.CardValueK};
internal override bool CheckStyleNormal(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
{
cardStyleInfo = null;
if (group.Cards.Count == CardCnt)
{
var values = group.Cards.Select(x=>(int)x.Value).ToList();
values.Sort();
if (V_510K.SequenceEqual(values))
{
cardStyleInfo = CardStyleHelper.CreateCardStyleInfo(CardStyle, group.Cards);
return true;
}
}
return false;
}
internal override bool CheckStyleWithLZ(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
{
cardStyleInfo = null;
if (group.Cards.Count == CardCnt && group.LZCards.Count == 1)
{ // 只有一个癞子,不然会被当成三个相同
var values = group.Cards.Select(x=>(int)x.Value).ToList();
var exceptV = values.Except(V_510K).ToList();
if (exceptV.Count == 1)
{ // 只有一个不同
cardStyleInfo = CardStyleHelper.CreateCardStyleInfo(CardStyle, group.Cards);
cardStyleInfo.CardLackValues = new[] { exceptV.First() };
return true;
}
}
return false;
}
internal override List<CardGroupList> GetAllEatTipGroup(CardBaseGroup group, CardStyleInfo eatStyleInfo)
{
var groupList = new List<CardGroupList>(1);
CardGroupList cardGroupList = new CardGroupList();
for (int i = 0; i < V_510K.Count; i++)
{
if (group.CardGroupList[V_510K[i]].Count > 0)
cardGroupList.Add(group.CardGroupList[V_510K[i]].First());
}
if (cardGroupList.Count == CardCnt)
groupList.Add(cardGroupList);
return groupList;
}
internal override List<CardGroupList> GetAllEatTipGroupWithLZ(CardBaseGroup group, CardStyleInfo eatStyleInfo)
{
var groupList = new List<CardGroupList>(1);
CardGroupList cardGroupList = new CardGroupList();
for (int i = 0; i < V_510K.Count; i++)
{
if (group.CardGroupList[V_510K[i]].Count > 0)
cardGroupList.Add(group.CardGroupList[V_510K[i]].First());
}
if (cardGroupList.Count == 2)
{
cardGroupList.Add(group.LZCards.First());
groupList.Add(cardGroupList);
}
return new List<CardGroupList>(0);
}
}
}