mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
PlayerZone: rewrite the Filter to remove use of "May be played" keywords. "may look" keywords might be removed later too.
This commit is contained in:
@@ -38,15 +38,16 @@ public class PlayerZone extends Zone {
|
|||||||
private static final long serialVersionUID = -5687652485777639176L;
|
private static final long serialVersionUID = -5687652485777639176L;
|
||||||
|
|
||||||
// the this is not the owner of the card
|
// the this is not the owner of the card
|
||||||
private final class AlienCardsActivationFilter implements Predicate<Card> {
|
private static Predicate<Card> alienCardsActivationFilter(final Player who) {
|
||||||
|
return new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
if (c.hasStartOfKeyword("May be played by your opponent")
|
if (c.mayPlay(who) != null || c.hasKeyword("Your opponent may look at this card.")) {
|
||||||
|| c.hasKeyword("Your opponent may look at this card.")) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class OwnCardsActivationFilter implements Predicate<Card> {
|
private final class OwnCardsActivationFilter implements Predicate<Card> {
|
||||||
@@ -56,7 +57,7 @@ public class PlayerZone extends Zone {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.isLand() && (c.hasKeyword("May be played") || c.hasKeyword("May be played without paying its mana cost"))) {
|
if (c.isLand() && (c.mayPlay(c.getController()) != null)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ public class PlayerZone extends Zone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sa.isSpell()
|
if (sa.isSpell()
|
||||||
&& (c.hasKeyword("May be played") || c.hasKeyword("May be played without paying its mana cost")
|
&& (c.mayPlay(c.getController()) != null
|
||||||
|| (c.hasStartOfKeyword("Flashback") && PlayerZone.this.is(ZoneType.Graveyard)))
|
|| (c.hasStartOfKeyword("Flashback") && PlayerZone.this.is(ZoneType.Graveyard)))
|
||||||
&& restrictZone.equals(ZoneType.Hand)) {
|
&& restrictZone.equals(ZoneType.Hand)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -112,7 +113,7 @@ public class PlayerZone extends Zone {
|
|||||||
cards = Iterables.limit(cards, 1);
|
cards = Iterables.limit(cards, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Predicate<Card> filterPredicate = checkingForOwner ? new OwnCardsActivationFilter() : new AlienCardsActivationFilter();
|
final Predicate<Card> filterPredicate = checkingForOwner ? new OwnCardsActivationFilter() : alienCardsActivationFilter(who);
|
||||||
return CardLists.filter(cl, filterPredicate);
|
return CardLists.filter(cl, filterPredicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user