[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:
Vivian Greenslade 2023-08-22 20:54:52 -02:30 committed by GitHub
parent c3d48a9b9c
commit 491f47ddc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 0 deletions

View file

@ -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";
}
}