Improved rules text generation and removed static texts for some cards with effects:

* ExileTargetForSourceEffect
 * ReturnFromExileForSourceEffect
 * ReturnToBattlefieldUnderOwnerControlTargetEffect
 * ReturnToBattlefieldUnderYourControlTargetEffect
This commit is contained in:
Oleg Agafonov 2020-01-14 20:38:45 +04:00
parent ce3f6d8e41
commit b1b6bd600e
16 changed files with 120 additions and 97 deletions

View file

@ -1,7 +1,5 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -19,8 +17,9 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class EldraziDisplacer extends CardImpl { public final class EldraziDisplacer extends CardImpl {
@ -42,10 +41,9 @@ public final class EldraziDisplacer extends CardImpl {
// {2}{C}: Exile another target creature, then return it to the battlefield tapped under its owner's control. // {2}{C}: Exile another target creature, then return it to the battlefield tapped under its owner's control.
Effect effect = new ExileTargetForSourceEffect(); Effect effect = new ExileTargetForSourceEffect();
effect.setText("Exile another target creature");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{2}{C}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{2}{C}"));
effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(true); effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(true)
effect.setText(", then return it to the battlefield tapped under its owner's control"); .withReturnNames("it", "its owner's").concatBy(", then");
ability.addEffect(effect); ability.addEffect(effect);
ability.addTarget(new TargetCreaturePermanent(FILTER)); ability.addTarget(new TargetCreaturePermanent(FILTER));
this.addAbility(ability); this.addAbility(ability);

View file

@ -1,7 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -19,32 +17,29 @@ import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.Target; import mage.target.Target;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author Temba21 * @author Temba21
*/ */
public final class FacelessButcher extends CardImpl { public final class FacelessButcher extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature other than Faceless Butcher");
static { static {
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
} }
public FacelessButcher(UUID ownerId, CardSetInfo setInfo) { public FacelessButcher(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
this.subtype.add(SubType.NIGHTMARE); this.subtype.add(SubType.NIGHTMARE);
this.subtype.add(SubType.HORROR); this.subtype.add(SubType.HORROR);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// When Faceless Butcher enters the battlefield, exile target creature other than Faceless Butcher. // When Faceless Butcher enters the battlefield, exile target creature other than Faceless Butcher.
Effect effect = new ExileTargetForSourceEffect(); Effect effect = new ExileTargetForSourceEffect();
effect.setText("exile target creature other than {this}");
Ability ability1 = new EntersBattlefieldTriggeredAbility(effect, false); Ability ability1 = new EntersBattlefieldTriggeredAbility(effect, false);
Target target = new TargetPermanent(filter); Target target = new TargetPermanent(filter);
ability1.addTarget(target); ability1.addTarget(target);

View file

@ -1,7 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -21,13 +19,14 @@ import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.Target; import mage.target.Target;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class FacelessDevourer extends CardImpl { public final class FacelessDevourer extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature with shadow");
static { static {
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
@ -35,7 +34,7 @@ public final class FacelessDevourer extends CardImpl {
} }
public FacelessDevourer(UUID ownerId, CardSetInfo setInfo) { public FacelessDevourer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.NIGHTMARE); this.subtype.add(SubType.NIGHTMARE);
this.subtype.add(SubType.HORROR); this.subtype.add(SubType.HORROR);
this.power = new MageInt(2); this.power = new MageInt(2);
@ -43,15 +42,17 @@ public final class FacelessDevourer extends CardImpl {
// Shadow // Shadow
this.addAbility(ShadowAbility.getInstance()); this.addAbility(ShadowAbility.getInstance());
// When Faceless Devourer enters the battlefield, exile another target creature with shadow. // When Faceless Devourer enters the battlefield, exile another target creature with shadow.
Effect effect = new ExileTargetForSourceEffect(); Effect effect = new ExileTargetForSourceEffect();
effect.setText("exile another target creature with shadow");
Ability ability = new EntersBattlefieldTriggeredAbility(effect, false); Ability ability = new EntersBattlefieldTriggeredAbility(effect, false);
Target target = new TargetPermanent(filter); Target target = new TargetPermanent(filter);
ability.addTarget(target); ability.addTarget(target);
this.addAbility(ability); this.addAbility(ability);
// When Faceless Devourer leaves the battlefield, return the exiled card to the battlefield under its owner's control. // When Faceless Devourer leaves the battlefield, return the exiled card to the battlefield under its owner's control.
ability = new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), false); ability = new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD)
.withReturnName("card", "its owner's"), false);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,7 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -17,14 +15,15 @@ import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.target.common.TargetCardInASingleGraveyard; import mage.target.common.TargetCardInASingleGraveyard;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class Gravegouger extends CardImpl { public final class Gravegouger extends CardImpl {
public Gravegouger(UUID ownerId, CardSetInfo setInfo) { public Gravegouger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.NIGHTMARE); this.subtype.add(SubType.NIGHTMARE);
this.subtype.add(SubType.HORROR); this.subtype.add(SubType.HORROR);
this.power = new MageInt(2); this.power = new MageInt(2);
@ -32,10 +31,10 @@ public final class Gravegouger extends CardImpl {
// When Gravegouger enters the battlefield, exile up to two target cards from a single graveyard. // When Gravegouger enters the battlefield, exile up to two target cards from a single graveyard.
Effect effect = new ExileTargetForSourceEffect(); Effect effect = new ExileTargetForSourceEffect();
effect.setText("exile up to two target cards from a single graveyard");
Ability ability = new EntersBattlefieldTriggeredAbility(effect, false); Ability ability = new EntersBattlefieldTriggeredAbility(effect, false);
ability.addTarget(new TargetCardInASingleGraveyard(0, 2, new FilterCard("cards from a single graveyard"))); ability.addTarget(new TargetCardInASingleGraveyard(0, 2, new FilterCard("cards from a single graveyard")));
this.addAbility(ability); this.addAbility(ability);
// When Gravegouger leaves the battlefield, return the exiled cards to their owner's graveyard. // When Gravegouger leaves the battlefield, return the exiled cards to their owner's graveyard.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.GRAVEYARD), false)); this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.GRAVEYARD), false));
} }

View file

@ -1,7 +1,5 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID;
import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -18,8 +16,9 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class Helvault extends CardImpl { public final class Helvault extends CardImpl {
@ -31,19 +30,21 @@ public final class Helvault extends CardImpl {
} }
public Helvault(UUID ownerId, CardSetInfo setInfo) { public Helvault(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
// {1}, {tap}: Exile target creature you control. // {1}, {T}: Exile target creature you control.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new GenericManaCost(1)); SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetControlledCreaturePermanent()); ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
// {7}, {tap}: Exile target creature you don't control.
// {7}, {T}: Exile target creature you don't control.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new GenericManaCost(7)); ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new GenericManaCost(7));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter)); ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability); this.addAbility(ability);
// When Helvault is put into a graveyard from the battlefield, return all cards exiled with it to the battlefield under their owners' control. // When Helvault is put into a graveyard from the battlefield, return all cards exiled with it to the battlefield under their owners' control.
this.addAbility(new DiesTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD))); this.addAbility(new DiesTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD)));
} }

View file

@ -1,8 +1,5 @@
package mage.cards.i; package mage.cards.i;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ExileTargetForSourceEffect; import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect;
@ -12,8 +9,9 @@ import mage.constants.CardType;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author Styxo * @author Styxo
*/ */
public final class IllusionistsStratagem extends CardImpl { public final class IllusionistsStratagem extends CardImpl {
@ -22,13 +20,11 @@ public final class IllusionistsStratagem extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}");
// Exile up to two target creatures you control, then return those cards to the battlefield under their owner's control. // Exile up to two target creatures you control, then return those cards to the battlefield under their owner's control.
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 2, new FilterControlledCreaturePermanent("creatures you control"), false)); this.getSpellAbility().addEffect(new ExileTargetForSourceEffect());
Effect effect = new ExileTargetForSourceEffect(); this.getSpellAbility().addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true)
effect.setText("Exile up to two target creatures you control"); .withReturnNames("those cards", "their owner's").concatBy(", then"));
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 2,
effect = new ReturnToBattlefieldUnderYourControlTargetEffect(true); new FilterControlledCreaturePermanent("creatures you control"), false));
effect.setText(", then return those cards to the battlefield under their owner's control");
this.getSpellAbility().addEffect(effect);
// Draw a card. // Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));

View file

@ -1,12 +1,9 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileTargetForSourceEffect; import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
@ -19,13 +16,14 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author Styxo * @author Styxo
*/ */
public final class N1Starfighter extends CardImpl { public final class N1Starfighter extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another target creature you control");
static { static {
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
@ -40,12 +38,14 @@ public final class N1Starfighter extends CardImpl {
// Spaceflight // Spaceflight
this.addAbility(SpaceflightAbility.getInstance()); this.addAbility(SpaceflightAbility.getInstance());
// Whenever N-1 Starfighter deals combat damage to a player, you may pay {1}{W/U}. If you do, exile another creature you control, then return that card to the battlefield under its owner's control. // Whenever N-1 Starfighter deals combat damage to a player, you may pay {1}{W/U}. If you do,
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid(new ExileTargetForSourceEffect(), new ManaCostsImpl("{1}{W/U}")), false); // exile another target creature you control, then return that card to the battlefield under its owner's control.
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true); // P.S. original card have error with missing target word (another target creature)
effect.setText(", then return the card to the battlefield under their owner's control"); Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid(
ability.addEffect(effect); new ExileTargetForSourceEffect(), new ManaCostsImpl("{1}{W/U}")), false);
ability.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true).concatBy(", then"));
ability.addTarget(new TargetControlledCreaturePermanent(filter)); ability.addTarget(new TargetControlledCreaturePermanent(filter));
ability.getRule();
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,7 +1,5 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility; import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -16,22 +14,25 @@ import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/** /**
*
* @author Plopman * @author Plopman
*/ */
public final class ParallaxTide extends CardImpl { public final class ParallaxTide extends CardImpl {
public ParallaxTide(UUID ownerId, CardSetInfo setInfo) { public ParallaxTide(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
// Fading 5 // Fading 5
this.addAbility(new FadingAbility(5, this)); this.addAbility(new FadingAbility(5, this));
// Remove a fade counter from Parallax Tide: Exile target land. // Remove a fade counter from Parallax Tide: Exile target land.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new RemoveCountersSourceCost(CounterType.FADE.createInstance())); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new RemoveCountersSourceCost(CounterType.FADE.createInstance()));
ability.addTarget(new TargetLandPermanent()); ability.addTarget(new TargetLandPermanent());
this.addAbility(ability); this.addAbility(ability);
// When Parallax Tide leaves the battlefield, each player returns to the battlefield all cards they own exiled with Parallax Tide. // When Parallax Tide leaves the battlefield, each player returns to the battlefield all cards they own exiled with Parallax Tide.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), splitCard)); this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), splitCard));
} }

View file

@ -1,46 +1,46 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility; import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileTargetForSourceEffect; import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnFromExileForSourceEffect; import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class Petradon extends CardImpl { public final class Petradon extends CardImpl {
public Petradon(UUID ownerId, CardSetInfo setInfo) { public Petradon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{R}{R}");
this.subtype.add(SubType.NIGHTMARE); this.subtype.add(SubType.NIGHTMARE);
this.subtype.add(SubType.BEAST); this.subtype.add(SubType.BEAST);
this.power = new MageInt(5); this.power = new MageInt(5);
this.toughness = new MageInt(6); this.toughness = new MageInt(6);
// When Petradon enters the battlefield, exile two target lands. // When Petradon enters the battlefield, exile two target lands.
Effect effect = new ExileTargetForSourceEffect(); Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect(), false);
effect.setText("exile two target lands"); ability.addTarget(new TargetLandPermanent(2, 2, new FilterLandPermanent("lands"), false));
Ability ability = new EntersBattlefieldTriggeredAbility(effect, false);
ability.addTarget(new TargetLandPermanent(2));
this.addAbility(ability); this.addAbility(ability);
// When Petradon leaves the battlefield, return the exiled cards to the battlefield under their owners' control. // When Petradon leaves the battlefield, return the exiled cards to the battlefield under their owners' control.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), false)); this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD)
.withReturnName("cards", "their owners'"), false));
// {R}: Petradon gets +1/+0 until end of turn. // {R}: Petradon gets +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
} }

View file

@ -1,7 +1,5 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -15,14 +13,15 @@ import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class Petravark extends CardImpl { public final class Petravark extends CardImpl {
public Petravark(UUID ownerId, CardSetInfo setInfo) { public Petravark(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.NIGHTMARE); this.subtype.add(SubType.NIGHTMARE);
this.subtype.add(SubType.BEAST); this.subtype.add(SubType.BEAST);
this.power = new MageInt(2); this.power = new MageInt(2);
@ -32,6 +31,7 @@ public final class Petravark extends CardImpl {
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect(), false); Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect(), false);
ability.addTarget(new TargetLandPermanent()); ability.addTarget(new TargetLandPermanent());
this.addAbility(ability); this.addAbility(ability);
// When Petravark leaves the battlefield, return the exiled card to the battlefield under its owner's control. // When Petravark leaves the battlefield, return the exiled card to the battlefield under its owner's control.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), false)); this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), false));
} }

View file

@ -1,7 +1,5 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -17,20 +15,21 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledLandPermanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class RuinGhost extends CardImpl { public final class RuinGhost extends CardImpl {
public RuinGhost(UUID ownerId, CardSetInfo setInfo) { public RuinGhost(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.SPIRIT); this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {W}, {tap}: Exile target land you control, then return it to the battlefield under your control. // {W}, {T}: Exile target land you control, then return it to the battlefield under your control.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new ManaCostsImpl("{W")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new ManaCostsImpl("{W"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true)); ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true));

View file

@ -56,7 +56,7 @@ public final class ThassaDeepDwelling extends CardImpl {
// At the beginning of your end step, exile up to one other target creature you control, then return that card to the battlefield under your control. // At the beginning of your end step, exile up to one other target creature you control, then return that card to the battlefield under your control.
Ability ability = new BeginningOfEndStepTriggeredAbility( Ability ability = new BeginningOfEndStepTriggeredAbility(
new ExileTargetForSourceEffect()/*.setText("exile up to one other target creature you control")*/, new ExileTargetForSourceEffect(),
TargetController.YOU, false TargetController.YOU, false
); );
ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true).concatBy(", then")); ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true).concatBy(", then"));

View file

@ -69,10 +69,13 @@ public class ExileTargetForSourceEffect extends OneShotEffect {
return staticText; return staticText;
} }
String upToText = ""; String amountText = "";
if (mode.getTargets().get(0).getMinNumberOfTargets() < mode.getTargets().get(0).getMaxNumberOfTargets()) { if (mode.getTargets().get(0).getMinNumberOfTargets() < mode.getTargets().get(0).getMaxNumberOfTargets()) {
upToText = "up to " + CardUtil.numberToText(mode.getTargets().get(0).getMaxNumberOfTargets()) + " "; amountText = "up to " + CardUtil.numberToText(mode.getTargets().get(0).getMaxNumberOfTargets()) + " ";
} else if (mode.getTargets().get(0).getMinNumberOfTargets() > 1) {
amountText = CardUtil.numberToText(mode.getTargets().get(0).getMinNumberOfTargets()) + " ";
} }
String targetText = ""; String targetText = "";
if (mode.getTargets().get(0).getTargetName().contains("target ")) { if (mode.getTargets().get(0).getTargetName().contains("target ")) {
targetText = ""; targetText = "";
@ -83,7 +86,7 @@ public class ExileTargetForSourceEffect extends OneShotEffect {
if (mode.getTargets().isEmpty()) { if (mode.getTargets().isEmpty()) {
return "exile it"; return "exile it";
} else { } else {
return "exile " + upToText + targetText + mode.getTargets().get(0).getTargetName(); return "exile " + amountText + targetText + mode.getTargets().get(0).getTargetName();
} }
} }
} }

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import mage.MageObject; import mage.MageObject;
@ -14,7 +13,6 @@ import mage.util.CardUtil;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class ReturnFromExileForSourceEffect extends OneShotEffect { public class ReturnFromExileForSourceEffect extends OneShotEffect {
@ -22,9 +20,10 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
private Zone returnToZone; private Zone returnToZone;
private boolean tapped; private boolean tapped;
private boolean previousZone; private boolean previousZone;
private String returnName = "cards";
private String returnControlName;
/** /**
*
* @param zone Zone the card should return to * @param zone Zone the card should return to
*/ */
public ReturnFromExileForSourceEffect(Zone zone) { public ReturnFromExileForSourceEffect(Zone zone) {
@ -36,18 +35,28 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
} }
/** /**
*
* @param zone * @param zone
* @param tapped * @param tapped
* @param previousZone if this is used from a dies leave battlefield or * @param previousZone if this is used from a dies leave battlefield or
* destroyed trigger, the exile zone is based on previous zone of the object * destroyed trigger, the exile zone is based on previous zone of the object
*/ */
public ReturnFromExileForSourceEffect(Zone zone, boolean tapped, boolean previousZone) { public ReturnFromExileForSourceEffect(Zone zone, boolean tapped, boolean previousZone) {
super(Outcome.PutCardInPlay); super(Outcome.PutCardInPlay);
this.returnToZone = zone; this.returnToZone = zone;
this.tapped = tapped; this.tapped = tapped;
this.previousZone = previousZone; this.previousZone = previousZone;
setText();
// different default name for zones
switch (zone) {
case BATTLEFIELD:
this.returnControlName = "its owner's";
break;
default:
this.returnControlName = "their owner's";
break;
}
updateText();
} }
public ReturnFromExileForSourceEffect(final ReturnFromExileForSourceEffect effect) { public ReturnFromExileForSourceEffect(final ReturnFromExileForSourceEffect effect) {
@ -55,6 +64,10 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
this.returnToZone = effect.returnToZone; this.returnToZone = effect.returnToZone;
this.tapped = effect.tapped; this.tapped = effect.tapped;
this.previousZone = effect.previousZone; this.previousZone = effect.previousZone;
this.returnName = effect.returnName;
this.returnControlName = effect.returnControlName;
updateText();
} }
@Override @Override
@ -85,24 +98,30 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
return false; return false;
} }
private void setText() { private void updateText() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("return the exiled cards "); sb.append("return the exiled " + this.returnName + " ");
switch (returnToZone) { switch (returnToZone) {
case BATTLEFIELD: case BATTLEFIELD:
sb.append("to the battlefield under its owner's control"); sb.append("to the battlefield under " + this.returnControlName + " control");
if (tapped) { if (tapped) {
sb.append(" tapped"); sb.append(" tapped");
} }
break; break;
case HAND: case HAND:
sb.append("to their owner's hand"); sb.append("to " + this.returnControlName + " hand");
break; break;
case GRAVEYARD: case GRAVEYARD:
sb.append("to their owner's graveyard"); sb.append("to " + this.returnControlName + " graveyard");
break; break;
} }
staticText = sb.toString(); staticText = sb.toString();
} }
public ReturnFromExileForSourceEffect withReturnName(String returnName, String returnControlName) {
this.returnName = returnName;
this.returnControlName = returnControlName;
updateText();
return this;
}
} }

