forked from External/mage
Merge pull request #5316 from magefree/targetAdjustment
Updated implementation of target adjustment
This commit is contained in:
commit
beb190a47b
35 changed files with 336 additions and 258 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -14,12 +13,12 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.targetadjustment.XTargetsAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -40,7 +39,7 @@ public final class AlexiZephyrMage extends CardImpl {
|
|||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new DiscardTargetCost(new TargetCardInHand(2, new FilterCard("two cards"))));
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_CREATURES));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
ability.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -6,6 +5,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.VariableCostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.common.TapTargetCost;
|
||||
|
|
@ -16,17 +16,21 @@ import mage.abilities.keyword.VigilanceAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.KnightToken;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -57,9 +61,8 @@ public final class AryelKnightOfWindgrace extends CardImpl {
|
|||
.setText("Destroy target creature with power X or less"), new ManaCostsImpl("{B}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new AryelTapXTargetCost());
|
||||
ability.setTargetAdjustment(TargetAdjustment.CREATURE_POWER_X_OR_LESS);
|
||||
ability.setTargetAdjuster(AryelKnightOfWindgraceAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
ability.getOriginalId();
|
||||
}
|
||||
|
||||
public AryelKnightOfWindgrace(final AryelKnightOfWindgrace card) {
|
||||
|
|
@ -106,3 +109,19 @@ class AryelTapXTargetCost extends VariableCostImpl {
|
|||
return new TapTargetCost(target);
|
||||
}
|
||||
}
|
||||
|
||||
enum AryelKnightOfWindgraceAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int value = 0;
|
||||
for (VariableCost cost : ability.getCosts().getVariableCosts()) {
|
||||
value = cost.getAmount();
|
||||
}
|
||||
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent("creature with power " + value + " or less");
|
||||
filterCreaturePermanent.add(new PowerPredicate(ComparisonType.FEWER_THAN, value + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(filterCreaturePermanent));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -11,10 +10,10 @@ import mage.abilities.effects.common.UntapTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.XTargetsAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -31,7 +30,7 @@ public final class CandelabraOfTawnos extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
ability.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
|
@ -10,10 +10,12 @@ import mage.abilities.effects.common.ChooseACardNameEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -31,7 +33,7 @@ public final class DeclarationOfNaught extends CardImpl {
|
|||
|
||||
// {U}: Counter target spell with the chosen name.
|
||||
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl("{U}"));
|
||||
ability.setTargetAdjustment(TargetAdjustment.CHOSEN_NAME);
|
||||
ability.setTargetAdjuster(DeclarationOfNaughtAdjuster.instance);
|
||||
ability.addTarget(new TargetSpell(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -45,3 +47,17 @@ public final class DeclarationOfNaught extends CardImpl {
|
|||
return new DeclarationOfNaught(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DeclarationOfNaughtAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
String chosenName = (String) game.getState().getValue(ability.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||
FilterSpell filterSpell = new FilterSpell("spell named " + chosenName);
|
||||
filterSpell.add(new NamePredicate(chosenName));
|
||||
TargetSpell target = new TargetSpell(1, filterSpell);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -17,12 +16,12 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.XTargetsAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +43,7 @@ public final class DeepwoodElder extends CardImpl {
|
|||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new DiscardCardCost());
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
ability.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
|
|
@ -24,6 +23,7 @@ import mage.filter.predicate.other.OwnerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.targetadjustment.XCMCGraveyardAdjuster;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
|
@ -52,7 +52,7 @@ public final class GethLordOfTheVault extends CardImpl {
|
|||
// {X}{B}: Put target artifact or creature card with converted mana cost X from an opponent's graveyard onto the battlefield under your control tapped.
|
||||
// Then that player puts the top X cards of their library into their graveyard.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}"));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
|
||||
ability.setTargetAdjuster(XCMCGraveyardAdjuster.instance);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
|
|
@ -28,6 +27,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentCard;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.targetadjustment.XCMCGraveyardAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ public final class LazavTheMultifarious extends CardImpl {
|
|||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
|
||||
ability.setTargetAdjuster(XCMCGraveyardAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ class LazavTheMultifariousApplier extends ApplyToPermanent {
|
|||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
|
||||
ability.setTargetAdjuster(XCMCGraveyardAdjuster.instance);
|
||||
permanent.getAbilities().add(ability);
|
||||
permanent.setName("Lazav, the Multifarious");
|
||||
permanent.addSuperType(SuperType.LEGENDARY);
|
||||
|
|
@ -151,7 +151,7 @@ class LazavTheMultifariousApplier extends ApplyToPermanent {
|
|||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
|
||||
ability.setTargetAdjuster(XCMCGraveyardAdjuster.instance);
|
||||
mageObject.getAbilities().add(ability);
|
||||
mageObject.setName("Lazav, the Multifarious");
|
||||
mageObject.addSuperType(SuperType.LEGENDARY);
|
||||
|
|
|
|||
|
|
@ -12,11 +12,15 @@ import mage.constants.SubType;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterInstantOrSorcerySpell;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -53,6 +57,7 @@ public final class LeagueGuildmage extends CardImpl {
|
|||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetSpell(filter));
|
||||
ability.setTargetAdjuster(LeagueGuildmageAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -65,3 +70,17 @@ public final class LeagueGuildmage extends CardImpl {
|
|||
return new LeagueGuildmage(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum LeagueGuildmageAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterSpell spellFilter = new FilterInstantOrSorcerySpell("instant or sorcery you control with converted mana cost " + xValue);
|
||||
spellFilter.add(new ControllerPredicate(TargetController.YOU));
|
||||
spellFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetSpell(spellFilter));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -11,13 +10,17 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
|
|
@ -36,7 +39,7 @@ public final class LegacysAllure extends CardImpl {
|
|||
// Sacrifice Legacy's Allure: Gain control of target creature with power less than or equal to the number of treasure counters on Legacy's Allure.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.EndOfGame, true), new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 0, filter, false));
|
||||
ability.setTargetAdjustment(TargetAdjustment.TREASURE_COUNTER_POWER);
|
||||
ability.setTargetAdjuster(LegacysAllureAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -49,3 +52,19 @@ public final class LegacysAllure extends CardImpl {
|
|||
return new LegacysAllure(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum LegacysAllureAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE);
|
||||
FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power less than or equal to " + xValue);
|
||||
filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCreaturePermanent(filter2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -13,10 +12,10 @@ 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.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.XTargetsAdjuster;
|
||||
|
||||
/**
|
||||
* @author duncant
|
||||
|
|
@ -37,7 +36,7 @@ public final class MagusOfTheCandelabra extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
ability.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -11,13 +10,17 @@ import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -42,7 +45,7 @@ public final class MinamoSightbender extends CardImpl {
|
|||
// {X}, {T}: Target creature with power X or less can't be blocked this turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedTargetEffect(), new ManaCostsImpl("{X}"));
|
||||
Target target = new TargetPermanent(filter);
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_POWER_LEQ);
|
||||
ability.setTargetAdjuster(MinamoSightbenderAdjuster.instance);
|
||||
ability.addTarget(target);
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
|
|
@ -58,3 +61,16 @@ public final class MinamoSightbender extends CardImpl {
|
|||
return new MinamoSightbender(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MinamoSightbenderAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent permanentFilter = new FilterCreaturePermanent("creature with power " + xValue + " or less");
|
||||
permanentFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetPermanent(permanentFilter));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -11,10 +10,10 @@ import mage.abilities.effects.common.TapTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.XTargetsAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -30,7 +29,7 @@ public final class MishrasHelix extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
ability.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -19,7 +19,11 @@ import mage.constants.Zone;
|
|||
import mage.filter.FilterPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -27,7 +31,7 @@ import mage.constants.TargetAdjustment;
|
|||
*/
|
||||
public final class PentarchPaladin extends CardImpl {
|
||||
|
||||
FilterPermanent filter = new FilterPermanent("permanent of the chosen color.");
|
||||
private static final FilterPermanent filter = new FilterPermanent("permanent of the chosen color.");
|
||||
|
||||
public PentarchPaladin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}{W}");
|
||||
|
|
@ -47,7 +51,7 @@ public final class PentarchPaladin extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{W}{W}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.CHOSEN_COLOR);
|
||||
ability.setTargetAdjuster(PentarchPaladinAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -60,3 +64,21 @@ public final class PentarchPaladin extends CardImpl {
|
|||
return new PentarchPaladin(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum PentarchPaladinAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ObjectColor chosenColor = (ObjectColor) game.getState().getValue(ability.getSourceId() + "_color");
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filter = new FilterPermanent("permanent of the chosen color.");
|
||||
if (chosenColor != null) {
|
||||
filter.add(new ColorPredicate(chosenColor));
|
||||
} else {
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, -5));// Pretty sure this is always false
|
||||
}
|
||||
TargetPermanent oldTargetPermanent = new TargetPermanent(filter);
|
||||
ability.addTarget(oldTargetPermanent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -12,14 +12,12 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.target.targetadjustment.VerseCounterAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -40,7 +38,7 @@ public final class Recantation extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetPermanent(0, 0, new FilterPermanent("up to X target permanents, where X is the number of verse counters on {this}."), false));
|
||||
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS);
|
||||
ability.setTargetAdjuster(VerseCounterAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -13,13 +12,13 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.VerseCounterAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -46,7 +45,7 @@ public final class RumblingCrescendo extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetPermanent(0, 0, filter, false));
|
||||
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS);
|
||||
ability.setTargetAdjuster(VerseCounterAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -14,11 +13,11 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.XTargetsAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -48,7 +47,7 @@ public final class RunedArch extends CardImpl {
|
|||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
ability.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -13,7 +12,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -21,6 +19,7 @@ import mage.filter.FilterPermanent;
|
|||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.VerseCounterAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -50,7 +49,7 @@ public final class SerrasLiturgy extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{W}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetPermanent(0, 0, filter, false));
|
||||
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS);
|
||||
ability.setTargetAdjuster(VerseCounterAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -7,6 +6,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
|
||||
import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.abilities.keyword.EvolveAbility;
|
||||
|
|
@ -21,7 +21,9 @@ import mage.counters.CounterType;
|
|||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
* Gatecrash FAQ (01.2013)
|
||||
|
|
@ -37,7 +39,6 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public final class SimicManipulator extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("with power less than or equal to the number of +1/+1 counters removed this way");
|
||||
|
||||
public SimicManipulator(UUID ownerId, CardSetInfo setInfo) {
|
||||
|
|
@ -55,36 +56,38 @@ public final class SimicManipulator extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.Custom, true), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance(), 1, "Remove one or more +1/+1 counters from {this}"));
|
||||
ability.setTargetAdjuster(SimicManipulatorAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
this.originalId = ability.getOriginalId();
|
||||
|
||||
}
|
||||
|
||||
public SimicManipulator(final SimicManipulator card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimicManipulator copy() {
|
||||
return new SimicManipulator(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum SimicManipulatorAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
int maxPower = 0;
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of +1/+1 counters removed this way");
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int xValue = 0;
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof RemoveVariableCountersSourceCost) {
|
||||
maxPower = ((RemoveVariableCountersSourceCost) cost).getAmount();
|
||||
if (cost instanceof RemoveVariableCountersTargetCost) {
|
||||
xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, maxPower + 1));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent newFilter = new FilterCreaturePermanent("creature with power " + xValue + " or less");
|
||||
newFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.addTarget(new TargetCreaturePermanent(newFilter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -14,12 +13,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.XTargetsAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -46,7 +45,7 @@ public final class SynodArtificer extends CardImpl {
|
|||
tapEffect.setText("Tap X target noncreature artifacts.");
|
||||
Ability tapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, tapEffect, new ManaCostsImpl("{X}"));
|
||||
tapAbility.addCost(new TapSourceCost());
|
||||
tapAbility.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
tapAbility.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
tapAbility.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(tapAbility);
|
||||
|
||||
|
|
@ -55,7 +54,7 @@ public final class SynodArtificer extends CardImpl {
|
|||
untapEffect.setText("Untap X target noncreature artifacts.");
|
||||
Ability untapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, untapEffect, new ManaCostsImpl("{X}"));
|
||||
untapAbility.addCost(new TapSourceCost());
|
||||
untapAbility.setTargetAdjustment(TargetAdjustment.X_TARGETS);
|
||||
untapAbility.setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
untapAbility.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(untapAbility);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.v;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -14,7 +13,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -23,6 +21,7 @@ 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.VerseCounterAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -50,7 +49,7 @@ public final class VileRequiem extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetPermanent(0, 0, filter, false));
|
||||
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS);
|
||||
ability.setTargetAdjuster(VerseCounterAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -14,7 +13,6 @@ import mage.abilities.effects.Effects;
|
|||
import mage.constants.AbilityType;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
|
|
@ -23,6 +21,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
|
|
@ -527,7 +526,9 @@ public interface Ability extends Controllable, Serializable {
|
|||
|
||||
boolean canFizzle();
|
||||
|
||||
void setTargetAdjustment(TargetAdjustment targetAdjustment);
|
||||
void setTargetAdjuster(TargetAdjuster targetAdjuster);
|
||||
|
||||
TargetAdjustment getTargetAdjustment();
|
||||
TargetAdjuster getTargetAdjuster();
|
||||
|
||||
void adjustTargets(Game game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -33,6 +32,7 @@ import mage.game.stack.StackAbility;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
import mage.watchers.Watcher;
|
||||
|
|
@ -72,7 +72,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
protected List<Watcher> watchers = new ArrayList<>();
|
||||
protected List<Ability> subAbilities = null;
|
||||
protected boolean canFizzle = true;
|
||||
protected TargetAdjustment targetAdjustment = TargetAdjustment.NONE;
|
||||
protected TargetAdjuster targetAdjuster = null;
|
||||
|
||||
public AbilityImpl(AbilityType abilityType, Zone zone) {
|
||||
this.id = UUID.randomUUID();
|
||||
|
|
@ -119,7 +119,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
this.sourceObject = ability.sourceObject;
|
||||
this.sourceObjectZoneChangeCounter = ability.sourceObjectZoneChangeCounter;
|
||||
this.canFizzle = ability.canFizzle;
|
||||
this.targetAdjustment = ability.targetAdjustment;
|
||||
this.targetAdjuster = ability.targetAdjuster;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1225,12 +1225,19 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setTargetAdjustment(TargetAdjustment targetAdjustment) {
|
||||
this.targetAdjustment = targetAdjustment;
|
||||
public void setTargetAdjuster(TargetAdjuster targetAdjuster) {
|
||||
this.targetAdjuster = targetAdjuster;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetAdjustment getTargetAdjustment() {
|
||||
return targetAdjustment;
|
||||
public TargetAdjuster getTargetAdjuster() {
|
||||
return targetAdjuster;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Game game) {
|
||||
if (targetAdjuster != null) {
|
||||
targetAdjuster.adjustTargets(this, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,27 +5,12 @@ import mage.MageObjectImpl;
|
|||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.repository.PluginClassloaderRegistery;
|
||||
import mage.constants.*;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.counters.Counters;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterInstantOrSorcerySpell;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.*;
|
||||
import mage.game.command.CommandObject;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -33,10 +18,6 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.watchers.Watcher;
|
||||
|
|
@ -48,7 +29,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
public abstract class CardImpl extends MageObjectImpl implements Card {
|
||||
|
||||
|
|
@ -352,118 +332,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
// }
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue;
|
||||
TargetPermanent oldTargetPermanent;
|
||||
FilterPermanent permanentFilter;
|
||||
int minTargets;
|
||||
int maxTargets;
|
||||
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();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(xValue, permanentFilter));
|
||||
break;
|
||||
case X_POWER_LEQ:// Minamo Sightbender only
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0);
|
||||
minTargets = oldTargetPermanent.getMinNumberOfTargets();
|
||||
maxTargets = oldTargetPermanent.getMaxNumberOfTargets();
|
||||
permanentFilter = oldTargetPermanent.getFilter().copy();
|
||||
permanentFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
||||
break;
|
||||
case VERSE_COUNTER_TARGETS:
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE);
|
||||
permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false));
|
||||
}
|
||||
break;
|
||||
case X_CMC_EQUAL_GY_CARD:
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCard filterCard = ((TargetCard) ability.getTargets().get(0)).getFilter().copy();
|
||||
filterCard.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filterCard.setMessage(filterCard.getMessage().replace('X', (char) xValue));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCardInGraveyard(filterCard));
|
||||
break;
|
||||
case CHOSEN_NAME: //Declaration of Naught only
|
||||
ability.getTargets().clear();
|
||||
FilterSpell filterSpell = new FilterSpell("spell with the chosen name");
|
||||
filterSpell.add(new NamePredicate((String) game.getState().getValue(ability.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY)));
|
||||
TargetSpell target = new TargetSpell(1, filterSpell);
|
||||
ability.addTarget(target);
|
||||
break;
|
||||
case CHOSEN_COLOR: //Pentarch Paladin only
|
||||
ObjectColor chosenColor = (ObjectColor) game.getState().getValue(ability.getSourceId() + "_color");
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filter = new FilterPermanent("permanent of the chosen color.");
|
||||
if (chosenColor != null) {
|
||||
filter.add(new ColorPredicate(chosenColor));
|
||||
} else {
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, -5));// Pretty sure this is always false
|
||||
}
|
||||
oldTargetPermanent = new TargetPermanent(filter);
|
||||
ability.addTarget(oldTargetPermanent);
|
||||
break;
|
||||
case TREASURE_COUNTER_POWER: //Legacy's Allure only
|
||||
sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE);
|
||||
FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on {this}");
|
||||
filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCreaturePermanent(filter2));
|
||||
}
|
||||
break;
|
||||
case SIMIC_MANIPULATOR: //Simic Manipulator only
|
||||
xValue = 0;
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof RemoveVariableCountersTargetCost) {
|
||||
xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent newFilter = new FilterCreaturePermanent("creature with power less than or equal to " + xValue);
|
||||
newFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.addTarget(new TargetCreaturePermanent(newFilter));
|
||||
break;
|
||||
case CREATURE_POWER_X_OR_LESS: // Aryel, Knight of Windgrace
|
||||
int value = 0;
|
||||
for (VariableCost cost : ability.getCosts().getVariableCosts()) {
|
||||
value = cost.getAmount();
|
||||
}
|
||||
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent("creature with power " + value + " or less");
|
||||
filterCreaturePermanent.add(new PowerPredicate(ComparisonType.FEWER_THAN, value + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(filterCreaturePermanent));
|
||||
break;
|
||||
case X_CMC_EQUAL_SPELL_CONTROLLED: // League Guildmage
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
FilterSpell spellFilter = new FilterInstantOrSorcerySpell("instant or sorcery you control with converted mana cost " + xValue);
|
||||
spellFilter.add(new ControllerPredicate(TargetController.YOU));
|
||||
spellFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetSpell(spellFilter));
|
||||
break;
|
||||
}
|
||||
ability.adjustTargets(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
package mage.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum TargetAdjustment {
|
||||
NONE,
|
||||
X_TARGETS,
|
||||
X_CMC_EQUAL_PERM,
|
||||
X_CMC_EQUAL_GY_CARD,
|
||||
X_POWER_LEQ,
|
||||
CHOSEN_NAME,
|
||||
CHOSEN_COLOR,
|
||||
VERSE_COUNTER_TARGETS,
|
||||
TREASURE_COUNTER_POWER,
|
||||
SIMIC_MANIPULATOR,
|
||||
CREATURE_POWER_X_OR_LESS,
|
||||
X_CMC_EQUAL_SPELL_CONTROLLED
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.game.stack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -28,6 +27,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.watchers.Watcher;
|
||||
|
|
@ -49,7 +49,7 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
private UUID controllerId;
|
||||
private String name;
|
||||
private String expansionSetCode;
|
||||
private TargetAdjustment targetAdjustment = TargetAdjustment.NONE;
|
||||
private TargetAdjuster targetAdjuster = null;
|
||||
|
||||
public StackAbility(Ability ability, UUID controllerId) {
|
||||
this.ability = ability;
|
||||
|
|
@ -62,7 +62,7 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
this.controllerId = stackAbility.controllerId;
|
||||
this.name = stackAbility.name;
|
||||
this.expansionSetCode = stackAbility.expansionSetCode;
|
||||
this.targetAdjustment = stackAbility.targetAdjustment;
|
||||
this.targetAdjuster = stackAbility.targetAdjuster;
|
||||
this.targetChanged = stackAbility.targetChanged;
|
||||
}
|
||||
|
||||
|
|
@ -596,12 +596,19 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setTargetAdjustment(TargetAdjustment targetAdjustment) {
|
||||
this.targetAdjustment = targetAdjustment;
|
||||
public void setTargetAdjuster(TargetAdjuster targetAdjuster) {
|
||||
this.targetAdjuster = targetAdjuster;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetAdjustment getTargetAdjustment() {
|
||||
return targetAdjustment;
|
||||
public TargetAdjuster getTargetAdjuster() {
|
||||
return targetAdjuster;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Game game) {
|
||||
if (targetAdjuster != null) {
|
||||
targetAdjuster.adjustTargets(this, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package mage.target.targetadjustment;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public interface TargetAdjuster {
|
||||
|
||||
void adjustTargets(Ability ability, Game game);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package mage.target.targetadjustment;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum VerseCounterAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE);
|
||||
FilterPermanent permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package mage.target.targetadjustment;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum XCMCGraveyardAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCard filterCard = ((TargetCard) ability.getTargets().get(0)).getFilter().copy();
|
||||
filterCard.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
filterCard.setMessage(filterCard.getMessage().replace('X', (char) xValue));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCardInGraveyard(filterCard));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
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 enum XCMCPermanentAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package mage.target.targetadjustment;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum XTargetsAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(xValue, permanentFilter));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue