[SPM] Implement With Great Power...

This commit is contained in:
theelk801 2025-08-30 13:37:44 -04:00
parent 8e0a222f9b
commit 49a3b1176e
5 changed files with 174 additions and 83 deletions

View file

@ -0,0 +1,30 @@
package mage.filter.predicate.permanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.Optional;
/**
* @author TheElk801
*/
public enum AttachedToAttachedPredicate implements ObjectSourcePlayerPredicate<Permanent> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
return Optional
.ofNullable(input.getSource().getSourcePermanentOrLKI(game))
.map(Permanent::getAttachedTo)
.filter(input.getObject()::isAttachedTo)
.isPresent();
}
@Override
public String toString() {
return "attached to attached permanent";
}
}