private PileOfCards[] GetNonSupplyPiles(CardGameSubset gameSubset) { var nonSupplyCardPiles = new List <PileOfCards>(); if (this.useShelters) { gameSubset.AddCard(Cards.Necropolis); gameSubset.AddCard(Cards.Hovel); gameSubset.AddCard(Cards.OvergrownEstate); } if (this.kingdomPiles.Where(card => card.requiresSpoils).Any()) { Add(gameSubset, nonSupplyCardPiles, 16, Cards.Spoils); } if (this.kingdomPiles.Where(card => card == Cards.Hermit).Any()) { Add(gameSubset, nonSupplyCardPiles, 10, Cards.Madman); } if (this.kingdomPiles.Where(card => card == Cards.Urchin).Any()) { Add(gameSubset, nonSupplyCardPiles, 10, Cards.Mercenary); } if (this.kingdomPiles.Where(card => card == Cards.Tournament).Any()) { Add(gameSubset, nonSupplyCardPiles, 10, Cards.Mercenary); } return(nonSupplyCardPiles.ToArray()); }
private static PileOfCards CreateRuins(CardGameSubset gameSubset, int ruinsCount, Random random) { int ruinCountPerPile = 10; var allRuinsCards = new ListOfCards(gameSubset); allRuinsCards.AddNCardsToTop(Cards.AbandonedMine, ruinCountPerPile); allRuinsCards.AddNCardsToTop(Cards.RuinedMarket, ruinCountPerPile); allRuinsCards.AddNCardsToTop(Cards.RuinedLibrary, ruinCountPerPile); allRuinsCards.AddNCardsToTop(Cards.RuinedVillage, ruinCountPerPile); allRuinsCards.AddNCardsToTop(Cards.Survivors, ruinCountPerPile); allRuinsCards.Shuffle(random); var result = new PileOfCards(gameSubset, Cards.Ruins); for (int i = 0; i < ruinsCount; ++i) { Card card = allRuinsCards.DrawCardFromTop(); if (card == null) { throw new Exception("Not enough ruins available."); } result.AddCardToTop(card); } result.EraseKnownCountKnowledge(); return(result); }
private static void Add(CardGameSubset gameSubset, List <PileOfCards> cardPiles, int initialCount, Card protoType) { if (gameSubset.isInitializing) { gameSubset.AddCard(protoType); } else { cardPiles.Add(new PileOfCards(gameSubset, protoType, initialCount)); } }
private PileOfCards[] GetSupplyPiles(int playerCount, Random random, CardGameSubset gameSubset) { var supplyCardPiles = new List <PileOfCards>(capacity: 20); int curseCount = (playerCount - 1) * 10; int ruinsCount = curseCount; int victoryCount = (playerCount == 2) ? 8 : 12; // cards always in the supply Add(gameSubset, supplyCardPiles, 60, Cards.Copper); Add(gameSubset, supplyCardPiles, 40, Cards.Silver); Add(gameSubset, supplyCardPiles, 30, Cards.Gold); Add(gameSubset, supplyCardPiles, curseCount, Cards.Curse); Add(gameSubset, supplyCardPiles, victoryCount + (!this.useShelters ? playerCount * 3 : 0), Cards.Estate); Add(gameSubset, supplyCardPiles, victoryCount, Cards.Duchy); Add(gameSubset, supplyCardPiles, victoryCount, Cards.Province); if (this.useColonyAndPlatinum) { Add(gameSubset, supplyCardPiles, victoryCount, Cards.Colony); Add(gameSubset, supplyCardPiles, 20, Cards.Platinum); } if (this.kingdomPiles.Where(card => card.potionCost != 0).Any()) { Add(gameSubset, supplyCardPiles, 16, Cards.Potion); } if (this.kingdomPiles.Where(card => card.requiresRuins).Any()) { supplyCardPiles.Add(CreateRuins(gameSubset, ruinsCount, random)); } foreach (Card card in this.kingdomPiles) { if (card.isVictory) { Add(gameSubset, supplyCardPiles, victoryCount, card); } else { Add(gameSubset, supplyCardPiles, card.defaultSupplyCount, card); } } return(supplyCardPiles.ToArray()); }
public GameConfig( GameDescription gameDescription, MapPlayerGameConfigToCardSet startingDecks = null, MapPlayerGameConfigToCardSet startingHands = null) { this.gameDescription = gameDescription; this.startingDeck = startingDecks; this.startingHand = startingHands; this.cardGameSubset = new CardGameSubset(); var availabilities = GetCardAvailability(1, CardAvailabilityType.AllPossibleCardsInGame); foreach (var availability in availabilities) { this.cardGameSubset.AddCard(availability.card); } }
public GameConfig( Card[] supplyPiles, bool useShelters, bool useColonyAndPlatinum, MapPlayerGameConfigToCardSet startingDecks = null, MapPlayerGameConfigToCardSet startingHands = null) { this.useShelters = useShelters; this.useColonyAndPlatinum = useColonyAndPlatinum; this.kingdomPiles = supplyPiles; this.startingDeck = startingDecks; this.startingHand = startingHands; this.cardGameSubset = new CardGameSubset(); GetSupplyPiles(1, null, this.cardGameSubset); GetNonSupplyPiles(this.cardGameSubset); this.cardGameSubset.isInitializing = false; }
public GameConfig( Card[] kingdomPiles, Card baneCard, bool useShelters, bool useColonyAndPlatinum, MapPlayerGameConfigToCardSet startingDecks = null, MapPlayerGameConfigToCardSet startingHands = null) { this.useShelters = useShelters; this.useColonyAndPlatinum = useColonyAndPlatinum; this.kingdomPiles = kingdomPiles; this.startingDeck = startingDecks; this.startingHand = startingHands; this.baneCard = baneCard; this.cardGameSubset = new CardGameSubset(); var availabilities = GetCardAvailability(1, CardAvailabilityType.AllPossibleCardsInGame); foreach (var availability in availabilities) { this.cardGameSubset.AddCard(availability.card); } }
private static PileOfCards CreateTournamentPrizes(CardGameSubset gameSubset) { Card[] prizes = { Cards.BagOfGold, Cards.Diadem, Cards.Followers, Cards.Princess, Cards.TrustySteed }; if (gameSubset.isInitializing) { gameSubset.AddCard(Cards.Prize); foreach (Card prize in prizes) { gameSubset.AddCard(prize); } return(null); } else { var result = new PileOfCards(gameSubset, Cards.Prize); foreach (Card prize in prizes) { result.AddCardToTop(prize); } return(result); } }
public PileOfCards(CardGameSubset gameSubset, Card protoType) : base(gameSubset) { this.protoType = protoType; }
public PileOfCards(CardGameSubset gameSubset, Card protoType, int count) : base(gameSubset) { this.AddNCardsToTop(protoType, count); this.protoType = protoType; }
public ListOfCards(CardGameSubset gameSubset) : base(gameSubset, null) { }
public CollectionCards(CardGameSubset gameSubset, BagOfCards parent) { this.parent = parent; this.gameSubset = gameSubset; this.mapGameCardIndexToCount = new int[this.gameSubset.CountOfCardTypesInGame]; }
internal PlayerTurnCounters(CardGameSubset gameSubset) { cardsBannedFromPurchase = new SetOfCards(gameSubset); cardsBoughtThisTurn = new SetOfCards(gameSubset); cardsGainedThisTurn = new SetOfCards(gameSubset); }
public Enumerator(CardGameSubset cardGameSubset) { this.currentIndex = -1; this.cardGameSubset = cardGameSubset; }
public BagOfCards(CardGameSubset gameSubset) : this(gameSubset, null) { }
public BagOfCards(CardGameSubset gameSubset, BagOfCards parent) : base(gameSubset, parent) { }
public MapOfCardsForGameSubset(CardGameSubset gameSubset) { this.gameSubset = gameSubset; this.mapCardIndexToResult = new T[gameSubset.CountOfCardTypesInGame]; }