Esempio n. 1
0
        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());
        }
Esempio n. 2
0
 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));
     }
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        private static PileOfCards CreateRuins(CardGameSubset gameSubset, int ruinsCount, Random random)
        {
            if (gameSubset.isInitializing)
            {
                gameSubset.AddCard(Cards.Ruins);
                gameSubset.AddCard(Cards.AbandonedMine);
                gameSubset.AddCard(Cards.RuinedMarket);
                gameSubset.AddCard(Cards.RuinedLibrary);
                gameSubset.AddCard(Cards.RuinedVillage);
                gameSubset.AddCard(Cards.Survivors);
                return(null);
            }
            else
            {
                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);
            }
        }