use FilterArtifactOrEnchantmentPermanent

This commit is contained in:
Neil Gentleman 2016-07-17 13:17:47 -07:00
parent 8d0e7e1b40
commit da07a58a85
22 changed files with 51 additions and 238 deletions

View file

@ -44,9 +44,7 @@ import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
@ -58,22 +56,17 @@ import mage.target.targetpointer.FixedTarget;
*/
public class ActOfAuthority extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT)));
}
public ActOfAuthority(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}{W}");
// When Act of Authority enters the battlefield, you may exile target artifact or enchantment.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect(), true);
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
// At the beginning of your upkeep, you may exile target artifact or enchantment. If you do, its controller gains control of Act of Authority.
ability = new BeginningOfUpkeepTriggeredAbility(new ActOfAuthorityEffect(), TargetController.YOU, true);
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
}

View file

@ -32,9 +32,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -43,20 +41,12 @@ import mage.target.TargetPermanent;
*/
public class AltarsLight extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public AltarsLight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}{W}");
// Exile target artifact or enchantment.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}
public AltarsLight(final AltarsLight card) {

View file

@ -39,9 +39,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -50,12 +48,6 @@ import mage.target.TargetPermanent;
*/
public class CapashenUnicorn extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public CapashenUnicorn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}");
this.subtype.add("Unicorn");
@ -66,7 +58,7 @@ public class CapashenUnicorn extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{1}{W}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
}

View file

@ -38,9 +38,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -49,13 +47,6 @@ import mage.target.TargetPermanent;
*/
public class CausticCaterpillar extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public CausticCaterpillar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
this.subtype.add("Insect");
@ -65,7 +56,7 @@ public class CausticCaterpillar extends CardImpl {
// {1}{G}, Sacrifice Caustic Caterpillar: Destroy target artifact or enchantment.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{1}{G}"));
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
}

View file

@ -37,7 +37,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
@ -102,8 +101,7 @@ class CausticWaspsTriggeredAbility extends TriggeredAbilityImpl {
Player player = game.getPlayer(event.getTargetId());
if (player != null) {
FilterPermanent filter = new FilterPermanent("an artifact controlled by " + player.getLogName());
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT)));
filter.add(new CardTypePredicate(CardType.ARTIFACT));
filter.add(new ControllerIdPredicate(event.getTargetId()));
this.getTargets().clear();

View file

