Example #1
0
        public CardPileViewModel(CardPile pile, TurnContext context, Player player)
        {
            Id        = pile.Id;
            IsLimited = pile.IsLimited;
            Count     = pile.IsLimited ? pile.CardCount : 0;
            Name      = pile.Name;

            if (pile.IsEmpty)
            {
                Cost  = 0;
                Types = new string[] { };
            }
            else
            {
                Cost  = pile.TopCard.Cost;
                Types = pile.TopCard.GetCardTypes();
            }

            var activity = context.Game.GetPendingActivity(player) as SelectPileActivity;
            var canGain  = activity != null && activity.Specification.IsMatch(pile);

            CanBuy = canGain || context.CanBuy(pile, player);
        }