removed <filter>.getDefault()

This commit is contained in:
North 2011-10-23 12:17:14 +03:00
parent 4ccf0f799d
commit aa55beeb4e
110 changed files with 134 additions and 274 deletions

View file

@ -48,7 +48,7 @@ public class CopyPermanentEffect extends OneShotEffect<CopyPermanentEffect> {
private FilterPermanent filter;
public CopyPermanentEffect() {
this(FilterCreaturePermanent.getDefault());
this(new FilterCreaturePermanent());
}
public CopyPermanentEffect(FilterPermanent filter) {

View file

@ -52,15 +52,15 @@ public class BoostAllEffect extends ContinuousEffectImpl<BoostAllEffect> {
protected FilterCreaturePermanent filter;
public BoostAllEffect(int power, int toughness, Duration duration) {
this(power, toughness, duration, FilterCreaturePermanent.getDefault(), false);
this(power, toughness, duration, new FilterCreaturePermanent(), false);
}
public BoostAllEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
this(power, toughness, duration, FilterCreaturePermanent.getDefault(), false);
this(power, toughness, duration, new FilterCreaturePermanent(), false);
}
public BoostAllEffect(int power, int toughness, Duration duration, boolean excludeSource) {
this(power, toughness, duration, FilterCreaturePermanent.getDefault(), excludeSource);
this(power, toughness, duration, new FilterCreaturePermanent(), excludeSource);
}
public BoostAllEffect(int power, int toughness, Duration duration, FilterCreaturePermanent filter, boolean excludeSource) {

View file

@ -54,15 +54,15 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
protected boolean isLockedIn = false;
public BoostControlledEffect(int power, int toughness, Duration duration) {
this(power, toughness, duration, FilterCreaturePermanent.getDefault(), false);
this(power, toughness, duration, new FilterCreaturePermanent(), false);
}
public BoostControlledEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
this(power, toughness, duration, FilterCreaturePermanent.getDefault(), false);
this(power, toughness, duration, new FilterCreaturePermanent(), false);
}
public BoostControlledEffect(int power, int toughness, Duration duration, boolean excludeSource) {
this(power, toughness, duration, FilterCreaturePermanent.getDefault(), excludeSource);
this(power, toughness, duration, new FilterCreaturePermanent(), excludeSource);
}
public BoostControlledEffect(int power, int toughness, Duration duration, FilterCreaturePermanent filter) {

View file

@ -50,17 +50,6 @@ public class FilterArtifactCard extends FilterCard<FilterArtifactCard> {
super(filter);
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterArtifactCard()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterArtifactCard getDefault() {
return new FilterArtifactCard();
}
@Override
public FilterArtifactCard copy() {
return new FilterArtifactCard(this);

View file

@ -42,8 +42,6 @@ public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> exten
protected boolean attacking;
protected boolean useBlocking;
protected boolean blocking;
protected boolean useTapped;
protected boolean tapped;
public FilterArtifactPermanent() {
this("artifact");
@ -64,17 +62,6 @@ public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> exten
this.tapped = filter.tapped;
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterArtifactPermanent()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterArtifactPermanent getDefault() {
return new FilterArtifactPermanent();
}
@Override
public boolean match(Permanent permanent) {
if (!super.match(permanent))
@ -108,14 +95,6 @@ public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> exten
this.blocking = blocking;
}
public void setUseTapped ( boolean useTapped ) {
this.useTapped = useTapped;
}
public void setTapped ( boolean tapped ) {
this.tapped = tapped;
}
@Override
public FilterArtifactPermanent<T> copy() {
return new FilterArtifactPermanent<T>(this);

View file

@ -52,15 +52,4 @@ public class FilterAttackingCreature extends FilterCreaturePermanent<FilterAttac
public FilterAttackingCreature copy() {
return new FilterAttackingCreature(this);
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterAttackingCreature()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterAttackingCreature getDefault() {
return new FilterAttackingCreature();
}
}

View file

@ -54,15 +54,4 @@ public class FilterAttackingOrBlockingCreature extends FilterCreaturePermanent<F
public FilterAttackingOrBlockingCreature copy() {
return new FilterAttackingOrBlockingCreature(this);
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterAttackingOrBlockingCreature()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterAttackingOrBlockingCreature getDefault() {
return new FilterAttackingOrBlockingCreature();
}
}

View file

@ -54,15 +54,4 @@ public class FilterCreatureCard extends FilterCard<FilterCreatureCard> {
public FilterCreatureCard copy() {
return new FilterCreatureCard(this);
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterCreatureCard()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterCreatureCard getDefault() {
return new FilterCreatureCard();
}
}

View file

@ -62,17 +62,6 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
this.tapped = filter.tapped;
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterCreaturePermanent()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterCreaturePermanent getDefault() {
return new FilterCreaturePermanent();
}
@Override
public boolean match(Permanent permanent) {
if (!super.match(permanent))

View file

@ -28,7 +28,6 @@
package mage.filter.common;
import mage.abilities.Ability;
import mage.filter.FilterImpl;
import mage.filter.FilterInPlay;
import mage.filter.FilterPermanent;

View file

@ -20,17 +20,6 @@ public class FilterSpiritOrArcaneCard extends FilterCard<FilterSpiritOrArcaneCa
super(filter);
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterSpiritOrArcaneCard()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterSpiritOrArcaneCard getDefault() {
return new FilterSpiritOrArcaneCard();
}
@Override
public FilterSpiritOrArcaneCard copy() {
return new FilterSpiritOrArcaneCard(this);

View file

@ -28,8 +28,6 @@
package mage.filter.common;
import mage.Constants.CardType;
import mage.filter.FilterPermanent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
@ -51,17 +49,6 @@ public class FilterToken<T extends FilterToken<T>> extends FilterCreaturePermane
super(filter);
}
/**
* There are a lot of usages of this method, we should rip them out as we see
* them and replace them with <code>new FilterToken()</code>. This
* use to return a static instance of this object which is bad as its completely
* mutable and leads to EXTREMELY hard to track down issues!
*/
@Deprecated
public static FilterToken getDefault() {
return new FilterToken();
}
@Override
public boolean match(Permanent permanent) {
if (!(permanent instanceof PermanentToken))

View file

@ -29,7 +29,6 @@
package mage.target.common;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.TargetPermanent;
/**
@ -38,7 +37,7 @@ import mage.target.TargetPermanent;
public class TargetArtifactPermanent<T extends TargetArtifactPermanent<T>> extends TargetPermanent<TargetArtifactPermanent<T>> {
public TargetArtifactPermanent() {
this(1, 1, FilterArtifactPermanent.getDefault(), false);
this(1, 1, new FilterArtifactPermanent(), false);
}
public TargetArtifactPermanent(FilterArtifactPermanent filter) {
@ -46,11 +45,11 @@ public class TargetArtifactPermanent<T extends TargetArtifactPermanent<T>> exten
}
public TargetArtifactPermanent(int numTargets) {
this(numTargets, numTargets, FilterArtifactPermanent.getDefault(), false);
this(numTargets, numTargets, new FilterArtifactPermanent(), false);
}
public TargetArtifactPermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, FilterArtifactPermanent.getDefault(), false);
this(minNumTargets, maxNumTargets, new FilterArtifactPermanent(), false);
}
public TargetArtifactPermanent(int minNumTargets, int maxNumTargets, FilterArtifactPermanent filter, boolean notTarget) {

View file

@ -133,7 +133,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
return true;
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) {
count++;
if (count >= this.minNumberOfTargets)
@ -162,7 +162,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
return true;
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (filter.match(permanent, null, sourceControllerId, game)) {
count++;
if (count >= this.minNumberOfTargets)
@ -182,7 +182,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
possibleTargets.add(playerId);
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
@ -199,7 +199,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
possibleTargets.add(playerId);
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (filter.match(permanent, null, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}

View file

@ -110,7 +110,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
return true;
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) {
count++;
if (count >= this.minNumberOfTargets)
@ -131,7 +131,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
return true;
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (filter.match(permanent, null, sourceControllerId, game)) {
count++;
if (count >= this.minNumberOfTargets)
@ -151,7 +151,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
possibleTargets.add(playerId);
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
@ -168,7 +168,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
possibleTargets.add(playerId);
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (filter.match(permanent, null, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}

View file

@ -38,7 +38,7 @@ import mage.target.TargetPermanent;
public class TargetCreaturePermanent<T extends TargetCreaturePermanent<T>> extends TargetPermanent<TargetCreaturePermanent<T>> {
public TargetCreaturePermanent() {
this(1, 1, FilterCreaturePermanent.getDefault(), false);
this(1, 1, new FilterCreaturePermanent(), false);
}
public TargetCreaturePermanent(FilterCreaturePermanent filter) {
@ -46,11 +46,11 @@ public class TargetCreaturePermanent<T extends TargetCreaturePermanent<T>> exten
}
public TargetCreaturePermanent(int numTargets) {
this(numTargets, numTargets, FilterCreaturePermanent.getDefault(), false);
this(numTargets, numTargets, new FilterCreaturePermanent(), false);
}
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, FilterCreaturePermanent.getDefault(), false);
this(minNumTargets, maxNumTargets, new FilterCreaturePermanent(), false);
}
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {

View file

@ -33,10 +33,8 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreatureOrPlayer;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterPermanentOrPlayer;
import mage.filter.common.FilterPermanentOrPlayerWithCounter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -143,7 +141,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
return true;
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) {
count++;
if (count >= this.minNumberOfTargets)
@ -192,7 +190,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
possibleTargets.add(playerId);
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
@ -209,7 +207,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
possibleTargets.add(playerId);
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
if (filter.match(permanent, null, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}