Esempio n. 1
0
        public GameEngine(Player.Type hType, int difficultyLevel, Boolean allAI)
        {
            //initialize infection and player decks and map
            Map         map   = initializeCities();
            Deck <City> ideck = initializeInfectionDeck(map);

            //initialize player deck

            gs     = new GameState(atlanta, map, 4, 4, ideck, initializePlayerDeck(map));
            gs.map = initializeBoard(map);
            if (!allAI)
            {
                gs.players[0].isAI = false;
            }

            foreach (Player p in gs.players)
            {
                gs = gs.drawPlayerCards(p, 5);
                List <City> drawn = gs.playerDeck.mostRecent(5);
                p.cards.AddRange(drawn);
                gs = gs.adjustPlayer(p);
            }


            List <int> cardLocations = makeEpidemicCards(gs.playerDeck.drawDeck.Count, difficultyLevel);

            for (int i = 0; i < cardLocations.Count; i++)
            {
                cardLocations[i] = cardLocations[i] + gs.playerDeck.cardWeAreOn + 1;
            }

            gs.playerDeck.epidemicCards = cardLocations;
            //ev = new HatesDisease(100);
            ev = new outbreakHater(true);
        }
Esempio n. 2
0
        public override GameState execute(GameState gs)
        {
            //does stuff that happens between two turns (after actions)

            GameState newGS = gs.drawPlayerCards(gs.currentPlayer());
            int       numInfectionCardsToDraw = 0;
            Map       m = newGS.map;

            //draw x infection cards
            if (m.infectionRate >= 0 && m.infectionRate < 3)
            {
                numInfectionCardsToDraw = 2;
            }
            else if (m.infectionRate >= 3 && m.infectionRate < 5)
            {
                numInfectionCardsToDraw = 3;
            }
            else if (m.infectionRate >= 5 && m.infectionRate < 7)
            {
                numInfectionCardsToDraw = 4;
            }

            newGS = newGS.drawInfectionCards(numInfectionCardsToDraw);
            newGS.advancePlayer();



            return(newGS);
        }
Esempio n. 3
0
        public override GameState execute(GameState gs)
        {
            //does stuff that happens between two turns (after actions)
            
            GameState newGS  = gs.drawPlayerCards(gs.currentPlayer());
            int numInfectionCardsToDraw=0;
            Map m = newGS.map;
            //draw x infection cards
            if(m.infectionRate>=0 && m.infectionRate<3)
            {
                numInfectionCardsToDraw = 2;
            }
            else if (m.infectionRate >= 3 && m.infectionRate < 5)
            {
                numInfectionCardsToDraw = 3;
            }
            else if(m.infectionRate >=5 && m.infectionRate<7)
            {
                numInfectionCardsToDraw = 4;
            }

            newGS = newGS.drawInfectionCards(numInfectionCardsToDraw);
            newGS.advancePlayer();
            


            return newGS;
        }
Esempio n. 4
0
        public GameEngine(Player.Type hType, int difficultyLevel, Boolean allAI)
        {

            //initialize infection and player decks and map
            Map map = initializeCities();
            Deck<City> ideck = initializeInfectionDeck(map);
            //initialize player deck

            gs = new GameState(atlanta, map, 4, 4, ideck, initializePlayerDeck(map));
            gs.map = initializeBoard(map);
            if (!allAI)
            {
                gs.players[0].isAI = false;
            }

            foreach (Player p in gs.players)
            {
                gs = gs.drawPlayerCards(p, 5);
                List<City> drawn = gs.playerDeck.mostRecent(5);
                p.cards.AddRange(drawn);
                gs = gs.adjustPlayer(p);
            }


            List<int> cardLocations = makeEpidemicCards(gs.playerDeck.drawDeck.Count, difficultyLevel);

            for (int i = 0; i < cardLocations.Count; i++)
            {
                cardLocations[i] = cardLocations[i] + gs.playerDeck.cardWeAreOn + 1;
            }

            gs.playerDeck.epidemicCards = cardLocations;
            //ev = new HatesDisease(100);
            ev = new outbreakHater(true);

        }
Esempio n. 5
0
 public void TestLoseNoCards()
 {
     gs = new GameState(atlanta, map, 1, 4, null, new Deck<City>(map.allCities, true, false));
     gs = gs.drawPlayerCards(gs.currentPlayer(), 1);
     Assert.IsFalse(gs.hasLost());
     gs = gs.drawPlayerCards(gs.currentPlayer(), 2);
     Assert.IsTrue(gs.hasLost());
 }