From b4f8de621ff6916124265048ae1d75a7a70a725b Mon Sep 17 00:00:00 2001 From: magenoxx Date: Tue, 16 Aug 2011 21:41:09 +0400 Subject: [PATCH] Fixed Scry causing losing the game --- Mage/src/mage/abilities/effects/common/ScryEffect.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Mage/src/mage/abilities/effects/common/ScryEffect.java b/Mage/src/mage/abilities/effects/common/ScryEffect.java index 143c4a505f..bfb2d9c404 100644 --- a/Mage/src/mage/abilities/effects/common/ScryEffect.java +++ b/Mage/src/mage/abilities/effects/common/ScryEffect.java @@ -66,7 +66,11 @@ public class ScryEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); 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); cards.add(card); game.setZone(card.getId(), Zone.PICK);