mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Remove custom multitarget handling from ReturnToHandTargetEffect (use EachTargetPointer instead)
This commit is contained in:
parent
dc33531792
commit
7c2f76b46b
19 changed files with 63 additions and 146 deletions
|
@ -1,5 +1,6 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -7,6 +8,7 @@ import mage.constants.CardType;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -19,8 +21,8 @@ public final class AetherHelix extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}{U}");
|
||||
|
||||
// Return target permanent to its owner's hand. Return target permanent card from your graveyard to your hand.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true).setText("return target " +
|
||||
"permanent to its owner's hand. Return target permanent card from your graveyard to your hand"));
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
|
||||
this.getSpellAbility().addEffect(new ReturnFromGraveyardToHandTargetEffect().setTargetPointer(new SecondTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_PERMANENT));
|
||||
}
|
||||
|
|
|
@ -12,12 +12,11 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetadjustment.XTargetsAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -34,10 +33,11 @@ public final class AetherTide extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Return X target creatures to their owners' hands.
|
||||
Effect effect = new ReturnToHandTargetEffect(true);
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setText("Return X target creatures to their owners' hands");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().setTargetAdjuster(AetherTideTargetAdjuster.instance);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().setTargetAdjuster(XTargetsAdjuster.instance);
|
||||
this.getSpellAbility().setCostAdjuster(AetherTideCostAdjuster.instance);
|
||||
|
||||
}
|
||||
|
@ -52,17 +52,6 @@ public final class AetherTide extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum AetherTideTargetAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetCreaturePermanent(xValue, xValue, new FilterCreaturePermanent(), false));
|
||||
}
|
||||
}
|
||||
|
||||
enum AetherTideCostAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
|
@ -70,7 +59,7 @@ enum AetherTideCostAdjuster implements CostAdjuster {
|
|||
public void adjustCosts(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
ability.addCost(new DiscardTargetCost(new TargetCardInHand(xValue, xValue, new FilterCreatureCard("creature cards"))));
|
||||
ability.addCost(new DiscardTargetCost(new TargetCardInHand(xValue, xValue, StaticFilters.FILTER_CARD_CREATURES)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -11,6 +10,7 @@ import mage.constants.TargetController;
|
|||
import mage.filter.FilterPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,9 +30,7 @@ public final class AetherTradewinds extends CardImpl {
|
|||
// Return target permanent you control and target permanent you don't control to their owners' hands.
|
||||
this.getSpellAbility().addTarget(new TargetControlledPermanent());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||
Effect effect = new ReturnToHandTargetEffect(true);
|
||||
effect.setText("Return target permanent you control and target permanent you don't control to their owners' hands");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
}
|
||||
|
||||
private AetherTradewinds(final AetherTradewinds card) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public final class CaptivatingGyre extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}");
|
||||
|
||||
// Return up to three target creatures to their owners' hands.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true));
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 3));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -20,9 +19,7 @@ public final class ChurningEddy extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{U}");
|
||||
|
||||
// Return target creature and target land to their owners' hands.
|
||||
Effect effect = new ReturnToHandTargetEffect(true);
|
||||
effect.setText("Return target creature and target land to their owners' hands");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public final class ClutchOfCurrents extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{U}");
|
||||
|
||||
// Return target creature to its owner's hand.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(false));
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
||||
// Awaken 3—{4}{U}
|
||||
|
|
|
@ -3,50 +3,46 @@ package mage.cards.c;
|
|||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.OnEventTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.condition.common.DeliriumCondition;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||
import mage.abilities.effects.common.MillCardsControllerEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.abilities.hint.common.CardTypesInGraveyardHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class CropSigil extends CardImpl {
|
||||
|
||||
private static final FilterCard filterCreature = new FilterCard("creature card in a graveyard");
|
||||
private static final FilterCard filterLand = new FilterCard("land card in a graveyard");
|
||||
|
||||
static {
|
||||
filterCreature.add(CardType.CREATURE.getPredicate());
|
||||
filterLand.add(CardType.LAND.getPredicate());
|
||||
}
|
||||
|
||||
public CropSigil(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
|
||||
|
||||
// At the beginning of your upkeep, you may put the top card of your library into your graveyard.
|
||||
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new MillCardsControllerEffect(1), true));
|
||||
// At the beginning of your upkeep, you may mill a card.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MillCardsControllerEffect(1), TargetController.YOU, true));
|
||||
|
||||
// <i>Delirium</i> — {2}{G}, Sacrifice Crop Sigil: Return up to one target creature card and up to one target land card from your graveyard to your hand.
|
||||
// Activate this ability only if there are four or more card types among cards in your graveyard.
|
||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true), new ManaCostsImpl<>("{2}{G}"),
|
||||
DeliriumCondition.instance,
|
||||
"<i>Delirium</i> — {2}{G}, Sacrifice {this}: Return up to one target creature card and up to one target land card from your graveyard to your hand. "
|
||||
+ "Activate only if there are four or more card types among cards in your graveyard.");
|
||||
Ability ability = new ConditionalActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new ReturnFromGraveyardToHandTargetEffect().setTargetPointer(new EachTargetPointer()),
|
||||
new ManaCostsImpl<>("{2}{G}"),
|
||||
DeliriumCondition.instance);
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 1, filterCreature));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 1, filterLand));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_LAND));
|
||||
ability.setAbilityWord(AbilityWord.DELIRIUM);
|
||||
ability.addHint(CardTypesInGraveyardHint.YOU);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -40,7 +41,8 @@ public final class EnigmaThief extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Enigma Thief enters the battlefield, for each opponent, return up to one target nonland permanent that player controls to its owner's hand.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(true)
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect()
|
||||
.setTargetPointer(new EachTargetPointer())
|
||||
.setText("for each opponent, return up to one target nonland permanent that player controls to its owner's hand"));
|
||||
ability.setTargetAdjuster(EnigmaThiefAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -15,6 +15,7 @@ import mage.filter.common.FilterControlledCreaturePermanent;
|
|||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -40,8 +41,7 @@ public final class JediSentinel extends CardImpl {
|
|||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// When Jedi Sentinel enters the battlefield, return another target creature you control and target creature you don't control to their owners' hands.
|
||||
Effect effect = new ReturnToHandTargetEffect(true);
|
||||
effect.setText("return another target creature you control and target creature you don't control to their owners' hands");
|
||||
Effect effect = new ReturnToHandTargetEffect().setTargetPointer(new EachTargetPointer());
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(effect);
|
||||
ability.addTarget(new TargetControlledCreaturePermanent(filter1));
|
||||
ability.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class MuYanlingCelestialWind extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// −3: Return up to two target creatures to their owners' hands.
|
||||
ability = new LoyaltyAbility(new ReturnToHandTargetEffect(true), -3);
|
||||
ability = new LoyaltyAbility(new ReturnToHandTargetEffect(), -3);
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 2));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import mage.constants.CardType;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -19,8 +20,7 @@ public final class PeelFromReality extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// Return target creature you control and target creature you don't control to their owners' hands.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true)
|
||||
.setText("return target creature you control and target creature you don't control to their owners' hands"));
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public final class Recantation extends CardImpl {
|
|||
new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true));
|
||||
|
||||
// {U}, Sacrifice Recantation: Return up to X target permanents to their owners' hands, where X is the number of verse counters on Recantation.
|
||||
Effect effect = new ReturnToHandTargetEffect(true);
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setText("Return up to X target permanents to their owners' hands, where X is the number of verse counters on {this}.");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{U}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import mage.abilities.effects.common.ExileSpellEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -10,6 +10,7 @@ import mage.filter.common.FilterArtifactCard;
|
|||
import mage.filter.common.FilterEnchantmentCard;
|
||||
import mage.filter.common.FilterPlaneswalkerCard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -23,10 +24,6 @@ public final class ReconstructHistory extends CardImpl {
|
|||
private static final FilterCard filterInstant = new FilterCard("instant card");
|
||||
private static final FilterCard filterSorcery = new FilterCard("sorcery card");
|
||||
private static final FilterCard filterPlaneswalker = new FilterPlaneswalkerCard();
|
||||
private static final String rule = "return up to one target artifact card, " +
|
||||
"up to one target enchantment card, up to one target instant card, " +
|
||||
"up to one target sorcery card, and up to one target planeswalker " +
|
||||
"card from your graveyard to your hand";
|
||||
|
||||
static {
|
||||
filterInstant.add(CardType.INSTANT.getPredicate());
|
||||
|
@ -37,7 +34,7 @@ public final class ReconstructHistory extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}{W}");
|
||||
|
||||
// Return up to one target artifact card, up to one target enchantment card, up to one target instant card, up to one target sorcery card, and up to one target planeswalker card from your graveyard to your hand.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true).setText(rule));
|
||||
this.getSpellAbility().addEffect(new ReturnFromGraveyardToHandTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(
|
||||
0, 1, filterArtifact
|
||||
));
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import mage.MageInt;
|
||||
|
@ -7,20 +6,20 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterEnchantmentCard;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Styxo
|
||||
* @author awjackson
|
||||
*/
|
||||
public final class RestorationSpecialist extends CardImpl {
|
||||
|
||||
|
@ -33,14 +32,12 @@ public final class RestorationSpecialist extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// {W}, Sacrifice Restoration Specialist: Return up to one target artifact card and up to one target enchantment card from your graveyard to your hand.
|
||||
Effect effect = new ReturnToHandTargetEffect(true);
|
||||
effect.setText("Return up to one target artifact card and up to one target enchantment card from your graveyard to your hand");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{W}"));
|
||||
ability.addTarget(new TargetCardInGraveyard(0, 1, StaticFilters.FILTER_CARD_ARTIFACT_FROM_YOUR_GRAVEYARD));
|
||||
ability.addTarget(new TargetCardInGraveyard(0, 1, new FilterEnchantmentCard("enchantment card from your graveyard")));
|
||||
Effect effect = new ReturnFromGraveyardToHandTargetEffect().setTargetPointer(new EachTargetPointer());
|
||||
Ability ability = new SimpleActivatedAbility(effect, new ManaCostsImpl<>("{W}"));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_ARTIFACT));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 1, new FilterEnchantmentCard()));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
private RestorationSpecialist(final RestorationSpecialist card) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.target.common.TargetNonlandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -31,8 +32,7 @@ public final class RiteOfUndoing extends CardImpl {
|
|||
this.addAbility(new DelveAbility());
|
||||
|
||||
// Return target nonland permanent you control and target nonland permanent you don't control to their owners' hands.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true)
|
||||
.setText("return target nonland permanent you control and target nonland permanent you don't control to their owners' hands"));
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetNonlandPermanent(filterControlled));
|
||||
this.getSpellAbility().addTarget(new TargetNonlandPermanent(filterNotControlled));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public final class RunAwayTogether extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// Choose two target creatures controlled by different players. Return those creatures to their owners' hands.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true)
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()
|
||||
.setText("Choose two target creatures controlled by different players. " +
|
||||
"Return those creatures to their owners' hands.")
|
||||
);
|
||||
|
|
|
@ -28,7 +28,7 @@ public final class SelectiveSnare extends CardImpl {
|
|||
|
||||
// Return X target creatures of the creature type of your choice to their owner's hand.
|
||||
this.getSpellAbility().addEffect(
|
||||
new ReturnToHandTargetEffect(true)
|
||||
new ReturnToHandTargetEffect()
|
||||
.setText("Return X target creatures of "
|
||||
+ "the creature type of your choice "
|
||||
+ "to their owner's hand")
|
||||
|
|
|
@ -46,24 +46,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
sb.append("return ");
|
||||
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
} else if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
String targetDescription = getTargetPointer().describeTargets(mode.getTargets(), "");
|
||||
return "return " + targetDescription + (targetDescription.contains("graveyard") ? " to your hand" : " from your graveyard to your hand");
|
||||
}
|
||||
if (!target.getTargetName().startsWith("another")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
sb.append(target.getTargetName());
|
||||
if (!target.getTargetName().endsWith("graveyard")) {
|
||||
sb.append(" from your graveyard");
|
||||
}
|
||||
sb.append(" to your hand");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,20 +20,12 @@ import java.util.*;
|
|||
*/
|
||||
public class ReturnToHandTargetEffect extends OneShotEffect {
|
||||
|
||||
protected boolean multitargetHandling;
|
||||
|
||||
public ReturnToHandTargetEffect() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public ReturnToHandTargetEffect(boolean multitargetHandling) {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.multitargetHandling = multitargetHandling;
|
||||
}
|
||||
|
||||
public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) {
|
||||
super(effect);
|
||||
this.multitargetHandling = effect.multitargetHandling;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,18 +41,6 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
|
|||
}
|
||||
List<UUID> copyIds = new ArrayList<>();
|
||||
Set<Card> cards = new LinkedHashSet<>();
|
||||
if (multitargetHandling) {
|
||||
for (Target target : source.getTargets()) {
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
MageObject mageObject = game.getObject(targetId);
|
||||
if (mageObject instanceof Spell && mageObject.isCopy()) {
|
||||
copyIds.add(targetId);
|
||||
} else if (mageObject instanceof Card) {
|
||||
cards.add((Card) mageObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (UUID targetId : targetPointer.getTargets(game, source)) {
|
||||
MageObject mageObject = game.getObject(targetId);
|
||||
if (mageObject != null) {
|
||||
|
@ -72,7 +52,6 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (UUID copyId : copyIds) {
|
||||
game.getStack().remove(game.getSpell(copyId), game);
|
||||
}
|
||||
|
@ -80,35 +59,12 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode
|
||||
) {
|
||||
public String getText(Mode mode)
|
||||
{
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (mode.getTargets().size() < 1) {
|
||||
return "";
|
||||
return "return " + getTargetPointer().describeTargets(mode.getTargets(), "") +
|
||||
(getTargetPointer().isPlural(mode.getTargets()) ? " to their owners' hands" : " to its owner's hand");
|
||||
}
|
||||
Target target = mode.getTargets().get(0);
|
||||
StringBuilder sb = new StringBuilder("return ");
|
||||
if (target.getMinNumberOfTargets() == 0 && target.getMaxNumberOfTargets() >= 1) {
|
||||
sb.append("up to ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
} else if (!(target.getMinNumberOfTargets() == 1 || target.getMaxNumberOfTargets() == 1)) {
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
}
|
||||
if (!target.getTargetName().contains("target")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
sb.append(target.getTargetName());
|
||||
if (target.getMaxNumberOfTargets() > 1 && !target.getTargetName().endsWith("s") && !target.getTargetName().endsWith("control")) {
|
||||
sb.append('s');
|
||||
}
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append(" to their owners' hands");
|
||||
} else {
|
||||
sb.append(" to its owner's hand");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue