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
79 lines
2.9 KiB
C#
79 lines
2.9 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using GameMessage;
|
|
|
|
namespace GameFix.Poker
|
|
{
|
|
public class CardStyle1Helper : CardStyleBaseHelper
|
|
{
|
|
public override int CardStyle => DataCardConst.CardStyle1;
|
|
public override int CardCnt => 1;
|
|
|
|
internal override bool CheckStyleNormal(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
|
|
{
|
|
cardStyleInfo = null;
|
|
if (group.Cards.Count == CardCnt)
|
|
{
|
|
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) return false;
|
|
// 单张癞子只能当普通牌
|
|
if (group.LZCards.Count == group.Cards.Count)
|
|
{
|
|
cardStyleInfo = CardStyleHelper.CreateCardStyleInfo(CardStyle, group.LZCards);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
internal override List<CardGroupList> GetAllEatTipGroup(CardBaseGroup group, CardStyleInfo eatStyleInfo)
|
|
{
|
|
var groupCnt = group.CardGroupList.Count;
|
|
var groupList = new List<CardGroupList>(groupCnt);
|
|
for (int i = 0; i < groupCnt; i++)
|
|
{
|
|
var cardGroup = group.CardGroupList[i];
|
|
if (cardGroup.Count >= CardCnt && cardGroup.Count < 4 && IsSameGroupGreater(cardGroup, eatStyleInfo))
|
|
{
|
|
groupList.Add(new CardGroupList(cardGroup));
|
|
}
|
|
}
|
|
|
|
// 从单牌到三张排序,优先不拆组合牌
|
|
if (groupList.Count > 0)
|
|
{
|
|
groupList = groupList.OrderBy(x=>x.Count).ToList();
|
|
groupList.ForEach(x => x.RemoveRange(1, x.Count - 1));
|
|
}
|
|
|
|
return groupList;
|
|
}
|
|
|
|
internal override List<CardGroupList> GetAllEatTipGroupWithLZ(CardBaseGroup group, CardStyleInfo eatStyleInfo)
|
|
{
|
|
// 在常规情况下没有找到单牌可以出 (说明只剩下癞子)
|
|
// 单牌也只能按原始牌值出
|
|
var groupList = new List<CardGroupList>(group.LZCards.Count);
|
|
for (int i = 0; i < group.LZCards.Count; i++)
|
|
{
|
|
var lzCard = group.LZCards[i];
|
|
if (lzCard.Value > eatStyleInfo.CardValue)
|
|
{
|
|
var lzCards = new CardGroupList();
|
|
lzCards.Add(lzCard);
|
|
groupList.Add(lzCards);
|
|
}
|
|
}
|
|
|
|
return groupList;
|
|
}
|
|
}
|
|
} |