Esempio n. 1
0
        public CardPack CreateGamePack()
        {
            CustomCardPack pack = new CustomCardPack();

            pack.displayMode = CardPack.DisplayMode.Full;

            // TODO: написать реализацию
            pack.canAccept = (cp) =>
            {
                if (pack.Count == 0)
                {
                    return(true);
                }
                if (Card.CardColor(cp.FirstCard) == Card.CardColor(pack.LastCard) ||
                    Card.Dignity(cp.FirstCard) >= Card.Dignity(pack.LastCard))
                {
                    return(false);
                }
                return(true);
            };

            pack.canGive = (count) =>
            {
                return(count <= pack.Count);
            };

            return(pack);
        }
Esempio n. 2
0
        public CardPack CreateBasePack()
        {
            CustomCardPack pack = new CustomCardPack();

            pack.displayMode = CardPack.DisplayMode.OnlyLast;

            pack.canAccept = (cp) =>
            {
                if (pack.Count == 0)
                {
                    return(cp.Count == 1 && Card.Dignity(cp.FirstCard) == 0);
                }
                return(cp.Count == 1 &&
                       Card.Suit(cp.FirstCard) == Card.Suit(pack.LastCard) &&
                       Card.Dignity(cp.FirstCard) - Card.Dignity(pack.LastCard) == 1);
            };

            pack.canGive = (count) =>
            {
                return(false);
            };

            return(pack);
        }