View file

@ -53,8 +53,8 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
private void updateText() { private void updateText() {
this.staticText = "return " + this.returnName this.staticText = "return " + this.returnName
+ " to the battlefield under " + this.returnUnderControlName + " control" + " to the battlefield" + (tapped ? " tapped" : "")
+ (tapped ? " tapped" : ""); + " under " + this.returnUnderControlName + " control";
} }
@Override @Override

View file

@ -23,6 +23,8 @@ public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffe
private boolean fromExileZone; private boolean fromExileZone;
private boolean tapped; private boolean tapped;
private boolean attacking; private boolean attacking;
private String returnName = "that card";
private String returnUnderControlName = "your";
public ReturnToBattlefieldUnderYourControlTargetEffect() { public ReturnToBattlefieldUnderYourControlTargetEffect() {
this(false); this(false);
@ -50,12 +52,14 @@ public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffe
this.fromExileZone = effect.fromExileZone; this.fromExileZone = effect.fromExileZone;
this.tapped = effect.tapped; this.tapped = effect.tapped;
this.attacking = effect.attacking; this.attacking = effect.attacking;
this.returnName = effect.returnName;
this.returnUnderControlName = effect.returnUnderControlName;
updateText(); updateText();
} }
private void updateText() { private void updateText() {
this.staticText = "return that card to the battlefield under your control" this.staticText = "return " + returnName + " to the battlefield under " + returnUnderControlName + " control"
+ (tapped ? " tapped" : "") + (tapped ? " tapped" : "")
+ (tapped && attacking ? " and" : "") + (tapped && attacking ? " and" : "")
+ (attacking ? " attacking" : ""); + (attacking ? " attacking" : "");
@ -111,4 +115,11 @@ public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffe
} }
return false; return false;
} }
public ReturnToBattlefieldUnderYourControlTargetEffect withReturnNames(String returnName, String returnUnderControlName) {
this.returnName = returnName;
this.returnUnderControlName = returnUnderControlName;
updateText();
return this;
}
} }