Fixed Scry causing losing the game

This commit is contained in:
magenoxx 2011-08-16 21:41:09 +04:00
parent cec8d6feef
commit b4f8de621f

View file

@ -66,7 +66,11 @@ public class ScryEffect extends OneShotEffect<ScryEffect> {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
Cards cards = new CardsImpl(Zone.PICK); Cards cards = new CardsImpl(Zone.PICK);
for (int i = 0; i < scryNumber; i++) { int count = Math.min(scryNumber, player.getLibrary().size());
if (count == 0) {
return false;
}
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game); Card card = player.getLibrary().removeFromTop(game);
cards.add(card); cards.add(card);
game.setZone(card.getId(), Zone.PICK); game.setZone(card.getId(), Zone.PICK);