Example #1
0
        public GameState drawPlayerCards(Player cp, int num = 2)
        {
            GameState newGS = new GameState(this);

            for (int i = 0; i < num; i++)
            {
                if (newGS.playerDeck.isNextCardEpidemic())
                {
                    newGS.epidemicCard();
                    newGS.playerDeck.cardWeAreOn++;
                }
                else
                {
                    newGS.playerDeck = newGS.playerDeck.draw(1);
                    if (newGS.playerDeck.isOverdrawn)
                    {
                        //we just lost
                        return(newGS);
                    }
                    newGS = newGS.adjustPlayer(cp.addCard(newGS.playerDeck.mostRecent(1)[0]));
                    newGS.recalcForAddCard(cp, newGS.playerDeck.mostRecent(1)[0]);
                }
            }

            return(newGS);
        }
Example #2
0
 public void epidemicTest()
 {
     Map map = new Map();
     City atl = map.addCity("Atlanta", DiseaseColor.BLUE);
     City ny = map.addCity("New York", DiseaseColor.BLUE);
     City.makeAdjacent(atl,ny);
     Deck<City> playerDeck = new Deck<City>(map.allCities);
     int infectRate;
     GameState gs = new GameState(atl, map, 1, 4, new Deck<City>(map.allCities), playerDeck);
     infectRate = gs.map.infectionRate;
     gs.epidemicCard();
     
     Assert.IsTrue(gs.map.diseaseLevel(atl, DiseaseColor.BLUE) == 3 || gs.map.diseaseLevel(ny, DiseaseColor.BLUE) == 3);
     Assert.AreEqual(infectRate + 1, gs.map.infectionRate);
 }
Example #3
0
        public GameState drawPlayerCards(Player cp, int num = 2)
        {
            GameState newGS = new GameState(this);
            for (int i = 0; i < num; i++)
            {
                if (newGS.playerDeck.isNextCardEpidemic())
                {

                    newGS.epidemicCard();
                    newGS.playerDeck.cardWeAreOn++;
                }
                else
                {
                    newGS.playerDeck = newGS.playerDeck.draw(1);
                    if (newGS.playerDeck.isOverdrawn)
                    {
                        //we just lost
                        return newGS;
                    }
                    newGS = newGS.adjustPlayer(cp.addCard(newGS.playerDeck.mostRecent(1)[0]));
                    newGS.recalcForAddCard(cp, newGS.playerDeck.mostRecent(1)[0]);
                }
            }
            
            return newGS;
        }