using System.Collections.Generic;
using System.Linq;
using GameMessage;

namespace GameFix.Poker
{
    public class CardStyle311Helper : CardStyle31Helper
    {
        public override int CardStyle => DataCardConst.CardStyle311;
        public override int CardCnt => 5;

        // 4个相同得带一个是否能够出
        private bool _isSame4Enable = true;
        
        public CardStyle311Helper(){}
        
        public CardStyle311Helper(bool isSame4Enable){ _isSame4Enable = isSame4Enable; }
        
        internal override bool CheckStyleNormal(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
        {
            cardStyleInfo = null;
            if (group.Cards.Count == CardCnt)
            {
                for (int i = 0; i < group.CardGroupList.Count; i++)
                {
                    if (group.CardGroupList[i].Count == 3 || (_isSame4Enable && group.CardGroupList[i].Count == 4))
                    {
                        cardStyleInfo = new CardStyleInfo(CardStyle, i, group.Cards.Count);
                        return true;
                    }
                }
            }
            return false;
        }
    }
}