removed some redundant classes

This commit is contained in:
Evan Kranzler 2020-09-12 21:21:57 -04:00
parent 29efa7b067
commit 5fa660a1d8
8 changed files with 6 additions and 82 deletions

View file

@ -19,7 +19,6 @@ import mage.counters.CounterType;
import mage.filter.Filter; import mage.filter.Filter;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.CardCounterPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -69,7 +68,7 @@ public final class DustOfMoments extends CardImpl {
permFilter.add(CounterType.TIME.getPredicate()); permFilter.add(CounterType.TIME.getPredicate());
this.exiledFilter = new FilterCard("permanent and each suspended card"); this.exiledFilter = new FilterCard("permanent and each suspended card");
exiledFilter.add(new CardCounterPredicate(CounterType.TIME)); exiledFilter.add(CounterType.TIME.getPredicate());
setText(); setText();
} }

View file

@ -20,7 +20,6 @@ import mage.constants.Outcome;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetArtifactPermanent; import mage.target.common.TargetArtifactPermanent;
@ -35,7 +34,7 @@ public final class FuryCharm extends CardImpl {
private static final FilterCard filter = new FilterCard("suspended card"); private static final FilterCard filter = new FilterCard("suspended card");
static { static {
filter.add(new CounterCardPredicate(CounterType.TIME)); filter.add(CounterType.TIME.getPredicate());
filter.add(new AbilityPredicate(SuspendAbility.class)); filter.add(new AbilityPredicate(SuspendAbility.class));
} }

View file

@ -11,7 +11,6 @@ import mage.cards.*;
import mage.constants.*; import mage.constants.*;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.game.ExileZone; import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.token.KarnConstructToken; import mage.game.permanent.token.KarnConstructToken;
@ -125,7 +124,7 @@ class KarnMinus1Effect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("card you own with a silver counter on it in exile"); private static final FilterCard filter = new FilterCard("card you own with a silver counter on it in exile");
static { static {
filter.add(new CounterCardPredicate(CounterType.SILVER)); filter.add(CounterType.SILVER.getPredicate());
} }
public KarnMinus1Effect() { public KarnMinus1Effect() {

View file

@ -22,7 +22,6 @@ import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
@ -36,7 +35,7 @@ public final class MaintenanceDroid extends CardImpl {
private static final FilterCard filter = new FilterCard("target card you own with a repair counter on it"); private static final FilterCard filter = new FilterCard("target card you own with a repair counter on it");
static { static {
filter.add(new CounterCardPredicate(CounterType.REPAIR)); filter.add(CounterType.REPAIR.getPredicate());
} }
public MaintenanceDroid(UUID ownerId, CardSetInfo setInfo) { public MaintenanceDroid(UUID ownerId, CardSetInfo setInfo) {

View file

@ -23,7 +23,6 @@ import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -120,7 +119,7 @@ class MairsilThePretenderGainAbilitiesEffect extends ContinuousEffectImpl {
private static final FilterCard filter = new FilterCard(); private static final FilterCard filter = new FilterCard();
static { static {
filter.add(new CounterCardPredicate(CounterType.CAGE)); filter.add(CounterType.CAGE.getPredicate());
} }
public MairsilThePretenderGainAbilitiesEffect() { public MairsilThePretenderGainAbilitiesEffect() {

View file

@ -40,7 +40,6 @@ import mage.filter.FilterImpl;
import mage.filter.FilterInPlay; import mage.filter.FilterInPlay;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -62,7 +61,7 @@ public class FilterPermanentOrSuspendedCard extends FilterImpl<MageObject> imple
permanentFilter = new FilterPermanent(); permanentFilter = new FilterPermanent();
cardFilter = new FilterCard(); cardFilter = new FilterCard();
cardFilter.add(new AbilityPredicate(SuspendAbility.class)); cardFilter.add(new AbilityPredicate(SuspendAbility.class));
cardFilter.add(new CounterCardPredicate(CounterType.TIME)); cardFilter.add(CounterType.TIME.getPredicate());
} }
public FilterPermanentOrSuspendedCard(final FilterPermanentOrSuspendedCard filter) { public FilterPermanentOrSuspendedCard(final FilterPermanentOrSuspendedCard filter) {

View file

@ -1,34 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.filter.predicate.other;
import mage.cards.Card;
import mage.counters.CounterType;
import mage.filter.predicate.Predicate;
import mage.game.Game;
/**
*
* @author jeffwadsworth
*/
public class CounterCardPredicate implements Predicate<Card> {
private final CounterType counter;
public CounterCardPredicate(CounterType counter) {
this.counter = counter;
}
@Override
public boolean apply(Card input, Game game) {
return input.getCounters(game).containsKey(counter);
}
@Override
public String toString() {
return "CounterType(" + counter.getName() + ')';
}
}

View file

@ -1,36 +0,0 @@
package mage.filter.predicate.permanent;
import mage.cards.Card;
import mage.counters.CounterType;
import mage.filter.predicate.Predicate;
import mage.game.Game;
/**
* Created by glerman on 3/7/15.
*/
public class CardCounterPredicate implements Predicate<Card>{
private final CounterType counter;
/**
*
* @param counter if null any counter selects the permanent
*/
public CardCounterPredicate(CounterType counter) {
this.counter = counter;
}
@Override
public boolean apply(Card input, Game game) {
if (counter == null) {
return !input.getCounters(game).keySet().isEmpty();
} else {
return input.getCounters(game).containsKey(counter);
}
}
@Override
public String toString() {
return "CounterType(" + counter.getName() + ')';
}
}