Updated some targets and filters

This commit is contained in:
Evan Kranzler 2018-06-09 14:51:07 -04:00
parent 56777cb0d0
commit 4e3961a819
10 changed files with 28 additions and 33 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.e;
import java.util.UUID;
@ -23,7 +22,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
*/
public final class EnergyTap extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you crontrol");
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control");
static {
filter.add(Predicates.not(new TappedPredicate()));

View file

@ -1,6 +1,6 @@
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.ReturnToHandFromBattlefieldSourceCost;
@ -10,28 +10,26 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class RecurringNightmare extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card");
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("creature");
public RecurringNightmare(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
// Sacrifice a creature, Return Recurring Nightmare to its owner's hand: Return target creature card from your graveyard to the battlefield. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filter2)));
ability.addTarget(new TargetCardInYourGraveyard(filter));
Ability ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD,
new ReturnFromGraveyardToBattlefieldTargetEffect(),
new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE))
);
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE));
ability.addCost(new ReturnToHandFromBattlefieldSourceCost());
this.addAbility(ability);
}

View file

@ -1,4 +1,3 @@
package mage.cards.s;
import java.util.UUID;
@ -17,7 +16,7 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.StaticFilters;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -44,7 +43,7 @@ public final class SpikeRogue extends CardImpl {
// {2}, Remove a +1/+1 counter from a creature you control: Put a +1/+1 counter on Spike Rogue.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)), new GenericManaCost(2));
ability2.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true), CounterType.P1P1));
ability2.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_CREATURE, true), CounterType.P1P1));
this.addAbility(ability2);
}

View file

@ -66,7 +66,7 @@ public class FilterCard extends FilterObject<Card> {
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(card, sourceId, playerId), game);
}
public void add(ObjectPlayerPredicate predicate) {
public final void add(ObjectPlayerPredicate predicate) {
if (isLockedFilter()) {
throw new UnsupportedOperationException("You may not modify a locked filter");
}

View file

@ -55,7 +55,7 @@ public abstract class FilterImpl<E> implements Filter<E> {
}
@Override
public void setMessage(String message) {
public final void setMessage(String message) {
if (isLockedFilter()) {
throw new UnsupportedOperationException("You may not modify a locked filter");
}

View file

@ -61,7 +61,7 @@ public class FilterPermanent extends FilterObject<Permanent> implements FilterIn
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(permanent, sourceId, playerId), game);
}
public void add(ObjectPlayerPredicate predicate) {
public final void add(ObjectPlayerPredicate predicate) {
if (isLockedFilter()) {
throw new UnsupportedOperationException("You may not modify a locked filter");
}

View file

@ -20,7 +20,7 @@ public class FilterStackObject extends FilterObject<StackObject> {
protected List<ObjectPlayerPredicate<ObjectPlayer<Permanent>>> extraPredicates = new ArrayList<>();
public FilterStackObject() {
super("spell or ability");
this("spell or ability");
}
public FilterStackObject(String name) {
@ -40,7 +40,7 @@ public class FilterStackObject extends FilterObject<StackObject> {
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(stackObject, sourceId, playerId), game);
}
public void add(ObjectPlayerPredicate predicate) {
public final void add(ObjectPlayerPredicate predicate) {
if (isLockedFilter()) {
throw new UnsupportedOperationException("You may not modify a locked filter");
}

View file

@ -1,4 +1,3 @@
package mage.target;
import java.util.HashSet;
@ -8,6 +7,7 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -20,11 +20,11 @@ public class TargetPermanent extends TargetObject {
protected FilterPermanent filter;
public TargetPermanent() {
this(1, 1, new FilterPermanent(), false);
this(StaticFilters.FILTER_PERMANENT);
}
public TargetPermanent(FilterPermanent filter) {
this(1, 1, filter, false);
this(1, filter);
}
public TargetPermanent(int numTargets, FilterPermanent filter) {

View file

@ -1,6 +1,6 @@
package mage.target.common;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
@ -10,19 +10,19 @@ import mage.filter.common.FilterControlledCreaturePermanent;
public class TargetControlledCreaturePermanent extends TargetControlledPermanent {
public TargetControlledCreaturePermanent() {
this(1, 1, new FilterControlledCreaturePermanent(), false);
this(1);
}
public TargetControlledCreaturePermanent(int numTargets) {
this(numTargets, numTargets, new FilterControlledCreaturePermanent(), false);
this(numTargets, numTargets);
}
public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, new FilterControlledCreaturePermanent(), false);
this(minNumTargets, maxNumTargets, StaticFilters.FILTER_CONTROLLED_CREATURE, false);
}
public TargetControlledCreaturePermanent(FilterControlledCreaturePermanent filter) {
super(1, 1, filter, false);
this(1, 1, filter, false);
}
public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets, FilterControlledCreaturePermanent filter, boolean notTarget) {

View file

@ -1,7 +1,6 @@
package mage.target.common;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.target.TargetPermanent;
@ -12,11 +11,11 @@ import mage.target.TargetPermanent;
public class TargetControlledPermanent extends TargetPermanent {
public TargetControlledPermanent() {
this(1, 1, new FilterControlledPermanent(), false);
this(1, 1, StaticFilters.FILTER_CONTROLLED_PERMANENT, false);
}
public TargetControlledPermanent(int numTargets) {
this(numTargets, numTargets, new FilterControlledPermanent(), false);
this(numTargets, numTargets, StaticFilters.FILTER_CONTROLLED_PERMANENT, false);
}
public TargetControlledPermanent(FilterControlledPermanent filter) {