mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[EOE] fix Pain for All targeting
This commit is contained in:
parent
a039800259
commit
33596d55b3
2 changed files with 13 additions and 21 deletions
|
|
@ -5,6 +5,8 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Filters out the id of the enchanted object, if the source is an enchantment
|
||||
*
|
||||
|
|
@ -15,8 +17,13 @@ public enum AnotherEnchantedPredicate implements ObjectSourcePlayerPredicate<Per
|
|||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent enchantment = input.getSource().getSourcePermanentIfItStillExists(game);
|
||||
return enchantment != null && !input.getObject().getId().equals(enchantment.getAttachedTo());
|
||||
return !Optional
|
||||
.ofNullable(input)
|
||||
.map(ObjectSourcePlayer::getSource)
|
||||
.map(source -> source.getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::getAttachedTo)
|
||||
.filter(input.getObject().getId()::equals)
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue