mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[WOE] Implement Eriette of the Charmed Apple (#10904)
* WIP * implemented can't attack effect * moved logic for "permanents enchanted by Auras" to predicate * added value hint for ability * fixed static properties * changed predicate logic * fixed issues as per PR comments * updated predicate name, changed count from static variable * made DynamicValue static
This commit is contained in:
parent
c3d48a9b9c
commit
491f47ddc6
3 changed files with 96 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
package mage.filter.predicate.permanent;
|
||||
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Xanderhall
|
||||
*/
|
||||
public enum EnchantedBySourceControllerPredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
return input.getObject().getAttachments()
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(p -> p.hasSubtype(SubType.AURA, game) && p.isControlledBy(input.getPlayerId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Enchanted by source";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue