Dominion.Strategy.Description.PickByPriorityDescription.HasPotionCard C# (CSharp) Method

HasPotionCard() private method

private HasPotionCard ( ) : bool
return bool
        private bool HasPotionCard()
        {
            return this.descriptions.Where(descr => descr.card == Cards.Potion).Any();
        }

Usage Example

Example #1
0
        public PickByPriorityDescription AddCardInBestLocation(Card card)
        {
            var resultDescriptions = new CardAcceptanceDescription[this.descriptions.Length + 1];

            int currentReadLocation  = 0;
            int currentWriteLocation = 0;

            while (currentReadLocation < this.descriptions.Length)
            {
                if (this.descriptions[currentReadLocation].card.DefaultCoinCost <= card.DefaultCoinCost &&
                    this.descriptions[currentReadLocation].IsConditionedOnlyOnSelfOwnership())
                {
                    break;
                }
                resultDescriptions[currentWriteLocation++] = this.descriptions[currentReadLocation++];
            }

            resultDescriptions[currentWriteLocation++] = new CardAcceptanceDescription(card, new MatchDescription(CountSource.CountAllOwned, card, Comparison.LessThan, 1));

            while (currentReadLocation < this.descriptions.Length)
            {
                resultDescriptions[currentWriteLocation++] = this.descriptions[currentReadLocation++];
            }

            var result = new PickByPriorityDescription(resultDescriptions);

            if (card.potionCost > 0 && !result.HasPotionCard())
            {
                return(result.AddCardInBestLocation(Cards.Potion));
            }

            return(result);
        }
All Usage Examples Of Dominion.Strategy.Description.PickByPriorityDescription::HasPotionCard