diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 158a7dfa53..71fd6d969c 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -352,6 +352,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { // } @Override public void adjustTargets(Ability ability, Game game) { + ability.adjustTargets(game); int xValue; TargetPermanent oldTargetPermanent; FilterPermanent permanentFilter; @@ -361,14 +362,14 @@ public abstract class CardImpl extends MageObjectImpl implements Card { case NONE: break; case X_CMC_EQUAL_PERM: - xValue = ability.getManaCostsToPay().getX(); - oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); - minTargets = oldTargetPermanent.getMinNumberOfTargets(); - maxTargets = oldTargetPermanent.getMaxNumberOfTargets(); - permanentFilter = oldTargetPermanent.getFilter().copy(); - permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); +// xValue = ability.getManaCostsToPay().getX(); +// oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); +// minTargets = oldTargetPermanent.getMinNumberOfTargets(); +// maxTargets = oldTargetPermanent.getMaxNumberOfTargets(); +// permanentFilter = oldTargetPermanent.getFilter().copy(); +// permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); break; case X_TARGETS: xValue = ability.getManaCostsToPay().getX(); diff --git a/Mage/src/main/java/mage/target/targetadjustment/XCMCPermanentAdjuster.java b/Mage/src/main/java/mage/target/targetadjustment/XCMCPermanentAdjuster.java new file mode 100644 index 0000000000..7ffc837de6 --- /dev/null +++ b/Mage/src/main/java/mage/target/targetadjustment/XCMCPermanentAdjuster.java @@ -0,0 +1,27 @@ +package mage.target.targetadjustment; + +import mage.abilities.Ability; +import mage.constants.ComparisonType; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public class XCMCPermanentAdjuster implements TargetAdjuster { + + @Override + public void adjustTargets(Ability ability, Game game) { + int xValue = ability.getManaCostsToPay().getX(); + TargetPermanent oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); + int minTargets = oldTargetPermanent.getMinNumberOfTargets(); + int maxTargets = oldTargetPermanent.getMaxNumberOfTargets(); + FilterPermanent permanentFilter = oldTargetPermanent.getFilter().copy(); + permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + ability.getTargets().clear(); + ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); + } +}