This commit is contained in:
Jeff 2018-12-21 11:46:30 -06:00
parent fbca0f4fef
commit 2fca196f79
2 changed files with 18 additions and 8 deletions

View file

@ -1,4 +1,3 @@
package mage.filter.predicate.other;
import java.util.UUID;
@ -14,7 +13,6 @@ import mage.target.Target;
* @author jeffwadsworth
*/
// Use this predicate if a aura card comes into play attached to a permanent without targeting
public class AuraCardCanAttachToPermanentId implements Predicate<Card> {
private final UUID toBeCheckedPermanentId;
@ -27,10 +25,14 @@ public class AuraCardCanAttachToPermanentId implements Predicate<Card> {
public boolean apply(Card input, Game game) {
final Permanent permanent = game.getPermanent(toBeCheckedPermanentId);
Filter filter;
for (Target target : input.getSpellAbility().getTargets()) {
filter = target.getFilter();
if (filter.match(permanent, game)) {
return true;
if (permanent != null
&& input != null
&& input.isEnchantment()) {
for (Target target : input.getSpellAbility().getTargets()) {
filter = target.getFilter();
if (filter.match(permanent, game)) {
return true;
}
}
}
return false;
@ -40,4 +42,4 @@ public class AuraCardCanAttachToPermanentId implements Predicate<Card> {
public String toString() {
return "AuraCardCanAttachToPermanentId(" + toBeCheckedPermanentId + ')';
}
}
}