From 7305fbac3a640ad80964179b648489cb1e250f1a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 17 Sep 2018 13:21:05 -0400 Subject: [PATCH] replaced X cmc targeting adjustment --- Mage.Sets/src/mage/cards/d/DeepfireElemental.java | 5 ++--- Mage.Sets/src/mage/cards/g/GorillaShaman.java | 5 ++--- Mage.Sets/src/mage/cards/h/HearthKami.java | 5 ++--- Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java | 5 ++--- Mage.Sets/src/mage/cards/p/Plaguebearer.java | 5 ++--- Mage/src/main/java/mage/cards/CardImpl.java | 10 ---------- .../mage/target/targetadjustment/TargetAdjuster.java | 2 +- .../target/targetadjustment/XCMCPermanentAdjuster.java | 3 ++- 8 files changed, 13 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index c5bcdd1dcc..59ec4f30aa 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/g/GorillaShaman.java b/Mage.Sets/src/mage/cards/g/GorillaShaman.java index ee101c183b..f99db1acd9 100644 --- a/Mage.Sets/src/mage/cards/g/GorillaShaman.java +++ b/Mage.Sets/src/mage/cards/g/GorillaShaman.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/h/HearthKami.java b/Mage.Sets/src/mage/cards/h/HearthKami.java index 0d2eeb8b9b..0d09cdf93d 100644 --- a/Mage.Sets/src/mage/cards/h/HearthKami.java +++ b/Mage.Sets/src/mage/cards/h/HearthKami.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java index 8b3b4e9360..17167aa7b9 100644 --- a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java +++ b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java @@ -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. diff --git a/Mage.Sets/src/mage/cards/p/Plaguebearer.java b/Mage.Sets/src/mage/cards/p/Plaguebearer.java index 05edb43572..a9dec0874b 100644 --- a/Mage.Sets/src/mage/cards/p/Plaguebearer.java +++ b/Mage.Sets/src/mage/cards/p/Plaguebearer.java @@ -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); } diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 71fd6d969c..9ce52e7697 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -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(); diff --git a/Mage/src/main/java/mage/target/targetadjustment/TargetAdjuster.java b/Mage/src/main/java/mage/target/targetadjustment/TargetAdjuster.java index 5d6491b96c..d3e84a8e9f 100644 --- a/Mage/src/main/java/mage/target/targetadjustment/TargetAdjuster.java +++ b/Mage/src/main/java/mage/target/targetadjustment/TargetAdjuster.java @@ -9,5 +9,5 @@ import mage.game.Game; */ public interface TargetAdjuster { - public void adjustTargets(Ability ability, Game game); + void adjustTargets(Ability ability, Game game); } diff --git a/Mage/src/main/java/mage/target/targetadjustment/XCMCPermanentAdjuster.java b/Mage/src/main/java/mage/target/targetadjustment/XCMCPermanentAdjuster.java index 7ffc837de6..bc6b2b5771 100644 --- a/Mage/src/main/java/mage/target/targetadjustment/XCMCPermanentAdjuster.java +++ b/Mage/src/main/java/mage/target/targetadjustment/XCMCPermanentAdjuster.java @@ -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) {