From 4639abd2797723fe65e7eeb58e8f5641b672c6d4 Mon Sep 17 00:00:00 2001 From: North Date: Tue, 3 Jul 2012 08:57:14 +0300 Subject: [PATCH] [refactoring] Fixed issues caused by notCardType. Removed notCardType - it was a relic from previous implementation. Renamed notScopeCardType to scopeNotCardType. Renamed notCardTypeList to notCardType for consistency with cardType. --- .../mage/sets/avacynrestored/DualCasting.java | 2 +- .../PeerThroughDepths.java | 2 +- .../src/mage/sets/conflux/Countersquall.java | 1 - .../sets/conflux/NicolBolasPlaneswalker.java | 1 - .../mage/sets/eventide/BanishingKnack.java | 10 ++----- .../src/mage/sets/innistrad/Bramblecrush.java | 1 - .../mage/sets/magic2010/PlanarCleansing.java | 13 +++------- .../mage/sets/ravnika/MuddleTheMixture.java | 2 +- .../mage/sets/riseoftheeldrazi/Magmaw.java | 3 +-- .../mage/sets/shadowmoor/Cursecatcher.java | 2 +- Mage/src/mage/filter/FilterObject.java | 26 +++++++------------ .../mage/filter/common/FilterNonlandCard.java | 2 +- .../filter/common/FilterNonlandPermanent.java | 3 +-- 13 files changed, 23 insertions(+), 45 deletions(-) diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DualCasting.java b/Mage.Sets/src/mage/sets/avacynrestored/DualCasting.java index 608af83340..a1f16ffe7c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DualCasting.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DualCasting.java @@ -58,7 +58,7 @@ public class DualCasting extends CardImpl { static { filter.getCardType().add(CardType.INSTANT); filter.getCardType().add(CardType.SORCERY); - filter.setNotScopeCardType(Filter.ComparisonScope.Any); + filter.setScopeCardType(Filter.ComparisonScope.Any); } public DualCasting(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java b/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java index 1deff87a01..b1e2ced9ec 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java @@ -47,7 +47,7 @@ public class PeerThroughDepths extends CardImpl { static { filter.getCardType().add(CardType.SORCERY); filter.getCardType().add(CardType.INSTANT); - filter.setNotScopeCardType(ComparisonScope.Any); + filter.setScopeCardType(ComparisonScope.Any); } diff --git a/Mage.Sets/src/mage/sets/conflux/Countersquall.java b/Mage.Sets/src/mage/sets/conflux/Countersquall.java index ec7b71bbed..a7f8f61e25 100644 --- a/Mage.Sets/src/mage/sets/conflux/Countersquall.java +++ b/Mage.Sets/src/mage/sets/conflux/Countersquall.java @@ -46,7 +46,6 @@ public class Countersquall extends CardImpl { static { filter.getNotCardType().add(CardType.CREATURE); - filter.setNotCardType(true); } public Countersquall(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/conflux/NicolBolasPlaneswalker.java b/Mage.Sets/src/mage/sets/conflux/NicolBolasPlaneswalker.java index 492ea7e487..40c7e03721 100644 --- a/Mage.Sets/src/mage/sets/conflux/NicolBolasPlaneswalker.java +++ b/Mage.Sets/src/mage/sets/conflux/NicolBolasPlaneswalker.java @@ -56,7 +56,6 @@ public class NicolBolasPlaneswalker extends CardImpl { static { filter.getNotCardType().add(CardType.CREATURE); - filter.setNotCardType(true); } public NicolBolasPlaneswalker(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/eventide/BanishingKnack.java b/Mage.Sets/src/mage/sets/eventide/BanishingKnack.java index 00b13c71d1..64999c9600 100644 --- a/Mage.Sets/src/mage/sets/eventide/BanishingKnack.java +++ b/Mage.Sets/src/mage/sets/eventide/BanishingKnack.java @@ -38,8 +38,8 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.continious.GainAbilityTargetEffect; import mage.cards.CardImpl; -import mage.filter.Filter; import mage.filter.FilterPermanent; +import mage.filter.common.FilterNonlandPermanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -49,13 +49,7 @@ import mage.target.common.TargetCreaturePermanent; */ public class BanishingKnack extends CardImpl { - private final static FilterPermanent filter = new FilterPermanent("nonland permanent"); - - static { - filter.getCardType().add(CardType.LAND); - filter.setNotCardType(true); - filter.setScopeCardType(Filter.ComparisonScope.Any); - } + private final static FilterPermanent filter = new FilterNonlandPermanent(); public BanishingKnack(UUID ownerId) { super(ownerId, 17, "Banishing Knack", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}"); diff --git a/Mage.Sets/src/mage/sets/innistrad/Bramblecrush.java b/Mage.Sets/src/mage/sets/innistrad/Bramblecrush.java index b1bfe66bc5..69b45078f6 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Bramblecrush.java +++ b/Mage.Sets/src/mage/sets/innistrad/Bramblecrush.java @@ -45,7 +45,6 @@ public class Bramblecrush extends CardImpl { static { filter.getNotCardType().add(CardType.CREATURE); - filter.setNotCardType(true); } public Bramblecrush(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java b/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java index 6a0fd92517..3a8f6a01ef 100644 --- a/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java +++ b/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java @@ -35,8 +35,8 @@ import mage.Constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; -import mage.filter.Filter; import mage.filter.FilterPermanent; +import mage.filter.common.FilterNonlandPermanent; import mage.game.Game; import mage.game.permanent.Permanent; @@ -50,8 +50,9 @@ public class PlanarCleansing extends CardImpl { super(ownerId, 24, "Planar Cleansing", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{W}{W}{W}"); this.expansionSetCode = "M10"; this.color.setWhite(true); - this.getSpellAbility().addEffect(new PlanarCleansingEffect()); + // Destroy all nonland permanents. + this.getSpellAbility().addEffect(new PlanarCleansingEffect()); } public PlanarCleansing(final PlanarCleansing card) { @@ -66,13 +67,7 @@ public class PlanarCleansing extends CardImpl { class PlanarCleansingEffect extends OneShotEffect { - private final static FilterPermanent filter = new FilterPermanent(""); - - static { - filter.getCardType().add(CardType.LAND); - filter.setNotCardType(true); - filter.setScopeCardType(Filter.ComparisonScope.Any); - } + private final static FilterPermanent filter = new FilterNonlandPermanent(); public PlanarCleansingEffect() { super(Constants.Outcome.DestroyPermanent); diff --git a/Mage.Sets/src/mage/sets/ravnika/MuddleTheMixture.java b/Mage.Sets/src/mage/sets/ravnika/MuddleTheMixture.java index 19c497dc7b..a7580cb676 100644 --- a/Mage.Sets/src/mage/sets/ravnika/MuddleTheMixture.java +++ b/Mage.Sets/src/mage/sets/ravnika/MuddleTheMixture.java @@ -47,7 +47,7 @@ public class MuddleTheMixture extends CardImpl { static { filter.getCardType().add(CardType.INSTANT); filter.getCardType().add(CardType.SORCERY); - filter.setNotScopeCardType(Filter.ComparisonScope.Any); + filter.setScopeCardType(Filter.ComparisonScope.Any); } public MuddleTheMixture(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/Magmaw.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/Magmaw.java index 303f3202db..5fe7e73101 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/Magmaw.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/Magmaw.java @@ -51,8 +51,7 @@ public class Magmaw extends CardImpl { private static final FilterControlledPermanent filter = new FilterControlledPermanent("nonland permanent"); static { - filter.getCardType().add(CardType.LAND); - filter.setNotCardType(true); + filter.getNotCardType().add(CardType.LAND); } public Magmaw(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Cursecatcher.java b/Mage.Sets/src/mage/sets/shadowmoor/Cursecatcher.java index 0ce77656d6..76281c82f9 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Cursecatcher.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Cursecatcher.java @@ -52,7 +52,7 @@ public class Cursecatcher extends CardImpl { static { filter.getCardType().add(CardType.INSTANT); filter.getCardType().add(CardType.SORCERY); - filter.setNotScopeCardType(ComparisonScope.Any); + filter.setScopeCardType(ComparisonScope.Any); } public Cursecatcher(UUID ownerId) { diff --git a/Mage/src/mage/filter/FilterObject.java b/Mage/src/mage/filter/FilterObject.java index ad53a188cc..e55ead13c7 100644 --- a/Mage/src/mage/filter/FilterObject.java +++ b/Mage/src/mage/filter/FilterObject.java @@ -49,9 +49,8 @@ public class FilterObject> ex protected boolean notAbilities; protected List cardType = new ArrayList(); protected ComparisonScope scopeCardType = ComparisonScope.Any; - protected List notCardTypeList = new ArrayList(); - protected ComparisonScope notScopeCardType = ComparisonScope.Any; - protected boolean notCardType; + protected List notCardType = new ArrayList(); + protected ComparisonScope scopeNotCardType = ComparisonScope.Any; protected boolean colorless; protected boolean useColorless; protected boolean useColor; @@ -94,10 +93,9 @@ public class FilterObject> ex this.abilities = filter.abilities.copy(); this.notAbilities = filter.notAbilities; this.cardType.addAll(filter.cardType); - this.notCardTypeList.addAll(filter.notCardTypeList); + this.notCardType.addAll(filter.notCardType); this.scopeCardType = filter.scopeCardType; - this.notCardType = filter.notCardType; - this.notScopeCardType = filter.notScopeCardType; + this.scopeNotCardType = filter.scopeNotCardType; this.colorless = filter.colorless; this.useColorless = filter.useColorless; this.useColor = filter.useColor; @@ -151,12 +149,12 @@ public class FilterObject> ex } if (cardType.size() > 0) { - if (!compCardType.compare(cardType, object.getCardType(), scopeCardType, notCardType)) + if (!compCardType.compare(cardType, object.getCardType(), scopeCardType, false)) return notFilter; } - if (notCardTypeList.size() > 0) { - if (compCardType.compare(notCardTypeList, object.getCardType(), notScopeCardType, false)) + if (notCardType.size() > 0) { + if (compCardType.compare(notCardType, object.getCardType(), scopeNotCardType, false)) return notFilter; } @@ -217,19 +215,15 @@ public class FilterObject> ex } public List getNotCardType() { - return this.notCardTypeList; + return this.notCardType; } public void setScopeCardType(ComparisonScope scopeCardType) { this.scopeCardType = scopeCardType; } - public void setNotScopeCardType(ComparisonScope notScopeCardType) { - this.notScopeCardType = notScopeCardType; - } - - public void setNotCardType(boolean notCardTypeList) { - this.notCardType = notCardTypeList; + public void setScopeNotCardType(ComparisonScope scopeNotCardType) { + this.scopeNotCardType = scopeNotCardType; } public void setColor(ObjectColor color) { diff --git a/Mage/src/mage/filter/common/FilterNonlandCard.java b/Mage/src/mage/filter/common/FilterNonlandCard.java index fc9e130cee..b73abf153c 100644 --- a/Mage/src/mage/filter/common/FilterNonlandCard.java +++ b/Mage/src/mage/filter/common/FilterNonlandCard.java @@ -43,7 +43,7 @@ public class FilterNonlandCard extends FilterCard { public FilterNonlandCard(String name) { super(name); - this.notCardTypeList.add(CardType.LAND); + this.notCardType.add(CardType.LAND); } public FilterNonlandCard(final FilterNonlandCard filter) { diff --git a/Mage/src/mage/filter/common/FilterNonlandPermanent.java b/Mage/src/mage/filter/common/FilterNonlandPermanent.java index 3af4f60a0d..1db9d9c142 100644 --- a/Mage/src/mage/filter/common/FilterNonlandPermanent.java +++ b/Mage/src/mage/filter/common/FilterNonlandPermanent.java @@ -43,8 +43,7 @@ public class FilterNonlandPermanent extends FilterPermanent