From 786b5cd75176dcc995a9030f50863115c94ca0bb Mon Sep 17 00:00:00 2001 From: magenoxx Date: Fri, 13 May 2011 10:00:41 +0400 Subject: [PATCH] Fixed notCardType in FilterObject. Now Crush, Go for the Troat, Inquisition Of Koziler, Negate, Duress, Spell Pierce works correctly. --- Mage.Sets/src/mage/sets/magic2010/Duress.java | 6 ++--- Mage.Sets/src/mage/sets/magic2010/Negate.java | 3 +-- .../src/mage/sets/mirrodinbesieged/Crush.java | 3 +-- .../sets/mirrodinbesieged/GofortheThroat.java | 3 +-- .../InquisitionOfKozilek.java | 4 +--- .../src/mage/sets/zendikar/SpellPierce.java | 3 +-- Mage/src/mage/filter/FilterObject.java | 23 +++++++++++++++++-- .../mage/filter/common/FilterNonlandCard.java | 3 +-- 8 files changed, 29 insertions(+), 19 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magic2010/Duress.java b/Mage.Sets/src/mage/sets/magic2010/Duress.java index 8b332b79f0c..3f14ef8f280 100644 --- a/Mage.Sets/src/mage/sets/magic2010/Duress.java +++ b/Mage.Sets/src/mage/sets/magic2010/Duress.java @@ -78,10 +78,8 @@ class DuressEffect extends OneShotEffect { private static FilterCard filter = new FilterCard("noncreature, nonland card"); static { - filter.getCardType().add(CardType.CREATURE); - filter.getCardType().add(CardType.LAND); - filter.setScopeCardType(ComparisonScope.Any); - filter.setNotCardType(true); + filter.getNotCardType().add(CardType.CREATURE); + filter.getNotCardType().add(CardType.LAND); } public DuressEffect() { diff --git a/Mage.Sets/src/mage/sets/magic2010/Negate.java b/Mage.Sets/src/mage/sets/magic2010/Negate.java index 10de6800722..0c89dfa0f5a 100644 --- a/Mage.Sets/src/mage/sets/magic2010/Negate.java +++ b/Mage.Sets/src/mage/sets/magic2010/Negate.java @@ -45,8 +45,7 @@ public class Negate extends CardImpl { private static FilterSpell filter = new FilterSpell("noncreature spell"); static { - filter.getCardType().add(CardType.CREATURE); - filter.setNotCardType(true); + filter.getNotCardType().add(CardType.CREATURE); } public Negate(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/Crush.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/Crush.java index 5f365fc0a73..c93809caa3b 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/Crush.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/Crush.java @@ -44,8 +44,7 @@ public class Crush extends CardImpl { private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("noncreature artifact"); static { - filter.getCardType().add(CardType.CREATURE); - filter.setNotCardType(true); + filter.getNotCardType().add(CardType.CREATURE); } public Crush(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/GofortheThroat.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/GofortheThroat.java index e34cc491955..58917d427cf 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/GofortheThroat.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/GofortheThroat.java @@ -45,8 +45,7 @@ public class GofortheThroat extends CardImpl { private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); static { - filter.getCardType().add(CardType.ARTIFACT); - filter.setNotCardType(true); + filter.getNotCardType().add(CardType.ARTIFACT); } public GofortheThroat(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/InquisitionOfKozilek.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/InquisitionOfKozilek.java index 20a9ec9cb26..631960c5365 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/InquisitionOfKozilek.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/InquisitionOfKozilek.java @@ -79,9 +79,7 @@ class InquisitionOfKozilekEffect extends OneShotEffect { private static FilterSpell filter = new FilterSpell("noncreature spell"); static { - filter.getCardType().add(CardType.CREATURE); - filter.setNotCardType(true); + filter.getNotCardType().add(CardType.CREATURE); } public SpellPierce(UUID ownerId) { diff --git a/Mage/src/mage/filter/FilterObject.java b/Mage/src/mage/filter/FilterObject.java index ea3e7179bcf..698b8f7508c 100644 --- a/Mage/src/mage/filter/FilterObject.java +++ b/Mage/src/mage/filter/FilterObject.java @@ -47,6 +47,8 @@ public class FilterObject> ex protected boolean notAbilities; protected List cardType = new ArrayList(); protected ComparisonScope scopeCardType = ComparisonScope.All; + protected List notCardTypeList = new ArrayList(); + protected ComparisonScope notScopeCardType = ComparisonScope.Any; protected boolean notCardType; protected boolean colorless; protected boolean useColorless; @@ -89,8 +91,12 @@ public class FilterObject> ex for (CardType cType: (List)filter.cardType) { this.cardType.add(cType); } + for (CardType cType: (List)filter.notCardTypeList) { + this.notCardTypeList.add(cType); + } this.scopeCardType = filter.scopeCardType; this.notCardType = filter.notCardType; + this.notScopeCardType = filter.notScopeCardType; this.colorless = filter.colorless; this.useColorless = filter.useColorless; this.useColor = filter.useColor; @@ -160,6 +166,11 @@ public class FilterObject> ex return notFilter; } + if (notCardTypeList.size() > 0) { + if (compCardType.compare(notCardTypeList, object.getCardType(), notScopeCardType, false)) + return notFilter; + } + if (subtype.size() > 0) { if (!compString.compare(subtype, object.getSubtype(), scopeSubtype, notSubtype)) return notFilter; @@ -203,13 +214,21 @@ public class FilterObject> ex public List getCardType() { return this.cardType; } + + public List getNotCardType() { + return this.notCardTypeList; + } public void setScopeCardType(ComparisonScope scopeCardType) { this.scopeCardType = scopeCardType; } + + public void setNotScopeCardType(ComparisonScope notScopeCardType) { + this.notScopeCardType = notScopeCardType; + } - public void setNotCardType(boolean notCardType) { - this.notCardType = notCardType; + public void setNotCardType(boolean notCardTypeList) { + this.notCardType = notCardTypeList; } public void setColor(ObjectColor color) { diff --git a/Mage/src/mage/filter/common/FilterNonlandCard.java b/Mage/src/mage/filter/common/FilterNonlandCard.java index a0e24d3065b..20503418243 100644 --- a/Mage/src/mage/filter/common/FilterNonlandCard.java +++ b/Mage/src/mage/filter/common/FilterNonlandCard.java @@ -43,8 +43,7 @@ public class FilterNonlandCard extends FilterCard { public FilterNonlandCard(String name) { super(name); - this.cardType.add(CardType.LAND); - this.setNotCardType(true); + this.notCardTypeList.add(CardType.LAND); } public FilterNonlandCard(final FilterNonlandCard filter) {