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
96 lines
3.7 KiB
C#
96 lines
3.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using GameMessage;
|
|
|
|
namespace GameFix.Poker
|
|
{
|
|
public class CardStyle3Helper : CardStyleBaseHelper
|
|
{
|
|
public override int CardStyle => DataCardConst.CardStyle3;
|
|
public override int CardCnt => 3;
|
|
|
|
internal override bool CheckStyleNormal(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
|
|
{
|
|
cardStyleInfo = null;
|
|
if (group.Cards.Count == CardCnt && IsAllSame(group.Cards))
|
|
{
|
|
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 (IsContainJoker(group.NoLZCards)) return false;
|
|
if (group.LZCards.Count == group.Cards.Count && IsAllSame(group.LZCards))
|
|
{
|
|
cardStyleInfo = CardStyleHelper.CreateCardStyleInfo(CardStyle, group.LZCards);
|
|
return true;
|
|
}
|
|
|
|
if (IsAllSame(group.NoLZCards))
|
|
{
|
|
var cardV = group.NoLZCards[0].Value;
|
|
cardStyleInfo = new CardStyleInfo(CardStyle, cardV, CardCnt);
|
|
cardStyleInfo.CardLackValues = Enumerable.Repeat((int)cardV, group.LZCards.Count).ToArray();
|
|
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 && IsSameGroupGreater(cardGroup, eatStyleInfo))
|
|
{
|
|
groupList.Add(new CardGroupList(cardGroup));
|
|
}
|
|
}
|
|
|
|
return groupList;
|
|
}
|
|
|
|
internal override List<CardGroupList> GetAllEatTipGroupWithLZ(CardBaseGroup group, CardStyleInfo eatStyleInfo)
|
|
{
|
|
var cardGroupList = group.CardGroupDic.Where(kv => kv.Key >= 1)
|
|
.SelectMany(kv => kv.Value).OrderByDescending(x=>x.Count).ToList();
|
|
var groupList = new List<CardGroupList>();
|
|
foreach (var cardGroup in cardGroupList)
|
|
{
|
|
if (cardGroup.Count > 0
|
|
&& cardGroup.First().Value > eatStyleInfo.CardValue
|
|
&& !IsJoker(cardGroup))
|
|
{
|
|
var needCnt = CardCnt - cardGroup.Count;
|
|
if (needCnt < group.LZCards.Count)
|
|
{
|
|
List<Card> tmpList = new List<Card>();
|
|
tmpList.AddRange(cardGroup);
|
|
tmpList.AddRange(group.LZCards.GetRange(0, needCnt));
|
|
groupList.Add(new CardGroupList(tmpList));
|
|
}
|
|
}
|
|
}
|
|
|
|
if (groupList.Count == 0
|
|
&& group.LZCards.Count >= CardCnt
|
|
&& IsAllSame(group.LZCards)
|
|
&& group.LZCards.First().Value > eatStyleInfo.CardValue)
|
|
{
|
|
var cardList = group.LZCards.GetRange(0, CardCnt);
|
|
groupList.Add(new CardGroupList(cardList));
|
|
}
|
|
|
|
return groupList;
|
|
}
|
|
}
|
|
} |