@ -32,9 +32,7 @@ import mage.constants.CardType;
import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -43,17 +41,12 @@ import mage.target.TargetPermanent;
*/
public class Deglamer extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT)));
}
public Deglamer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");
// Choose target artifact or enchantment. Its owner shuffles it into his or her library.
this.getSpellAbility().addEffect(new ShuffleIntoLibraryTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(1, 1, filter, true));
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}
public Deglamer(final Deglamer card) {

View file

@ -38,10 +38,9 @@ import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.target.TargetPermanent;
@ -52,15 +51,6 @@ import mage.target.common.TargetControlledPermanent;
* @author noxx
*/
public class DevoutChaplain extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
private static final FilterControlledPermanent humanFilter = new FilterControlledPermanent("untapped Human you control");
static {
@ -80,7 +70,7 @@ public class DevoutChaplain extends CardImpl {
// {T}, Tap two untapped Humans you control: Exile target artifact or enchantment.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(), new TapSourceCost());
ability.addCost(new TapTargetCost(new TargetControlledPermanent(2, 2, humanFilter, false)));
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
}

View file

@ -32,10 +32,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.Target;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -44,19 +41,13 @@ import mage.target.TargetPermanent;
*/
public class FadeIntoAntiquity extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT)));
}
public FadeIntoAntiquity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}");
// Exile target artifact or enchantment.
this.getSpellAbility().addEffect(new ExileTargetEffect());
Target target = new TargetPermanent(filter);
this.getSpellAbility().addTarget(target);
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}
public FadeIntoAntiquity(final FadeIntoAntiquity card) {

View file

@ -32,9 +32,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -42,21 +40,13 @@ import mage.target.TargetPermanent;
* @author fireshoes
*/
public class FateForgotten extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public FateForgotten(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}");
// Exile target artifact or enchantment.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}
public FateForgotten(final FateForgotten card) {

View file

@ -38,9 +38,7 @@ import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -53,21 +51,13 @@ import mage.target.common.TargetOpponent;
*/
public class HideSeek extends SplitCard {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public HideSeek(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}{W}","{W}{B}",false);
// Hide
// Put target artifact or enchantment on the bottom of its owner's library.
getLeftHalfCard().getSpellAbility().addEffect(new PutOnLibraryTargetEffect(false));
getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(filter));
getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
// Seek
// Search target opponent's library for a card and exile it. You gain life equal to its converted mana cost. Then that player shuffles his or her library..

View file

@ -32,9 +32,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -43,20 +41,12 @@ import mage.target.TargetPermanent;
*/
public class IronwrightsCleansing extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public IronwrightsCleansing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{W}");
// Exile target artifact or enchantment.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}

View file

@ -40,10 +40,7 @@ import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.Target;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -51,13 +48,6 @@ import mage.target.TargetPermanent;
* @author Loki
*/
public class LeoninRelicWarder extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public LeoninRelicWarder (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{W}");
@ -68,8 +58,7 @@ public class LeoninRelicWarder extends CardImpl {
this.toughness = new MageInt(2);
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect(), true);
Target target = new TargetPermanent(filter);
ability.addTarget(target);
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
Ability ability2 = new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), false);

View file

@ -37,9 +37,7 @@ import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -48,14 +46,6 @@ import mage.target.TargetPermanent;
*/
public class NantukoVigilante extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public NantukoVigilante(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
this.subtype.add("Insect");
@ -69,7 +59,7 @@ public class NantukoVigilante extends CardImpl {
this.addAbility(new MorphAbility(this,new ManaCostsImpl("{1}{G}")));
// When Nantuko Vigilante is turned face up, destroy target artifact or enchantment.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new DestroyTargetEffect());
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
}

View file

@ -41,9 +41,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -52,20 +50,13 @@ import mage.target.TargetPermanent;
*/
public class QuietDisrepair extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public QuietDisrepair(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
this.subtype.add("Aura");
// Enchant artifact or enchantment
TargetPermanent auraTarget = new TargetPermanent(filter);
TargetPermanent auraTarget = new TargetPermanent(new FilterArtifactOrEnchantmentPermanent());
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());

View file

@ -35,9 +35,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.game.Game;
import mage.target.TargetPermanent;
@ -46,12 +44,6 @@ import mage.target.TargetPermanent;
* @author emerald000
*/
public class ReturnToDust extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public ReturnToDust(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}{W}");
@ -71,10 +63,10 @@ public class ReturnToDust extends CardImpl {
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
if (game.getActivePlayerId().equals(ability.getControllerId()) && game.isMainPhase()) {
ability.addTarget(new TargetPermanent(1, 2, filter, false));
ability.addTarget(new TargetPermanent(1, 2, new FilterArtifactOrEnchantmentPermanent(), false));
}
else {
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}
}
}

View file

@ -32,9 +32,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -43,20 +41,12 @@ import mage.target.TargetPermanent;
*/
public class RevokeExistence extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public RevokeExistence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{W}");
// Exile target artifact or enchantment.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}
public RevokeExistence(final RevokeExistence card) {

View file

@ -34,9 +34,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -68,14 +66,6 @@ public class Scrapheap extends CardImpl {
class ScrapheapTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
@Override
public ScrapheapTriggeredAbility copy() {
return new ScrapheapTriggeredAbility(this);
@ -96,15 +86,15 @@ class ScrapheapTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent != null && permanent.getOwnerId().equals(this.getControllerId())) {
if (filter.match(permanent, sourceId, controllerId, game)) {
return true;
}
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent != null && permanent.getOwnerId().equals(this.getControllerId())) {
if (new FilterArtifactOrEnchantmentPermanent().match(permanent, sourceId, controllerId, game)) {
return true;
}
}
}
return false;
}

View file

@ -36,9 +36,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -46,13 +44,6 @@ import mage.target.TargetPermanent;
* @author Loki
*/
public class SternProctor extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public SternProctor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U}{U}");
@ -64,7 +55,7 @@ public class SternProctor extends CardImpl {
// When Stern Proctor enters the battlefield, return target artifact or enchantment to its owner's hand.
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), false);
TargetPermanent target = new TargetPermanent(filter);
TargetPermanent target = new TargetPermanent(new FilterArtifactOrEnchantmentPermanent());
ability.addTarget(target);
this.addAbility(ability);
}

View file

@ -33,9 +33,7 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.PopulateEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -44,21 +42,13 @@ import mage.target.TargetPermanent;
*/
public class SunderingGrowth extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public SunderingGrowth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G/W}{G/W}");
// Destroy target artifact or enchantment, then populate.
// (Create a token that's a copy of a creature token you control.)
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addEffect(new PopulateEffect("then"));
}

View file

@ -32,9 +32,7 @@ import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -43,18 +41,12 @@ import mage.target.TargetPermanent;
*/
public class UnravelTheAether extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT)));
}
public UnravelTheAether(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");
// Choose target artifact or enchantment. Its owner shuffles it into his or her library.
this.getSpellAbility().addEffect(new ShuffleIntoLibraryTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(1, 1, filter, true));
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
}
public UnravelTheAether(final UnravelTheAether card) {

View file

@ -42,9 +42,7 @@ import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -52,14 +50,6 @@ import mage.target.TargetPermanent;
*/
public class WickerboughElder extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public WickerboughElder(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
this.subtype.add("Treefolk");
@ -73,7 +63,7 @@ public class WickerboughElder extends CardImpl {
// {G}, Remove a -1/-1 counter from Wickerbough Elder: Destroy target artifact or enchantment.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ColoredManaCost(ColoredManaSymbol.G));
ability.addCost(new RemoveCountersSourceCost(CounterType.M1M1.createInstance(1)));
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.addAbility(ability);
}

View file

@ -44,7 +44,7 @@ public class FilterArtifactOrEnchantmentPermanent extends FilterPermanent {
public FilterArtifactOrEnchantmentPermanent(String name) {
super(name);
this.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT),new CardTypePredicate(CardType.ENCHANTMENT)));
this.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT)));
}
public FilterArtifactOrEnchantmentPermanent(final FilterArtifactOrEnchantmentPermanent filter) {