예제 #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);
        }
예제 #2
0
       public override GameState execute(GameState gs)
       {
           Player newFrom = from.removeCard(card);
           Player newTo = to.addCard(card);
           gs = gs.adjustPlayer(newFrom);
           gs = gs.recalcBestCardHolder(gs, newFrom, card.color);
           gs = gs.adjustPlayer(newTo);
           gs = gs.recalcForAddCard(newTo, card);
 
           gs.advanceMove();
           return gs;
       }
예제 #3
0
        public override GameState execute(GameState gs)
        {
            Player newFrom = from.removeCard(card);
            Player newTo   = to.addCard(card);

            gs = gs.adjustPlayer(newFrom);
            gs = gs.recalcBestCardHolder(gs, newFrom, card.color);
            gs = gs.adjustPlayer(newTo);
            gs = gs.recalcForAddCard(newTo, card);

            gs.advanceMove();
            return(gs);
        }
예제 #4
0
        public void testCardHolderUpdate()
        {
            City b1 = map.addCity("jhuihb", DiseaseColor.BLUE);
            City o1 = map.addCity("hkjh", DiseaseColor.ORANGE);
            City o2 = map.addCity("ionnj", DiseaseColor.ORANGE);
            City o3 = map.addCity("k", DiseaseColor.ORANGE);
            
            gs = new GameState(newyork, map, 2, 1);


            gs.players[0] = gs.players[0].addCard(o1);
            gs.players[0] = gs.players[0].addCard(o2);
            gs.players[1] = gs.players[1].addCard(o3);
            gs.players[1] = gs.players[1].addCard(b1);

            gs = gs.recalcForAddCard(gs.players[0], o1);
            gs = gs.recalcForAddCard(gs.players[0], o2);
            gs = gs.recalcForAddCard(gs.players[1], o3);
            gs = gs.recalcForAddCard(gs.players[1], b1);

            //Assert.AreEqual(orange, gs.bestOrangeCardHolder.Key);
            Assert.AreEqual(2, gs.bestCardHolder[(int)DiseaseColor.ORANGE].Value);
            //Assert.AreEqual(notOrange, gs.bestBlueCardHolder.Key);
            Assert.AreEqual(1, gs.bestCardHolder[(int)DiseaseColor.BLUE].Value);
        }
예제 #5
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;
        }