From aa606a1d3cee68b8a72eab9eb1f9e8fd27b29936 Mon Sep 17 00:00:00 2001 From: Quercitron Date: Thu, 19 Jun 2014 02:58:29 +0400 Subject: [PATCH] * Search in library -- Set required status depending on whether searched cards have stated quality (rules 701.15b, 701.15d). --- Mage/src/mage/filter/FilterCard.java | 4 ++++ Mage/src/mage/target/common/TargetCardInLibrary.java | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Mage/src/mage/filter/FilterCard.java b/Mage/src/mage/filter/FilterCard.java index 24ff39788c..3d58f08202 100644 --- a/Mage/src/mage/filter/FilterCard.java +++ b/Mage/src/mage/filter/FilterCard.java @@ -112,6 +112,10 @@ public class FilterCard extends FilterObject { } return filtered; } + + public boolean hasPredicates() { + return predicates.size() > 0; + } @Override public FilterCard copy() { diff --git a/Mage/src/mage/target/common/TargetCardInLibrary.java b/Mage/src/mage/target/common/TargetCardInLibrary.java index ea3d8fc175..1f9793e214 100644 --- a/Mage/src/mage/target/common/TargetCardInLibrary.java +++ b/Mage/src/mage/target/common/TargetCardInLibrary.java @@ -65,13 +65,12 @@ public class TargetCardInLibrary extends TargetCard { public TargetCardInLibrary(int minNumTargets, int maxNumTargets, FilterCard filter) { super(minNumTargets, maxNumTargets, Zone.LIBRARY, filter); - this.setRequired(false); + this.setRequired(!filter.hasPredicates()); this.librarySearchLimit = Integer.MAX_VALUE; } public TargetCardInLibrary(final TargetCardInLibrary target) { super(target); - this.setRequired(false); this.librarySearchLimit = target.librarySearchLimit; }