diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java index 99958198d35..359666cd8d0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java @@ -29,6 +29,7 @@ */ package mage.abilities.effects.common; +import static java.lang.Integer.min; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.dynamicvalue.DynamicValue; @@ -186,7 +187,8 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff if (!optional || player.chooseUse(Outcome.DrawCard, getMayText(), source, game)) { FilterCard pickFilter = filter.copy(); pickFilter.setMessage(getPickText()); - TargetCard target = new TargetCard((upTo ? 0 : numberToPick.calculate(game, source, this)), numberToPick.calculate(game, source, this), Zone.LIBRARY, pickFilter); + int number = min(cards.size(), numberToPick.calculate(game, source, this)); + TargetCard target = new TargetCard((upTo ? 0 : number), number, Zone.LIBRARY, pickFilter); if (player.choose(Outcome.DrawCard, cards, target, game)) { Cards pickedCards = new CardsImpl(target.getTargets()); cards.removeAll(pickedCards);