mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TDM] add missing predicate to Formation Breaker
This commit is contained in:
parent
48173bee00
commit
e223e35e6d
1 changed files with 21 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
|
|
@ -17,8 +18,13 @@ import mage.constants.SubType;
|
|||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.permanent.CounterAnyPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +36,7 @@ public final class FormationBreaker extends CardImpl {
|
|||
private static final FilterPermanent filter2 = new FilterControlledCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(FormationBreakerPredicate.instance);
|
||||
filter2.add(CounterAnyPredicate.instance);
|
||||
}
|
||||
|
||||
|
|
@ -63,3 +70,17 @@ public final class FormationBreaker extends CardImpl {
|
|||
return new FormationBreaker(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum FormationBreakerPredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
return Optional
|
||||
.ofNullable(input.getSource().getSourcePermanentIfItStillExists(game))
|
||||
.map(MageObject::getPower)
|
||||
.map(MageInt::getValue)
|
||||
.map(x -> input.getObject().getPower().getValue() < x)
|
||||
.orElse(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue