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; }
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); } }
public void GenerateCompletelyRandomKingdom(IEnumerable<Card> allCards, Random random) { var cardPicker = new UniqueCardPicker(allCards, random); this.RandomizeKingdom(allCards, random); this.RandomizeEvents(random); this.ReRollPlatinumColony(random); this.ReRollShelter(random); }