[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.
This commit is contained in:
North 2012-07-03 08:57:14 +03:00
parent ed877f772b
commit 4639abd279
13 changed files with 23 additions and 45 deletions

View file

@ -58,7 +58,7 @@ public class DualCasting extends CardImpl<DualCasting> {
static { static {
filter.getCardType().add(CardType.INSTANT); filter.getCardType().add(CardType.INSTANT);
filter.getCardType().add(CardType.SORCERY); filter.getCardType().add(CardType.SORCERY);
filter.setNotScopeCardType(Filter.ComparisonScope.Any); filter.setScopeCardType(Filter.ComparisonScope.Any);
} }
public DualCasting(UUID ownerId) { public DualCasting(UUID ownerId) {

View file

@ -47,7 +47,7 @@ public class PeerThroughDepths extends CardImpl<PeerThroughDepths> {
static { static {
filter.getCardType().add(CardType.SORCERY); filter.getCardType().add(CardType.SORCERY);
filter.getCardType().add(CardType.INSTANT); filter.getCardType().add(CardType.INSTANT);
filter.setNotScopeCardType(ComparisonScope.Any); filter.setScopeCardType(ComparisonScope.Any);
} }

View file

@ -46,7 +46,6 @@ public class Countersquall extends CardImpl<Countersquall> {
static { static {
filter.getNotCardType().add(CardType.CREATURE); filter.getNotCardType().add(CardType.CREATURE);
filter.setNotCardType(true);
} }
public Countersquall(UUID ownerId) { public Countersquall(UUID ownerId) {

View file

@ -56,7 +56,6 @@ public class NicolBolasPlaneswalker extends CardImpl<NicolBolasPlaneswalker> {
static { static {
filter.getNotCardType().add(CardType.CREATURE); filter.getNotCardType().add(CardType.CREATURE);
filter.setNotCardType(true);
} }
public NicolBolasPlaneswalker(UUID ownerId) { public NicolBolasPlaneswalker(UUID ownerId) {

View file

@ -38,8 +38,8 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect; import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -49,13 +49,7 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class BanishingKnack extends CardImpl<BanishingKnack> { public class BanishingKnack extends CardImpl<BanishingKnack> {
private final static FilterPermanent filter = new FilterPermanent("nonland permanent"); private final static FilterPermanent filter = new FilterNonlandPermanent();
static {
filter.getCardType().add(CardType.LAND);
filter.setNotCardType(true);
filter.setScopeCardType(Filter.ComparisonScope.Any);
}
public BanishingKnack(UUID ownerId) { public BanishingKnack(UUID ownerId) {
super(ownerId, 17, "Banishing Knack", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}"); super(ownerId, 17, "Banishing Knack", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}");

View file

@ -45,7 +45,6 @@ public class Bramblecrush extends CardImpl<Bramblecrush> {
static { static {
filter.getNotCardType().add(CardType.CREATURE); filter.getNotCardType().add(CardType.CREATURE);
filter.setNotCardType(true);
} }
public Bramblecrush(UUID ownerId) { public Bramblecrush(UUID ownerId) {

View file

@ -35,8 +35,8 @@ import mage.Constants.Rarity;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -50,8 +50,9 @@ public class PlanarCleansing extends CardImpl<PlanarCleansing> {
super(ownerId, 24, "Planar Cleansing", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{W}{W}{W}"); super(ownerId, 24, "Planar Cleansing", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{W}{W}{W}");
this.expansionSetCode = "M10"; this.expansionSetCode = "M10";
this.color.setWhite(true); this.color.setWhite(true);
this.getSpellAbility().addEffect(new PlanarCleansingEffect());
// Destroy all nonland permanents. // Destroy all nonland permanents.
this.getSpellAbility().addEffect(new PlanarCleansingEffect());
} }
public PlanarCleansing(final PlanarCleansing card) { public PlanarCleansing(final PlanarCleansing card) {
@ -66,13 +67,7 @@ public class PlanarCleansing extends CardImpl<PlanarCleansing> {
class PlanarCleansingEffect extends OneShotEffect<PlanarCleansingEffect> { class PlanarCleansingEffect extends OneShotEffect<PlanarCleansingEffect> {
private final static FilterPermanent filter = new FilterPermanent(""); private final static FilterPermanent filter = new FilterNonlandPermanent();
static {
filter.getCardType().add(CardType.LAND);
filter.setNotCardType(true);
filter.setScopeCardType(Filter.ComparisonScope.Any);
}
public PlanarCleansingEffect() { public PlanarCleansingEffect() {
super(Constants.Outcome.DestroyPermanent); super(Constants.Outcome.DestroyPermanent);

View file

@ -47,7 +47,7 @@ public class MuddleTheMixture extends CardImpl<MuddleTheMixture> {
static { static {
filter.getCardType().add(CardType.INSTANT); filter.getCardType().add(CardType.INSTANT);
filter.getCardType().add(CardType.SORCERY); filter.getCardType().add(CardType.SORCERY);
filter.setNotScopeCardType(Filter.ComparisonScope.Any); filter.setScopeCardType(Filter.ComparisonScope.Any);
} }
public MuddleTheMixture(UUID ownerId) { public MuddleTheMixture(UUID ownerId) {

View file

@ -51,8 +51,7 @@ public class Magmaw extends CardImpl<Magmaw> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("nonland permanent"); private static final FilterControlledPermanent filter = new FilterControlledPermanent("nonland permanent");
static { static {
filter.getCardType().add(CardType.LAND); filter.getNotCardType().add(CardType.LAND);
filter.setNotCardType(true);
} }
public Magmaw(UUID ownerId) { public Magmaw(UUID ownerId) {

View file

@ -52,7 +52,7 @@ public class Cursecatcher extends CardImpl<Cursecatcher> {
static { static {
filter.getCardType().add(CardType.INSTANT); filter.getCardType().add(CardType.INSTANT);
filter.getCardType().add(CardType.SORCERY); filter.getCardType().add(CardType.SORCERY);
filter.setNotScopeCardType(ComparisonScope.Any); filter.setScopeCardType(ComparisonScope.Any);
} }
public Cursecatcher(UUID ownerId) { public Cursecatcher(UUID ownerId) {

View file

@ -49,9 +49,8 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
protected boolean notAbilities; protected boolean notAbilities;
protected List<CardType> cardType = new ArrayList<CardType>(); protected List<CardType> cardType = new ArrayList<CardType>();
protected ComparisonScope scopeCardType = ComparisonScope.Any; protected ComparisonScope scopeCardType = ComparisonScope.Any;
protected List<CardType> notCardTypeList = new ArrayList<CardType>(); protected List<CardType> notCardType = new ArrayList<CardType>();
protected ComparisonScope notScopeCardType = ComparisonScope.Any; protected ComparisonScope scopeNotCardType = ComparisonScope.Any;
protected boolean notCardType;
protected boolean colorless; protected boolean colorless;
protected boolean useColorless; protected boolean useColorless;
protected boolean useColor; protected boolean useColor;
@ -94,10 +93,9 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
this.abilities = filter.abilities.copy(); this.abilities = filter.abilities.copy();
this.notAbilities = filter.notAbilities; this.notAbilities = filter.notAbilities;
this.cardType.addAll(filter.cardType); this.cardType.addAll(filter.cardType);
this.notCardTypeList.addAll(filter.notCardTypeList); this.notCardType.addAll(filter.notCardType);
this.scopeCardType = filter.scopeCardType; this.scopeCardType = filter.scopeCardType;
this.notCardType = filter.notCardType; this.scopeNotCardType = filter.scopeNotCardType;
this.notScopeCardType = filter.notScopeCardType;
this.colorless = filter.colorless; this.colorless = filter.colorless;
this.useColorless = filter.useColorless; this.useColorless = filter.useColorless;
this.useColor = filter.useColor; this.useColor = filter.useColor;
@ -151,12 +149,12 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
} }
if (cardType.size() > 0) { if (cardType.size() > 0) {
if (!compCardType.compare(cardType, object.getCardType(), scopeCardType, notCardType)) if (!compCardType.compare(cardType, object.getCardType(), scopeCardType, false))
return notFilter; return notFilter;
} }
if (notCardTypeList.size() > 0) { if (notCardType.size() > 0) {
if (compCardType.compare(notCardTypeList, object.getCardType(), notScopeCardType, false)) if (compCardType.compare(notCardType, object.getCardType(), scopeNotCardType, false))
return notFilter; return notFilter;
} }
@ -217,19 +215,15 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
} }
public List<CardType> getNotCardType() { public List<CardType> getNotCardType() {
return this.notCardTypeList; return this.notCardType;
} }
public void setScopeCardType(ComparisonScope scopeCardType) { public void setScopeCardType(ComparisonScope scopeCardType) {
this.scopeCardType = scopeCardType; this.scopeCardType = scopeCardType;
} }
public void setNotScopeCardType(ComparisonScope notScopeCardType) { public void setScopeNotCardType(ComparisonScope scopeNotCardType) {
this.notScopeCardType = notScopeCardType; this.scopeNotCardType = scopeNotCardType;
}
public void setNotCardType(boolean notCardTypeList) {
this.notCardType = notCardTypeList;
} }
public void setColor(ObjectColor color) { public void setColor(ObjectColor color) {

View file

@ -43,7 +43,7 @@ public class FilterNonlandCard extends FilterCard<FilterNonlandCard> {
public FilterNonlandCard(String name) { public FilterNonlandCard(String name) {
super(name); super(name);
this.notCardTypeList.add(CardType.LAND); this.notCardType.add(CardType.LAND);
} }
public FilterNonlandCard(final FilterNonlandCard filter) { public FilterNonlandCard(final FilterNonlandCard filter) {

View file

@ -43,8 +43,7 @@ public class FilterNonlandPermanent extends FilterPermanent<FilterNonlandPermane
public FilterNonlandPermanent(String name) { public FilterNonlandPermanent(String name) {
super(name); super(name);
notCardType = true; notCardType.add(CardType.LAND);
cardType.add(CardType.LAND);
} }
public FilterNonlandPermanent(final FilterNonlandPermanent filter) { public FilterNonlandPermanent(final FilterNonlandPermanent filter) {