refactored all instances of SubtypePredicate

This commit is contained in:
Evan Kranzler 2020-01-06 16:48:00 -05:00
parent 3b8298e7c2
commit 86906ec25f
1659 changed files with 2039 additions and 3777 deletions

View file

@ -15,7 +15,6 @@ import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCardInLibrary;
import java.util.ArrayList;
@ -44,7 +43,7 @@ public class FetchLandActivatedAbility extends ActivatedAbilityImpl {
filter.add(CardType.LAND.getPredicate());
List<Predicate<MageObject>> subtypePredicates = new ArrayList<>();
for (SubType subtype : subtypes) {
subtypePredicates.add(new SubtypePredicate(subtype));
subtypePredicates.add(subtype.getPredicate());
}
filter.add(Predicates.or(subtypePredicates));
TargetCardInLibrary target = new TargetCardInLibrary(filter);

View file

@ -6,7 +6,6 @@ import mage.abilities.condition.Condition;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -19,7 +18,7 @@ public class EnchantedCreatureSubtypeCondition implements Condition {
private final FilterPermanent filter = new FilterCreaturePermanent();
public EnchantedCreatureSubtypeCondition(SubType string) {
filter.add(new SubtypePredicate(string));
filter.add(string.getPredicate());
}
@Override

View file

@ -6,7 +6,6 @@ import mage.abilities.effects.Effect;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
/**
@ -18,7 +17,7 @@ public enum GateYouControlCount implements DynamicValue {
private static final FilterPermanent filter = new FilterControlledPermanent("Gate you control");
static {
filter.add(new SubtypePredicate(SubType.GATE));
filter.add(SubType.GATE.getPredicate());
}
@Override

View file

@ -5,7 +5,6 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.SubType;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
public class UrzaTerrainValue implements DynamicValue {
@ -19,24 +18,24 @@ public class UrzaTerrainValue implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
FilterControlledPermanent pp = new FilterControlledPermanent("Urza's Power Plant");
pp.add(new SubtypePredicate(SubType.URZAS));
pp.add(new SubtypePredicate(SubType.POWER_PLANT));
pp.add(SubType.URZAS.getPredicate());
pp.add(SubType.POWER_PLANT.getPredicate());
PermanentsOnBattlefieldCount ppP = new PermanentsOnBattlefieldCount(pp);
if (ppP.calculate(game, sourceAbility, effect) < 1) {
return 1;
}
FilterControlledPermanent to = new FilterControlledPermanent("Urza's Tower");
to.add(new SubtypePredicate(SubType.URZAS));
to.add(new SubtypePredicate(SubType.TOWER));
to.add(SubType.URZAS.getPredicate());
to.add(SubType.TOWER.getPredicate());
PermanentsOnBattlefieldCount toP = new PermanentsOnBattlefieldCount(to);
if (toP.calculate(game, sourceAbility, effect) < 1) {
return 1;
}
FilterControlledPermanent mi = new FilterControlledPermanent("Urza's Mine");
mi.add(new SubtypePredicate(SubType.URZAS));
mi.add(new SubtypePredicate(SubType.MINE));
mi.add(SubType.URZAS.getPredicate());
mi.add(SubType.MINE.getPredicate());
PermanentsOnBattlefieldCount miP = new PermanentsOnBattlefieldCount(mi);
if (miP.calculate(game, sourceAbility, effect) < 1) {
return 1;

View file

@ -16,7 +16,6 @@ import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
@ -29,7 +28,7 @@ import java.util.List;
/**
* Effect for the AmplifyAbility
*
* <p>
* 702.37. Amplify 702.37a Amplify is a static ability. Amplify N means As
* this object enters the battlefield, reveal any number of cards from your hand
* that share a creature type with it. This permanent enters the battlefield
@ -38,7 +37,6 @@ import java.util.List;
* time as this card. 702.37b If a creature has multiple instances of amplify,
* each one works separately.
*
*
* @author FenrisulfrX
*/
public class AmplifyEffect extends ReplacementEffectImpl {
@ -101,9 +99,9 @@ public class AmplifyEffect extends ReplacementEffectImpl {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && sourceCreature != null) {
FilterCreatureCard filter = new FilterCreatureCard("creatures cards to reveal");
List<SubtypePredicate> filterSubtypes = new ArrayList<>();
List<SubType.SubTypePredicate> filterSubtypes = new ArrayList<>();
for (SubType subtype : sourceCreature.getSubtype(game)) {
filterSubtypes.add(new SubtypePredicate(subtype));
filterSubtypes.add(subtype.getPredicate());
}
if (filterSubtypes.size() > 1) {
filter.add(Predicates.or(filterSubtypes));

View file

@ -15,7 +15,6 @@ import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -127,7 +126,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
permanent.getAbilities().setControllerId(lockedControllers.get(permanent.getId()));
if (destroyAttachedAuras) {
FilterPermanent filter = new FilterPermanent();
filter.add(new SubtypePredicate(SubType.AURA));
filter.add(SubType.AURA.getPredicate());
for (UUID attachmentId : new HashSet<>(permanent.getAttachments())) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && filter.match(attachment, game)) {

View file

@ -10,7 +10,6 @@ import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.ZombieArmyToken;
@ -29,7 +28,7 @@ public class AmassEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledPermanent("Army you control");
static {
filter.add(new SubtypePredicate(SubType.ARMY));
filter.add(SubType.ARMY.getPredicate());
}
private final DynamicValue amassNumber;

View file

@ -9,7 +9,6 @@ import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
@ -45,7 +44,7 @@ public class SweepEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
FilterPermanent filter = new FilterControlledLandPermanent("any number of " + sweepSubtype + "s you control");
filter.add(new SubtypePredicate(sweepSubtype));
filter.add(sweepSubtype.getPredicate());
Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
if (controller.chooseTarget(outcome, target, source, game)) {
game.getState().setValue(CardUtil.getCardZoneString("sweep", source.getSourceId(), game), target.getTargets().size());

View file

@ -7,7 +7,6 @@ import mage.abilities.hint.ValueHint;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
* @author LevelX2
@ -32,7 +31,7 @@ public class AffinityForLandTypeAbility extends SimpleStaticAbility {
private static FilterControlledPermanent getFilter(SubType landType) {
FilterControlledPermanent affinityfilter = new FilterControlledPermanent();
affinityfilter.add(new SubtypePredicate(landType));
affinityfilter.add(landType.getPredicate());
return affinityfilter;
}

View file

@ -10,7 +10,6 @@ import mage.constants.Outcome;
import mage.constants.SubType;
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;
@ -63,7 +62,7 @@ class AuraSwapEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
FilterCard filterCardToCheck = new FilterCard();
filterCardToCheck.add(new SubtypePredicate(SubType.AURA));
filterCardToCheck.add(SubType.AURA.getPredicate());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent auraSourcePermanent = game.getPermanent(source.getSourceId());

View file

@ -21,7 +21,6 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -79,7 +78,7 @@ public class ChampionAbility extends StaticAbility {
if (!subtypes.isEmpty()) {
int i = 0;
for (SubType subtype : this.subtypes) {
subtypesPredicates.add(new SubtypePredicate(subtype));
subtypesPredicates.add(subtype.getPredicate());
if (i == 0) {
sb.append(subtype);
} else {

View file

@ -5,7 +5,6 @@ package mage.abilities.keyword;
import mage.abilities.costs.mana.ManaCosts;
import mage.constants.SubType;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -15,7 +14,7 @@ public class ForestcyclingAbility extends CyclingAbility{
private static final FilterLandCard filter = new FilterLandCard("Forest card");
private static final String text = "Forestcycling";
static{
filter.add(new SubtypePredicate(SubType.FOREST));
filter.add(SubType.FOREST.getPredicate());
}
public ForestcyclingAbility(ManaCosts costs) {

View file

@ -3,7 +3,6 @@ package mage.abilities.keyword;
import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -14,7 +13,7 @@ public class ForestwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("forest");
static {
filter.add(new SubtypePredicate(SubType.FOREST));
filter.add(SubType.FOREST.getPredicate());
}
public ForestwalkAbility() {

View file

@ -5,7 +5,6 @@ package mage.abilities.keyword;
import mage.abilities.costs.mana.ManaCosts;
import mage.constants.SubType;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -15,7 +14,7 @@ public class IslandcyclingAbility extends CyclingAbility{
private static final FilterLandCard filter = new FilterLandCard("Island card");
private static final String text = "Islandcycling";
static{
filter.add(new SubtypePredicate(SubType.ISLAND));
filter.add(SubType.ISLAND.getPredicate());
}
public IslandcyclingAbility(ManaCosts costs) {

View file

@ -3,7 +3,6 @@ package mage.abilities.keyword;
import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -14,7 +13,7 @@ public class IslandwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("island");
static {
filter.add(new SubtypePredicate(SubType.ISLAND));
filter.add(SubType.ISLAND.getPredicate());
}
public IslandwalkAbility() {

View file

@ -5,7 +5,6 @@ package mage.abilities.keyword;
import mage.abilities.costs.mana.ManaCosts;
import mage.constants.SubType;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -15,7 +14,7 @@ public class MountaincyclingAbility extends CyclingAbility{
private static final FilterLandCard filter = new FilterLandCard("Mountain card");
private static final String text = "Mountaincycling";
static{
filter.add(new SubtypePredicate(SubType.MOUNTAIN));
filter.add(SubType.MOUNTAIN.getPredicate());
}
public MountaincyclingAbility(ManaCosts costs) {

View file

@ -3,7 +3,6 @@ package mage.abilities.keyword;
import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -14,7 +13,7 @@ public class MountainwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("mountain");
static {
filter.add(new SubtypePredicate(SubType.MOUNTAIN));
filter.add(SubType.MOUNTAIN.getPredicate());
}
public MountainwalkAbility() {

View file

@ -10,7 +10,6 @@ import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.Card;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -48,7 +47,7 @@ public class OfferingAbility extends StaticAbility {
*/
public OfferingAbility(SubType subtype) {
super(Zone.ALL, null);
filter.add(new SubtypePredicate(subtype));
filter.add(subtype.getPredicate());
filter.setMessage(subtype.getDescription());
this.addEffect(new OfferingAsThoughEffect());
}

View file

@ -5,7 +5,6 @@ package mage.abilities.keyword;
import mage.abilities.costs.mana.ManaCosts;
import mage.constants.SubType;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -15,7 +14,7 @@ public class PlainscyclingAbility extends CyclingAbility{
private static final FilterLandCard filter = new FilterLandCard("Plains card");
private static final String text = "Plainscycling";
static{
filter.add(new SubtypePredicate(SubType.PLAINS));
filter.add(SubType.PLAINS.getPredicate());
}
public PlainscyclingAbility(ManaCosts costs) {

View file

@ -3,7 +3,6 @@ package mage.abilities.keyword;
import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -14,7 +13,7 @@ public class PlainswalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("plains");
static {
filter.add(new SubtypePredicate(SubType.PLAINS));
filter.add(SubType.PLAINS.getPredicate());
}
public PlainswalkAbility() {

View file

@ -10,7 +10,6 @@ import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
@ -52,7 +51,7 @@ public class SoulshiftAbility extends DiesTriggeredAbility {
int intValue = amount.calculate(game, this, null);
FilterCard filter = new FilterCard("Spirit card with converted mana cost " + intValue + " or less from your graveyard");
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, intValue + 1));
filter.add(new SubtypePredicate(SubType.SPIRIT));
filter.add(SubType.SPIRIT.getPredicate());
this.addTarget(new TargetCardInYourGraveyard(filter));
super.trigger(game, controllerId); //To change body of generated methods, choose Tools | Templates.
}

View file

@ -5,7 +5,6 @@ package mage.abilities.keyword;
import mage.abilities.costs.mana.ManaCosts;
import mage.constants.SubType;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -16,7 +15,7 @@ public class SwampcyclingAbility extends CyclingAbility{
private static final FilterLandCard filter = new FilterLandCard("Swamp card");
private static final String text = "Swampcycling";
static{
filter.add(new SubtypePredicate(SubType.SWAMP));
filter.add(SubType.SWAMP.getPredicate());
}
public SwampcyclingAbility(ManaCosts costs) {
super(costs, filter, text);

View file

@ -3,7 +3,6 @@ package mage.abilities.keyword;
import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -14,7 +13,7 @@ public class SwampwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("swamp");
static {
filter.add(new SubtypePredicate(SubType.SWAMP));
filter.add(SubType.SWAMP.getPredicate());
}
public SwampwalkAbility() {

View file

@ -10,7 +10,6 @@ import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -32,13 +31,13 @@ public class FilterPermanent extends FilterObject<Permanent> implements FilterIn
public FilterPermanent(SubType subtype, String name) {
super(name);
this.add(new SubtypePredicate(subtype));
this.add(subtype.getPredicate());
}
public FilterPermanent(Set<SubType> subtypesList, String name) {
super(name);
for (SubType subtype : subtypesList) {
this.add(new SubtypePredicate(subtype));
this.add(subtype.getPredicate());
}
}

View file

@ -12,7 +12,6 @@ import mage.constants.TargetController;
import mage.filter.common.*;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.MulticoloredPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.filter.predicate.other.PlayerPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
@ -595,7 +594,7 @@ public final class StaticFilters {
static {
FILTER_PERMANENT_AURA.add(CardType.ENCHANTMENT.getPredicate());
FILTER_PERMANENT_AURA.add(new SubtypePredicate(SubType.AURA));
FILTER_PERMANENT_AURA.add(SubType.AURA.getPredicate());
FILTER_PERMANENT_AURA.setLockedFilter(true);
}
@ -603,7 +602,7 @@ public final class StaticFilters {
static {
FILTER_PERMANENT_EQUIPMENT.add(CardType.ARTIFACT.getPredicate());
FILTER_PERMANENT_EQUIPMENT.add(new SubtypePredicate(SubType.EQUIPMENT));
FILTER_PERMANENT_EQUIPMENT.add(SubType.EQUIPMENT.getPredicate());
FILTER_PERMANENT_EQUIPMENT.setLockedFilter(true);
}
@ -611,7 +610,7 @@ public final class StaticFilters {
static {
FILTER_PERMANENT_FORTIFICATION.add(CardType.ARTIFACT.getPredicate());
FILTER_PERMANENT_FORTIFICATION.add(new SubtypePredicate(SubType.FORTIFICATION));
FILTER_PERMANENT_FORTIFICATION.add(SubType.FORTIFICATION.getPredicate());
FILTER_PERMANENT_FORTIFICATION.setLockedFilter(true);
}

View file

@ -4,7 +4,6 @@ package mage.filter.common;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -15,7 +14,7 @@ public class FilterBySubtypeCard extends FilterCard {
public FilterBySubtypeCard(SubType subtype) {
super(subtype + " card");
this.add(new SubtypePredicate(subtype));
this.add(subtype.getPredicate());
}
public FilterBySubtypeCard(final FilterBySubtypeCard filter) {

View file

@ -4,8 +4,6 @@ package mage.filter.common;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author BetaSteward_at_googlemail.com
@ -29,7 +27,7 @@ public class FilterControlledCreaturePermanent extends FilterControlledPermanent
this.add(CardType.CREATURE.getPredicate());
if(subtype != null) {
this.add(new SubtypePredicate(subtype));
this.add(subtype.getPredicate());
}
}

View file

@ -3,7 +3,6 @@ package mage.filter.common;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
@ -27,7 +26,7 @@ public class FilterControlledPermanent extends FilterPermanent {
super(name);
this.add(new ControllerPredicate(TargetController.YOU));
if (subtype != null) {
this.add(new SubtypePredicate(subtype));
this.add(subtype.getPredicate());
}
}

View file

@ -2,7 +2,6 @@ package mage.filter.common;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
* @author LevelX2
@ -20,7 +19,7 @@ public class FilterControlledPlaneswalkerPermanent extends FilterControlledPerma
public FilterControlledPlaneswalkerPermanent(SubType subType, String name) {
super(name);
this.add(CardType.PLANESWALKER.getPredicate());
this.add(new SubtypePredicate(subType));
this.add(subType.getPredicate());
}
public FilterControlledPlaneswalkerPermanent(String name) {

View file

@ -5,7 +5,6 @@ package mage.filter.common;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -25,7 +24,7 @@ public class FilterCreaturePermanent extends FilterPermanent {
public FilterCreaturePermanent(SubType subtype, String name) {
super(name);
this.add(CardType.CREATURE.getPredicate());
this.add(new SubtypePredicate(subtype));
this.add(subtype.getPredicate());
}
public FilterCreaturePermanent(final FilterCreaturePermanent filter) {

View file

@ -4,7 +4,6 @@
package mage.filter.common;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -18,7 +17,7 @@ public class FilterEquipmentPermanent extends FilterPermanent {
public FilterEquipmentPermanent(String name) {
super(name);
this.add(new SubtypePredicate(SubType.EQUIPMENT));
this.add(SubType.EQUIPMENT.getPredicate());
}
public FilterEquipmentPermanent(final FilterEquipmentPermanent filter) {

View file

@ -7,7 +7,6 @@ import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
/**
@ -27,7 +26,7 @@ public class FilterLandPermanent extends FilterPermanent {
public FilterLandPermanent(SubType subtype, String name) {
super(name);
this.add(CardType.LAND.getPredicate());
this.add(new SubtypePredicate(subtype));
this.add(subtype.getPredicate());
}
public static FilterLandPermanent nonbasicLand() {

View file

@ -7,7 +7,6 @@ import java.util.List;
import mage.constants.SubType;
import mage.constants.SubTypeSet;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -22,10 +21,10 @@ public class FilterOtherCreatureSharingCreatureSubtype extends FilterCreaturePer
public FilterOtherCreatureSharingCreatureSubtype(Permanent creature, Game game) {
super("creature sharing a creature type with " + creature.toString());
List<SubtypePredicate> subtypePredicates = new ArrayList<>();
List<SubType.SubTypePredicate> subtypePredicates = new ArrayList<>();
for (SubType subtype : creature.getSubtype(game)) {
if (subtype.getSubTypeSet() == SubTypeSet.CreatureType) {
subtypePredicates.add(new SubtypePredicate(subtype));
subtypePredicates.add(subtype.getPredicate());
}
}
this.add(Predicates.and(

View file

@ -5,7 +5,6 @@ package mage.filter.common;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
* @author BetaSteward_at_googlemail.com
@ -18,7 +17,7 @@ public class FilterPlaneswalkerPermanent extends FilterPermanent {
public FilterPlaneswalkerPermanent(SubType subType) {
this(subType.getDescription() + " planeswalker");
this.add(new SubtypePredicate(subType));
this.add(subType.getPredicate());
}
public FilterPlaneswalkerPermanent(String name) {

View file

@ -3,7 +3,6 @@ package mage.filter.common;
import mage.constants.SubType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
public class FilterSpiritOrArcaneCard extends FilterSpell {
@ -13,7 +12,7 @@ public class FilterSpiritOrArcaneCard extends FilterSpell {
public FilterSpiritOrArcaneCard(String name) {
super(name);
this.add(Predicates.or(new SubtypePredicate(SubType.SPIRIT),new SubtypePredicate(SubType.ARCANE)));
this.add(Predicates.or(SubType.SPIRIT.getPredicate(),SubType.ARCANE.getPredicate()));
}
public FilterSpiritOrArcaneCard(final FilterSpiritOrArcaneCard filter) {

View file

@ -1,31 +0,0 @@
package mage.filter.predicate.mageobject;
import mage.MageObject;
import mage.constants.SubType;
import mage.filter.predicate.Predicate;
import mage.game.Game;
/**
*
* @author North
*/
public class SubtypePredicate implements Predicate<MageObject> {
private final SubType subtype;
public SubtypePredicate(SubType subtype) {
this.subtype = subtype;
}
@Override
public boolean apply(MageObject input, Game game) {
return input.hasSubtype(subtype, game);
}
@Override
public String toString() {
return "Subtype(" + subtype + ')';
}
}

View file

@ -4,7 +4,6 @@ package mage.filter.predicate.permanent;
import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -17,7 +16,7 @@ public class ControllerControlsIslandPredicate implements Predicate<Permanent> {
public static final FilterLandPermanent filter = new FilterLandPermanent("Island");
static {
filter.add(new SubtypePredicate(SubType.ISLAND));
filter.add(SubType.ISLAND.getPredicate());
}
@Override

View file

@ -18,7 +18,6 @@ import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.filter.predicate.permanent.AttackingSameNotBandedPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
@ -323,7 +322,7 @@ public class Combat implements Serializable, Copyable<Combat> {
for (Ability ab : bandsWithOther) {
BandsWithOtherAbility ability = (BandsWithOtherAbility) ab;
if (ability.getSubtype() != null) {
predicates.add(new SubtypePredicate(ability.getSubtype()));
predicates.add(ability.getSubtype().getPredicate());
}
if (ability.getSupertype() != null) {
predicates.add(new SupertypePredicate(ability.getSupertype()));
@ -357,7 +356,7 @@ public class Combat implements Serializable, Copyable<Combat> {
for (Ability ab : bandsWithOther) {
BandsWithOtherAbility ability = (BandsWithOtherAbility) ab;
if (ability.getSubtype() != null) {
predicates.add(new SubtypePredicate(ability.getSubtype()));
predicates.add(ability.getSubtype().getPredicate());
}
if (ability.getSupertype() != null) {
predicates.add(new SupertypePredicate(ability.getSupertype()));

View file

@ -8,7 +8,6 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterPlaneswalkerPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
@ -30,7 +29,7 @@ class GideonOfTheTrialsCantLoseEffect extends ContinuousRuleModifyingEffectImpl
private static final FilterPlaneswalkerPermanent filter = new FilterPlaneswalkerPermanent("a Gideon planeswalker");
static {
filter.add(new SubtypePredicate(SubType.GIDEON));
filter.add(SubType.GIDEON.getPredicate());
}
public GideonOfTheTrialsCantLoseEffect() {

View file

@ -9,10 +9,7 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.*;
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
@ -37,7 +34,7 @@ class KothOfTheHammerThirdEffect extends ContinuousEffectImpl {
static final FilterLandPermanent mountains = new FilterLandPermanent("Mountain you control");
static {
mountains.add(new SubtypePredicate(SubType.MOUNTAIN));
mountains.add(SubType.MOUNTAIN.getPredicate());
mountains.add(new ControllerPredicate(TargetController.YOU));
}

View file

@ -11,7 +11,6 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.command.Emblem;
/**
@ -23,7 +22,7 @@ public final class LilianaOfTheDarkRealmsEmblem extends Emblem {
private static final FilterLandPermanent filter = new FilterLandPermanent("Swamps");
static {
filter.add(new SubtypePredicate(SubType.SWAMP));
filter.add(SubType.SWAMP.getPredicate());
}
public LilianaOfTheDarkRealmsEmblem() {

View file

@ -10,7 +10,6 @@ import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.token.ZombieToken;
@ -35,7 +34,7 @@ class LilianaZombiesCount implements DynamicValue {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(new SubtypePredicate(SubType.ZOMBIE));
filter.add(SubType.ZOMBIE.getPredicate());
}
@Override

View file

@ -10,7 +10,6 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -21,7 +20,7 @@ public final class KalonianTwingroveTreefolkWarriorToken extends TokenImpl {
static final FilterControlledPermanent filterLands = new FilterControlledPermanent("Forests you control");
static {
filterLands.add(new SubtypePredicate(SubType.FOREST));
filterLands.add(SubType.FOREST.getPredicate());
}
public KalonianTwingroveTreefolkWarriorToken() {

View file

@ -6,7 +6,6 @@ import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -20,7 +19,7 @@ public class PreCombatMainStep extends Step {
private static final FilterPermanent filter = new FilterPermanent("Saga");
static {
filter.add(new SubtypePredicate(SubType.SAGA));
filter.add(SubType.SAGA.getPredicate());
}
public PreCombatMainStep() {