public void notifyObserver(Observable o, object args) { player = (Player)o; playerPortrait.player = player; updateManaDisplay(); safeSetText(health, player.getLife().ToString()); safeSetText(deck, player.deck.count.ToString()); safeSetText(hand, player.hand.count.ToString()); safeSetText(yard, player.graveyard.count.ToString()); Invalidate(); }
private void mulligan(Player p, int handSize) { p.setLife(25); Choice c; int life = 1; while (true) { while (p.hand.count > 0) { moveCardTo(p.hand.peek(), p.deck); } shuffleDeck(p); for (int i = 0; i < handSize; i++) { moveCardTo(p.deck.peek(), p.hand); } if (p.getLife() < 16) { break; } if (p.isHero) { c = gameInterface.getChoice("Do you want to mulligan?", Choice.Yes, Choice.No); gameInterface.sendSelection((int)c); } else { gameInterface.setContext("Opponent is mulliganing."); c = (Choice)gameInterface.demandSelection(); gameInterface.clearContext(); } if (c != Choice.Yes) { break; } p.setLifeRelative(-life++); } }