mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
new common predicate class
ManaValueLessThanOrEqualToSourcePowerPredicate
This commit is contained in:
parent
a19103a958
commit
60ad6c2325
6 changed files with 41 additions and 103 deletions
|
|
@ -0,0 +1,25 @@
|
|||
package mage.filter.predicate.card;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public enum ManaValueLessThanOrEqualToSourcePowerPredicate implements ObjectSourcePlayerPredicate<Card> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
Permanent sourcePermanent = input.getSource().getSourcePermanentOrLKI(game);
|
||||
return sourcePermanent != null && input.getObject().getManaValue() <= sourcePermanent.getPower().getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "mana value less than or equal to {this}'s power";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue