diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/AnotherEnchantedPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/AnotherEnchantedPredicate.java new file mode 100644 index 00000000000..956e595f774 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/permanent/AnotherEnchantedPredicate.java @@ -0,0 +1,30 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.filter.predicate.permanent; + +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * Filters out the id of the enchanted object, if the source is an enchantment + * + * @author LevelX2 + */ +public class AnotherEnchantedPredicate implements ObjectSourcePlayerPredicate> { + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + Permanent enchantment = game.getPermanentOrLKIBattlefield(input.getSourceId()); + return enchantment != null && !input.getObject().getId().equals(enchantment.getAttachedTo()); + } + + @Override + public String toString() { + return "Another enchanted"; + } +}