mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Implemented Inspire Awe
This commit is contained in:
parent
0ccd01de7a
commit
be32db8a80
3 changed files with 81 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
package mage.filter.predicate.mageobject;
|
||||
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum EnchantmentOrEnchantedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
if (!input.isCreature()) {
|
||||
return false;
|
||||
}
|
||||
if (input.isEnchantment()) {
|
||||
return true;
|
||||
}
|
||||
return input
|
||||
.getAttachments()
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(permanent -> permanent.hasSubtype(SubType.AURA, game));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "enchanted creature or enchantment creature";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue