mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[filters] Replaced PhasedIn Condition with Predicate
This commit is contained in:
parent
fba4e662d0
commit
c51dc081c6
2 changed files with 14 additions and 9 deletions
|
@ -49,8 +49,6 @@ public class FilterPermanent extends FilterObject<Permanent> {
|
|||
protected boolean flipped;
|
||||
protected boolean useFaceup;
|
||||
protected boolean faceup;
|
||||
protected boolean usePhased;
|
||||
protected boolean phasedIn;
|
||||
protected TargetController controller = TargetController.ANY;
|
||||
protected TargetController owner = TargetController.ANY;
|
||||
protected boolean another;
|
||||
|
@ -69,8 +67,6 @@ public class FilterPermanent extends FilterObject<Permanent> {
|
|||
this.flipped = filter.flipped;
|
||||
this.useFaceup = filter.useFaceup;
|
||||
this.faceup = filter.faceup;
|
||||
this.usePhased = filter.usePhased;
|
||||
this.phasedIn = filter.phasedIn;
|
||||
this.controller = filter.controller;
|
||||
this.owner = filter.owner;
|
||||
this.another = filter.another;
|
||||
|
@ -97,9 +93,6 @@ public class FilterPermanent extends FilterObject<Permanent> {
|
|||
if (useFaceup && permanent.isFaceUp() != faceup)
|
||||
return notFilter;
|
||||
|
||||
if (usePhased && permanent.isPhasedIn() != phasedIn)
|
||||
return notFilter;
|
||||
|
||||
return !notFilter;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.filter.common;
|
||||
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -47,8 +48,7 @@ public class FilterCreatureForCombat extends FilterCreaturePermanent {
|
|||
super(name);
|
||||
this.attacking = false;
|
||||
this.useAttacking = true;
|
||||
this.phasedIn = true;
|
||||
this.usePhased = true;
|
||||
this.add(new PhasedInPredicate());
|
||||
this.add(Predicates.not(new TappedPredicate()));
|
||||
}
|
||||
|
||||
|
@ -69,4 +69,16 @@ public class FilterCreatureForCombat extends FilterCreaturePermanent {
|
|||
return new FilterCreatureForCombat(this);
|
||||
}
|
||||
|
||||
private static final class PhasedInPredicate implements Predicate<Permanent>{
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return input.isPhasedIn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PhasedIn";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue