Fixed notCardType in FilterObject. Now Crush, Go for the Troat, Inquisition Of Koziler, Negate, Duress, Spell Pierce works correctly.

This commit is contained in:
magenoxx 2011-05-13 10:00:41 +04:00
parent da316cc345
commit 786b5cd751
8 changed files with 29 additions and 19 deletions

View file

@ -78,10 +78,8 @@ class DuressEffect extends OneShotEffect<DuressEffect> {
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() {

View file

@ -45,8 +45,7 @@ public class Negate extends CardImpl<Negate> {
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) {

View file

@ -44,8 +44,7 @@ public class Crush extends CardImpl<Crush> {
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) {

View file

@ -45,8 +45,7 @@ public class GofortheThroat extends CardImpl<GofortheThroat> {
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) {

View file

@ -79,9 +79,7 @@ class InquisitionOfKozilekEffect extends OneShotEffect<InquisitionOfKozilekEffec
private static FilterCard filter = new FilterCard("nonland card with converted mana cost 3 or less");
static {
filter.getCardType().add(CardType.LAND);
filter.setScopeCardType(ComparisonScope.Any);
filter.setNotCardType(true);
filter.getNotCardType().add(CardType.LAND);
filter.setConvertedManaCost(4);
filter.setConvertedManaCostComparison(ComparisonType.LessThan);

View file

@ -46,8 +46,7 @@ public class SpellPierce extends CardImpl<SpellPierce> {
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) {

View file

@ -47,6 +47,8 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
protected boolean notAbilities;
protected List<CardType> cardType = new ArrayList<CardType>();
protected ComparisonScope scopeCardType = ComparisonScope.All;
protected List<CardType> notCardTypeList = new ArrayList<CardType>();
protected ComparisonScope notScopeCardType = ComparisonScope.Any;
protected boolean notCardType;
protected boolean colorless;
protected boolean useColorless;
@ -89,8 +91,12 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
for (CardType cType: (List<CardType>)filter.cardType) {
this.cardType.add(cType);
}
for (CardType cType: (List<CardType>)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<E extends MageObject, T extends FilterObject<E, T>> 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<E extends MageObject, T extends FilterObject<E, T>> ex
public List<CardType> getCardType() {
return this.cardType;
}
public List<CardType> 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) {

View file

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