GetCard() public method

public GetCard ( bool>.Func meetConstraint ) : Dominion.Card
meetConstraint bool>.Func
return Dominion.Card
Ejemplo n.º 1
0
 private static void PopulateCardListToCount <T>(int targetCount, List <T> list, UniqueCardPicker <T> cardPicker, Func <T, bool> meetConstraint)
     where T : CardShapedObject
 {
     while (list.Count < targetCount)
     {
         T currentCard = cardPicker.GetCard(meetConstraint);
         if (currentCard == null)
         {
             break;
         }
         list.Add(currentCard);
     }
 }
Ejemplo n.º 2
0
        public void RandomizeKingdom(IEnumerable <Card> allCards, Random random)
        {
            this.kingdomPiles.Clear();
            var cardPicker = new UniqueCardPicker <Card>(allCards, random);

            PopulateCardListToCount(10, this.kingdomPiles, cardPicker, c => c.isKingdomCard);

            if (this.kingdomPiles.Contains(Cards.YoungWitch))
            {
                this.baneCard = cardPicker.GetCard(c => c.isKingdomCard && (c.DefaultCoinCost == 2 || c.DefaultCoinCost == 3));
            }
            else
            {
                this.baneCard = null;
            }
        }
Ejemplo n.º 3
0
 private static void PopulateCardListToCount(int targetCount, List<Card> list, UniqueCardPicker cardPicker, Func<Dominion.Card, bool> meetConstraint)
 {
     while (list.Count < targetCount)
     {
         Dominion.Card currentCard = cardPicker.GetCard(meetConstraint);
         if (currentCard == null)
             break;
         list.Add(currentCard);
     }
 }
Ejemplo n.º 4
0
        public void RandomizeKingdom(IEnumerable<Card> allCards, Random random)
        {
            this.kingdomPiles.Clear();
            var cardPicker = new UniqueCardPicker(allCards, random);
            PopulateCardListToCount(10, this.kingdomPiles, cardPicker, c => c.isKingdomCard);

            if (this.kingdomPiles.Contains(Cards.YoungWitch))
            {
                this.baneCard = cardPicker.GetCard(c => c.isKingdomCard && (c.DefaultCoinCost == 2 || c.DefaultCoinCost == 3));
            }
            else
                this.baneCard = null;
        }