mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
[refactoring][filters] Unneeded use of generics was removed
This commit is contained in:
parent
5bd9c13543
commit
5450a65421
44 changed files with 78 additions and 89 deletions
|
@ -68,7 +68,7 @@ public class SecondGuess extends CardImpl<SecondGuess> {
|
|||
}
|
||||
}
|
||||
|
||||
class FilterSecondSpell extends FilterSpell<FilterSecondSpell> {
|
||||
class FilterSecondSpell extends FilterSpell {
|
||||
|
||||
public FilterSecondSpell() {
|
||||
super("spell that's the second spell cast this turn");
|
||||
|
@ -119,16 +119,14 @@ class FilterSecondSpell extends FilterSpell<FilterSecondSpell> {
|
|||
return new FilterSecondSpell(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFromZone(Constants.Zone fromZone) {
|
||||
this.fromZone = fromZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNotFromZone(boolean notFromZone) {
|
||||
this.notFromZone = notFromZone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class EvilTwin extends CardImpl<EvilTwin> {
|
|||
}
|
||||
}
|
||||
|
||||
class EvilTwinFilter extends FilterCreaturePermanent<EvilTwinFilter> {
|
||||
class EvilTwinFilter extends FilterCreaturePermanent {
|
||||
|
||||
public EvilTwinFilter() {
|
||||
super("creature with the same name as this creature");
|
||||
|
|
|
@ -65,7 +65,7 @@ public class UrgentExorcism extends CardImpl<UrgentExorcism> {
|
|||
}
|
||||
}
|
||||
|
||||
class FilterSpiritOrEnchantment extends FilterPermanent<FilterSpiritOrEnchantment> {
|
||||
class FilterSpiritOrEnchantment extends FilterPermanent {
|
||||
|
||||
public FilterSpiritOrEnchantment() {
|
||||
super("Spirit or enchantment");
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.List;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterAbility<T extends Ability> extends FilterImpl<T, FilterAbility<T>> {
|
||||
public class FilterAbility<T extends Ability> extends FilterImpl<T> {
|
||||
|
||||
protected static ListComparer<Outcome> compOutcome = new ListComparer<Outcome>();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.util.*;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterCard<T extends FilterCard<T>> extends FilterObject<Card, FilterCard<T>> {
|
||||
public class FilterCard extends FilterObject<Card> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class FilterCard<T extends FilterCard<T>> extends FilterObject<Card, Filt
|
|||
super(name);
|
||||
}
|
||||
|
||||
public FilterCard(FilterCard<T> filter) {
|
||||
public FilterCard(FilterCard filter) {
|
||||
super(filter);
|
||||
this.ownerId.addAll(filter.ownerId);
|
||||
this.notOwner = filter.notOwner;
|
||||
|
@ -187,7 +187,7 @@ public class FilterCard<T extends FilterCard<T>> extends FilterObject<Card, Filt
|
|||
}
|
||||
|
||||
@Override
|
||||
public FilterCard<T> copy() {
|
||||
return new FilterCard<T>(this);
|
||||
public FilterCard copy() {
|
||||
return new FilterCard(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,14 +38,14 @@ import mage.game.Game;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
* @author North
|
||||
*/
|
||||
public abstract class FilterImpl<E, T extends FilterImpl<E, T>> implements Filter<E> {
|
||||
public abstract class FilterImpl<E> implements Filter<E> {
|
||||
|
||||
protected List<Predicate> predicates = new ArrayList<Predicate>();
|
||||
protected String message;
|
||||
protected boolean notFilter = false;
|
||||
|
||||
@Override
|
||||
public abstract FilterImpl<E, T> copy();
|
||||
public abstract FilterImpl<E> copy();
|
||||
|
||||
public FilterImpl(String name) {
|
||||
this.message = name;
|
||||
|
|
|
@ -34,11 +34,11 @@ import mage.MageObject;
|
|||
*
|
||||
* @author North
|
||||
*/
|
||||
public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> extends FilterImpl<E, T> {
|
||||
public class FilterObject<E extends MageObject> extends FilterImpl<E> {
|
||||
|
||||
@Override
|
||||
public FilterObject<E, T> copy() {
|
||||
return new FilterObject<E, T>(this);
|
||||
public FilterObject<E> copy() {
|
||||
return new FilterObject<E>(this);
|
||||
}
|
||||
|
||||
public FilterObject(String name) {
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<Permanent, FilterPermanent<T>> {
|
||||
public class FilterPermanent extends FilterObject<Permanent> {
|
||||
protected List<UUID> ownerId = new ArrayList<UUID>();
|
||||
protected boolean notOwner;
|
||||
protected List<UUID> controllerId = new ArrayList<UUID>();
|
||||
|
@ -61,7 +61,7 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
|
|||
super("permanent");
|
||||
}
|
||||
|
||||
public FilterPermanent(final FilterPermanent<T> filter) {
|
||||
public FilterPermanent(final FilterPermanent filter) {
|
||||
super(filter);
|
||||
this.ownerId = new ArrayList<UUID>(filter.ownerId);
|
||||
this.notOwner = filter.notOwner;
|
||||
|
@ -227,8 +227,8 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
|
|||
}
|
||||
|
||||
@Override
|
||||
public FilterPermanent<T> copy() {
|
||||
return new FilterPermanent<T>(this);
|
||||
public FilterPermanent copy() {
|
||||
return new FilterPermanent(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterPlayer extends FilterImpl<Player, FilterPlayer> implements Filter<Player> {
|
||||
public class FilterPlayer extends FilterImpl<Player> {
|
||||
|
||||
protected List<UUID> playerId = new ArrayList<UUID>();
|
||||
protected boolean notPlayer;
|
||||
|
|
|
@ -39,7 +39,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterSpell<T extends FilterSpell<T>> extends FilterStackObject<FilterSpell<T>> {
|
||||
public class FilterSpell extends FilterStackObject {
|
||||
|
||||
protected Zone fromZone = Zone.ALL;
|
||||
protected boolean notFromZone = false;
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterStackObject<T extends FilterStackObject<T>> extends FilterObject<StackObject, FilterStackObject<T>> {
|
||||
public class FilterStackObject extends FilterObject<StackObject> {
|
||||
|
||||
protected List<UUID> controllerId = new ArrayList<UUID>();
|
||||
protected boolean notController = false;
|
||||
|
@ -54,7 +54,7 @@ public class FilterStackObject<T extends FilterStackObject<T>> extends FilterObj
|
|||
super(name);
|
||||
}
|
||||
|
||||
public FilterStackObject(final FilterStackObject<T> filter) {
|
||||
public FilterStackObject(final FilterStackObject filter) {
|
||||
super(filter);
|
||||
this.controllerId.addAll(filter.controllerId);
|
||||
this.notController = filter.notController;
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class FilterArtifactCard extends FilterCard<FilterArtifactCard> {
|
||||
public class FilterArtifactCard extends FilterCard {
|
||||
|
||||
public FilterArtifactCard() {
|
||||
this("artifact");
|
||||
|
|
|
@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author ayratn
|
||||
*/
|
||||
public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> extends FilterPermanent<FilterArtifactPermanent<T>> {
|
||||
public class FilterArtifactPermanent extends FilterPermanent {
|
||||
|
||||
protected boolean useAttacking;
|
||||
protected boolean attacking;
|
||||
|
@ -54,7 +54,7 @@ public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> exten
|
|||
this.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
}
|
||||
|
||||
public FilterArtifactPermanent(final FilterArtifactPermanent<T> filter) {
|
||||
public FilterArtifactPermanent(final FilterArtifactPermanent filter) {
|
||||
super(filter);
|
||||
this.useAttacking = filter.useAttacking;
|
||||
this.attacking = filter.attacking;
|
||||
|
@ -98,7 +98,7 @@ public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> exten
|
|||
}
|
||||
|
||||
@Override
|
||||
public FilterArtifactPermanent<T> copy() {
|
||||
return new FilterArtifactPermanent<T>(this);
|
||||
public FilterArtifactPermanent copy() {
|
||||
return new FilterArtifactPermanent(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ package mage.filter.common;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterAttackingCreature extends FilterCreaturePermanent<FilterAttackingCreature> {
|
||||
public class FilterAttackingCreature extends FilterCreaturePermanent {
|
||||
|
||||
public FilterAttackingCreature() {
|
||||
this("attacking creature");
|
||||
|
|
|
@ -32,7 +32,7 @@ package mage.filter.common;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class FilterAttackingOrBlockingCreature extends FilterCreaturePermanent<FilterAttackingOrBlockingCreature> {
|
||||
public class FilterAttackingOrBlockingCreature extends FilterCreaturePermanent {
|
||||
|
||||
public FilterAttackingOrBlockingCreature() {
|
||||
this("attacking or blocking creature");
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterAura extends FilterPermanent<FilterAura> {
|
||||
public class FilterAura extends FilterPermanent {
|
||||
|
||||
public FilterAura() {
|
||||
this("aura");
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class FilterAuraCard extends FilterCard<FilterAuraCard> {
|
||||
public class FilterAuraCard extends FilterCard {
|
||||
|
||||
public FilterAuraCard() {
|
||||
this("aura");
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterBasicLandCard extends FilterCard<FilterBasicLandCard> {
|
||||
public class FilterBasicLandCard extends FilterCard {
|
||||
|
||||
public FilterBasicLandCard() {
|
||||
super("basic land card");
|
||||
|
|
|
@ -35,7 +35,7 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author North
|
||||
*/
|
||||
public class FilterBlockedCreature extends FilterCreaturePermanent<FilterBlockingCreature> {
|
||||
public class FilterBlockedCreature extends FilterCreaturePermanent {
|
||||
|
||||
public FilterBlockedCreature() {
|
||||
this("blocked creature");
|
||||
|
|
|
@ -32,7 +32,7 @@ package mage.filter.common;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterBlockingCreature extends FilterCreaturePermanent<FilterBlockingCreature> {
|
||||
public class FilterBlockingCreature extends FilterCreaturePermanent {
|
||||
|
||||
public FilterBlockingCreature() {
|
||||
this("Blocking creature");
|
||||
|
|
|
@ -35,7 +35,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterControlledCreaturePermanent<T extends FilterControlledCreaturePermanent> extends FilterControlledPermanent<FilterControlledCreaturePermanent<T>> {
|
||||
public class FilterControlledCreaturePermanent extends FilterControlledPermanent {
|
||||
|
||||
public FilterControlledCreaturePermanent() {
|
||||
this("creature you control");
|
||||
|
|
|
@ -35,7 +35,7 @@ import mage.filter.FilterPermanent;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterControlledPermanent<T extends FilterControlledPermanent<T>> extends FilterPermanent<FilterControlledPermanent<T>> {
|
||||
public class FilterControlledPermanent extends FilterPermanent {
|
||||
|
||||
public FilterControlledPermanent() {
|
||||
this("permanent you control");
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterCreatureCard extends FilterCard<FilterCreatureCard> {
|
||||
public class FilterCreatureCard extends FilterCard {
|
||||
|
||||
public FilterCreatureCard() {
|
||||
this("creature card");
|
||||
|
|
|
@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterCreatureForAttack extends FilterCreaturePermanent<FilterCreatureForAttack> {
|
||||
public class FilterCreatureForAttack extends FilterCreaturePermanent {
|
||||
|
||||
public FilterCreatureForAttack() {
|
||||
this("");
|
||||
|
|
|
@ -35,7 +35,7 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterCreatureForCombat extends FilterCreaturePermanent<FilterCreatureForCombat> {
|
||||
public class FilterCreatureForCombat extends FilterCreaturePermanent {
|
||||
|
||||
public FilterCreatureForCombat() {
|
||||
this("");
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterCreatureOrPlayer extends FilterImpl<Object, FilterCreatureOrPlayer> implements FilterInPlay<Object> {
|
||||
public class FilterCreatureOrPlayer extends FilterImpl<Object> implements FilterInPlay<Object> {
|
||||
|
||||
protected FilterCreaturePermanent creatureFilter;
|
||||
protected FilterPlayer playerFilter;
|
||||
|
|
|
@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> extends FilterPermanent<FilterCreaturePermanent<T>> {
|
||||
public class FilterCreaturePermanent extends FilterPermanent {
|
||||
|
||||
protected boolean useAttacking;
|
||||
protected boolean attacking;
|
||||
|
@ -56,7 +56,7 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
|
|||
this.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public FilterCreaturePermanent(final FilterCreaturePermanent<T> filter) {
|
||||
public FilterCreaturePermanent(final FilterCreaturePermanent filter) {
|
||||
super(filter);
|
||||
this.useAttacking = filter.useAttacking;
|
||||
this.attacking = filter.attacking;
|
||||
|
@ -137,7 +137,7 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
|
|||
}
|
||||
|
||||
@Override
|
||||
public FilterCreaturePermanent<T> copy() {
|
||||
return new FilterCreaturePermanent<T>(this);
|
||||
public FilterCreaturePermanent copy() {
|
||||
return new FilterCreaturePermanent(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class FilterEnchantment extends FilterPermanent<FilterEnchantment> {
|
||||
public class FilterEnchantment extends FilterPermanent {
|
||||
|
||||
public FilterEnchantment() {
|
||||
this("enchantment");
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterEquipment extends FilterPermanent<FilterEquipment> {
|
||||
public class FilterEquipment extends FilterPermanent {
|
||||
|
||||
public FilterEquipment() {
|
||||
this("equipment");
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterFortification extends FilterPermanent<FilterFortification> {
|
||||
public class FilterFortification extends FilterPermanent {
|
||||
|
||||
public FilterFortification() {
|
||||
this("fortification");
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterLandCard extends FilterCard<FilterLandCard> {
|
||||
public class FilterLandCard extends FilterCard {
|
||||
|
||||
public FilterLandCard() {
|
||||
this("land card");
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterLandPermanent extends FilterPermanent<FilterLandPermanent> {
|
||||
public class FilterLandPermanent extends FilterPermanent {
|
||||
|
||||
public FilterLandPermanent() {
|
||||
this("land");
|
||||
|
|
|
@ -35,7 +35,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterLegendaryPermanent extends FilterPermanent<FilterLegendaryPermanent> {
|
||||
public class FilterLegendaryPermanent extends FilterPermanent {
|
||||
|
||||
public FilterLegendaryPermanent() {
|
||||
this("legend");
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.game.permanent.PermanentToken;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterNonTokenPermanent extends FilterPermanent<FilterNonTokenPermanent> {
|
||||
public class FilterNonTokenPermanent extends FilterPermanent {
|
||||
|
||||
public FilterNonTokenPermanent() {
|
||||
this("nontoken permanent");
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterNonlandCard extends FilterCard<FilterNonlandCard> {
|
||||
public class FilterNonlandCard extends FilterCard {
|
||||
|
||||
public FilterNonlandCard() {
|
||||
this("nonland card");
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterNonlandPermanent extends FilterPermanent<FilterNonlandPermanent> {
|
||||
public class FilterNonlandPermanent extends FilterPermanent {
|
||||
|
||||
public FilterNonlandPermanent() {
|
||||
this("nonland permanent");
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class FilterNotPairedControlledCreaturePermanent extends FilterControlledCreaturePermanent<FilterNotPairedControlledCreaturePermanent> {
|
||||
public class FilterNotPairedControlledCreaturePermanent extends FilterControlledCreaturePermanent {
|
||||
|
||||
public FilterNotPairedControlledCreaturePermanent() {
|
||||
this("not paired creature you control");
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.UUID;
|
|||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
public class FilterPermanentOrPlayer extends FilterImpl<Object, FilterPermanentOrPlayer> implements FilterInPlay<Object> {
|
||||
public class FilterPermanentOrPlayer extends FilterImpl<Object> implements FilterInPlay<Object> {
|
||||
|
||||
protected FilterPermanent permanentFilter;
|
||||
protected FilterPlayer playerFilter;
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
|
||||
package mage.filter.common;
|
||||
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -41,31 +39,20 @@ import java.util.UUID;
|
|||
*/
|
||||
public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer {
|
||||
|
||||
protected FilterPermanent permanentFilter;
|
||||
protected FilterPlayer playerFilter;
|
||||
|
||||
public FilterPermanentOrPlayerWithCounter() {
|
||||
this("player or permanent with counters on them");
|
||||
}
|
||||
|
||||
public FilterPermanentOrPlayerWithCounter(String name, UUID controllerId) {
|
||||
super(name);
|
||||
permanentFilter = new FilterPermanent();
|
||||
playerFilter = new FilterPlayer();
|
||||
permanentFilter.getControllerId().add(controllerId);
|
||||
playerFilter.getPlayerId().add(controllerId);
|
||||
super(name, controllerId);
|
||||
}
|
||||
|
||||
public FilterPermanentOrPlayerWithCounter(String name) {
|
||||
super(name);
|
||||
permanentFilter = new FilterPermanent();
|
||||
playerFilter = new FilterPlayer();
|
||||
}
|
||||
|
||||
public FilterPermanentOrPlayerWithCounter(final FilterPermanentOrPlayerWithCounter filter) {
|
||||
super(filter);
|
||||
this.permanentFilter = filter.permanentFilter.copy();
|
||||
this.playerFilter = filter.playerFilter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
package mage.filter.common;
|
||||
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterImpl;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.game.Game;
|
||||
|
@ -42,7 +41,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterPlaneswalkerOrPlayer extends FilterImpl<Object, FilterPlaneswalkerOrPlayer> implements Filter<Object> {
|
||||
public class FilterPlaneswalkerOrPlayer extends FilterImpl<Object> {
|
||||
|
||||
protected FilterPlaneswalkerPermanent planeswalkerFilter;
|
||||
protected FilterPlayer playerFilter;
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterPlaneswalkerPermanent extends FilterPermanent<FilterPlaneswalkerPermanent> {
|
||||
public class FilterPlaneswalkerPermanent extends FilterPermanent {
|
||||
|
||||
public FilterPlaneswalkerPermanent() {
|
||||
this("planeswalker");
|
||||
|
|
|
@ -43,7 +43,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author LevelX
|
||||
*/
|
||||
public class FilterSpellOrPermanent extends FilterImpl<Object, FilterPermanentOrPlayer> implements FilterInPlay<Object> {
|
||||
public class FilterSpellOrPermanent extends FilterImpl<Object> implements FilterInPlay<Object> {
|
||||
|
||||
protected FilterPermanent permanentFilter;
|
||||
protected FilterSpell spellFilter;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.filter.common;
|
||||
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
|
@ -36,7 +37,7 @@ import mage.game.permanent.PermanentToken;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class FilterToken<T extends FilterToken<T>> extends FilterCreaturePermanent<FilterToken<T>> {
|
||||
public class FilterToken extends FilterCreaturePermanent {
|
||||
|
||||
public FilterToken() {
|
||||
this("creature token");
|
||||
|
@ -44,24 +45,28 @@ public class FilterToken<T extends FilterToken<T>> extends FilterCreaturePermane
|
|||
|
||||
public FilterToken(String name) {
|
||||
super(name);
|
||||
this.add(new TokenPredicate());
|
||||
}
|
||||
|
||||
public FilterToken(final FilterToken<T> filter) {
|
||||
public FilterToken(final FilterToken filter) {
|
||||
super(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(Permanent permanent, Game game) {
|
||||
if (!(permanent instanceof PermanentToken))
|
||||
return notFilter;
|
||||
if (!super.match(permanent, game))
|
||||
return notFilter;
|
||||
|
||||
return !notFilter;
|
||||
public FilterToken copy() {
|
||||
return new FilterToken(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterToken<T> copy() {
|
||||
return new FilterToken<T>(this);
|
||||
private static final class TokenPredicate implements Predicate<Permanent> {
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return input instanceof PermanentToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Token";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ package mage.filter.common;
|
|||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class FilterUntappedCreature extends FilterCreaturePermanent<FilterUntappedCreature> {
|
||||
public class FilterUntappedCreature extends FilterCreaturePermanent {
|
||||
|
||||
public FilterUntappedCreature() {
|
||||
this("untapped creature");
|
||||
|
|
Loading…
Reference in a new issue