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

@ -14,6 +14,8 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.other.AuraCardCanAttachToPermanentId;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -27,6 +29,12 @@ import mage.target.common.TargetCardInGraveyard;
*/
public final class IridescentDrake extends CardImpl {
private static final FilterCard filter = new FilterCard("Aura from a graveyard");
static {
filter.add(new SubtypePredicate(SubType.AURA));
}
public IridescentDrake(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
@ -39,7 +47,7 @@ public final class IridescentDrake extends CardImpl {
// When Iridescent Drake enters the battlefield, put target Aura card from a graveyard onto the battlefield under your control attached to Iridescent Drake.
Ability ability = new EntersBattlefieldTriggeredAbility(new IridescentDrakeEffect());
ability.addTarget(new TargetCardInGraveyard());
ability.addTarget(new TargetCardInGraveyard(filter));
this.addAbility(ability);
}

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,12 +25,16 @@ public class AuraCardCanAttachToPermanentId implements Predicate<Card> {
public boolean apply(Card input, Game game) {
final Permanent permanent = game.getPermanent(toBeCheckedPermanentId);
Filter filter;
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;
}