replaced X cmc targeting adjustment

This commit is contained in:
Evan Kranzler 2018-09-17 13:21:05 -04:00
parent 9b94b618cd
commit 7305fbac3a
8 changed files with 13 additions and 27 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.d;
import java.util.UUID;
@ -11,12 +10,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetAdjustment;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent;
import mage.target.targetadjustment.XCMCPermanentAdjuster;
/**
*
@ -43,7 +42,7 @@ public final class DeepfireElemental extends CardImpl {
// {X}{X}{1}: Destroy target artifact or creature with converted mana cost X.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}"));
ability.addTarget(new TargetPermanent(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
ability.setTargetAdjuster(XCMCPermanentAdjuster.instance);
this.addAbility(ability);
}

View file

@ -1,4 +1,3 @@
package mage.cards.g;
import java.util.UUID;
@ -11,12 +10,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetAdjustment;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent;
import mage.target.targetadjustment.XCMCPermanentAdjuster;
/**
*
@ -41,7 +40,7 @@ public final class GorillaShaman extends CardImpl {
// {X}{X}{1}: Destroy target noncreature artifact with converted mana cost X.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}"));
ability.addTarget(new TargetPermanent(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
ability.setTargetAdjuster(XCMCPermanentAdjuster.instance);
this.addAbility(ability);
}

View file

@ -1,4 +1,3 @@
package mage.cards.h;
import java.util.UUID;
@ -12,11 +11,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetAdjustment;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent;
import mage.target.targetadjustment.XCMCPermanentAdjuster;
/**
* @author Loki
@ -40,7 +39,7 @@ public final class HearthKami extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}"));
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
ability.setTargetAdjuster(XCMCPermanentAdjuster.instance);
this.addAbility(ability);
}

View file

@ -1,4 +1,3 @@
package mage.cards.l;
import java.util.UUID;
@ -16,7 +15,6 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.TargetAdjustment;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
@ -29,6 +27,7 @@ import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetControlledPermanent;
import mage.target.targetadjustment.XCMCPermanentAdjuster;
/**
*
@ -55,7 +54,7 @@ public final class LinessaZephyrMage extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{X}{U}{U}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPermanent(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
ability.setTargetAdjuster(XCMCPermanentAdjuster.instance);
this.addAbility(ability);
// Grandeur - Discard another card named Linessa, Zephyr Mage: Target player returns a creature he or she controls to its owner's hand, then repeats this process for an artifact, an enchantment, and a land.

View file

@ -1,4 +1,3 @@
package mage.cards.p;
import java.util.UUID;
@ -12,13 +11,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetAdjustment;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.TargetPermanent;
import mage.target.targetadjustment.XCMCPermanentAdjuster;
/**
*
@ -42,7 +41,7 @@ public final class Plaguebearer extends CardImpl {
// {X}{X}{B}: Destroy target nonblack creature with converted mana cost X.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{B}"));
ability.addTarget(new TargetPermanent(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM);
ability.setTargetAdjuster(XCMCPermanentAdjuster.instance);
this.addAbility(ability);
}

View file

@ -361,16 +361,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
switch (ability.getTargetAdjustment()) {
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));
break;
case X_TARGETS:
xValue = ability.getManaCostsToPay().getX();
permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();

View file

@ -9,5 +9,5 @@ import mage.game.Game;
*/
public interface TargetAdjuster {
public void adjustTargets(Ability ability, Game game);
void adjustTargets(Ability ability, Game game);
}

View file

@ -11,7 +11,8 @@ import mage.target.TargetPermanent;
*
* @author TheElk801
*/
public class XCMCPermanentAdjuster implements TargetAdjuster {
public enum XCMCPermanentAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {