mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
refactored all instances of SubtypePredicate
This commit is contained in:
parent
3b8298e7c2
commit
86906ec25f
1659 changed files with 2039 additions and 3777 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 + ')';
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue