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); }
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); }
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; }