diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java b/Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java index 1748583e0d..d51cdecde7 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java @@ -27,7 +27,7 @@ */ package mage.sets.avacynrestored; -import mage.constants.*; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; @@ -40,17 +40,22 @@ import mage.abilities.effects.common.ImprintTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; - /** * * @author noxx - + * */ public class DarkImpostor extends CardImpl { @@ -65,7 +70,7 @@ public class DarkImpostor extends CardImpl { // {4}{B}{B}: Exile target creature and put a +1/+1 counter on Dark Impostor.\ Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ImprintTargetEffect(), new ManaCostsImpl("{4}{B}{B}")); - ability.addEffect(new ExileTargetEffect(null, "Dark Impostor")); + ability.addEffect(new ExileTargetEffect(null, this.getIdName())); ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); @@ -99,10 +104,10 @@ class DarkImpostorContinuousEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent perm = game.getPermanent(source.getSourceId()); if (perm != null) { - for (UUID imprintedId: perm.getImprinted()) { + for (UUID imprintedId : perm.getImprinted()) { Card card = game.getCard(imprintedId); if (card != null) { - for (Ability ability: card.getAbilities()) { + for (Ability ability : card.getAbilities()) { if (ability instanceof ActivatedAbility) { perm.addAbility(ability, source.getSourceId(), game); } @@ -118,4 +123,4 @@ class DarkImpostorContinuousEffect extends ContinuousEffectImpl { return new DarkImpostorContinuousEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/Silkwrap.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/Silkwrap.java index 450283ec59..9af141380e 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/Silkwrap.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/Silkwrap.java @@ -53,7 +53,7 @@ import mage.util.CardUtil; * @author jeffwadsworth */ public class Silkwrap extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost 3 or less an opponent controls"); static { @@ -69,8 +69,8 @@ public class Silkwrap extends CardImpl { Ability ability = new EntersBattlefieldTriggeredAbility(new SilkwrapEffect()); ability.addTarget(new TargetPermanent(filter)); ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility())); - this.addAbility(ability); - + this.addAbility(ability); + } public Silkwrap(final Silkwrap card) { @@ -103,8 +103,8 @@ class SilkwrapEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()).apply(game, source); } return false; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/BanishingLight.java b/Mage.Sets/src/mage/sets/journeyintonyx/BanishingLight.java index feaed29eae..392e925c02 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/BanishingLight.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/BanishingLight.java @@ -53,21 +53,20 @@ import mage.util.CardUtil; public class BanishingLight extends CardImpl { private final static FilterNonlandPermanent filter = new FilterNonlandPermanent("nonland permanent an opponent controls"); - + static { filter.add(new ControllerPredicate(TargetController.OPPONENT)); - } - + } + public BanishingLight(UUID ownerId) { super(ownerId, 5, "Banishing Light", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); this.expansionSetCode = "JOU"; - // When Banishing Light enters the battlefield, exile target nonland permanent an opponent controls until Banishing Light leaves the battlefield. Ability ability = new EntersBattlefieldTriggeredAbility(new BanishingLightExileEffect()); ability.addTarget(new TargetPermanent(filter)); ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility())); - this.addAbility(ability); + this.addAbility(ability); } public BanishingLight(final BanishingLight card) { @@ -102,7 +101,7 @@ class BanishingLightExileEffect extends OneShotEffect { // If Banishing Light leaves the battlefield before its triggered ability resolves, // the target won't be exiled. if (permanent != null) { - return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()).apply(game, source); } return false; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/SuspensionField.java b/Mage.Sets/src/mage/sets/khansoftarkir/SuspensionField.java index 419d131632..087631b2a7 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/SuspensionField.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/SuspensionField.java @@ -53,15 +53,15 @@ import mage.util.CardUtil; public class SuspensionField extends CardImpl { private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with toughness 3 or greater"); + static { filter.add(new ToughnessPredicate(ComparisonType.GreaterThan, 2)); - } - + } + public SuspensionField(UUID ownerId) { super(ownerId, 25, "Suspension Field", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); this.expansionSetCode = "KTK"; - // When Suspension Field enters the battlefield, you may exile target creature with toughness 3 or greater until Suspension Field leaves the battlefield. Ability ability = new EntersBattlefieldTriggeredAbility(new SuspensionFieldExileEffect(), true); ability.addTarget(new TargetCreaturePermanent(filter)); @@ -101,7 +101,7 @@ class SuspensionFieldExileEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); // If Suspension Field leaves the battlefield before its triggered ability resolves, the target won't be exiled. if (sourcePermanent != null) { - return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), sourcePermanent.getName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), sourcePermanent.getIdName()).apply(game, source); } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2014/BanisherPriest.java b/Mage.Sets/src/mage/sets/magic2014/BanisherPriest.java index 6f3baeec94..f907e0226d 100644 --- a/Mage.Sets/src/mage/sets/magic2014/BanisherPriest.java +++ b/Mage.Sets/src/mage/sets/magic2014/BanisherPriest.java @@ -54,6 +54,7 @@ import mage.util.CardUtil; public class BanisherPriest extends CardImpl { private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls"); + static { filter.add(new ControllerPredicate(TargetController.OPPONENT)); } @@ -106,7 +107,7 @@ class BanisherPriestExileEffect extends OneShotEffect { // If Banisher Priest leaves the battlefield before its triggered ability resolves, // the target creature won't be exiled. if (permanent != null) { - return new ExileTargetEffect(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), permanent.getName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), permanent.getIdName()).apply(game, source); } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java b/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java index 187439dba2..1838807ab8 100644 --- a/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java +++ b/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java @@ -146,7 +146,7 @@ class ColossalWhaleExileEffect extends OneShotEffect { // If Whale leaves the battlefield before its triggered ability resolves, // the target creature won't be exiled. if (permanent != null) { - return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()).apply(game, source); } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2015/ConstrictingSliver.java b/Mage.Sets/src/mage/sets/magic2015/ConstrictingSliver.java index 5e2e5682c9..e16e2afde9 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ConstrictingSliver.java +++ b/Mage.Sets/src/mage/sets/magic2015/ConstrictingSliver.java @@ -64,7 +64,6 @@ public class ConstrictingSliver extends CardImpl { filterTarget.add(new ControllerPredicate(TargetController.OPPONENT)); } - public ConstrictingSliver(UUID ownerId) { super(ownerId, 7, "Constricting Sliver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{W}"); this.expansionSetCode = "M15"; @@ -73,15 +72,15 @@ public class ConstrictingSliver extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); - // Sliver creatures you control have "When this creature enters the battlefield, you may exile target creature an opponent controls + // Sliver creatures you control have "When this creature enters the battlefield, you may exile target creature an opponent controls // until this creature leaves the battlefield." Ability ability = new EntersBattlefieldTriggeredAbility(new ConstrictingSliverExileEffect(), true); ability.addTarget(new TargetCreaturePermanent(filterTarget)); ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Sliver","Sliver creatures"), - "Sliver creatures you control have \"When this creature enters the battlefield, you may exile target creature an opponent controls until this creature leaves the battlefield.\""))); + Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Sliver", "Sliver creatures"), + "Sliver creatures you control have \"When this creature enters the battlefield, you may exile target creature an opponent controls until this creature leaves the battlefield.\""))); } @@ -117,7 +116,7 @@ class ConstrictingSliverExileEffect extends OneShotEffect { // If the creature leaves the battlefield before its triggered ability resolves, // the target creature won't be exiled. if (permanent != null) { - return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()).apply(game, source); } return false; } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java b/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java index 38deecc35f..5b5a30d803 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java @@ -75,12 +75,12 @@ public class KarnLiberated extends CardImpl { this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(6)), false)); // +4: Target player exiles a card from his or her hand. - LoyaltyAbility ability1 = new LoyaltyAbility(new ExileFromZoneTargetEffect(Zone.HAND, exileId, "Karn Liberated", new FilterCard()), 4); + LoyaltyAbility ability1 = new LoyaltyAbility(new ExileFromZoneTargetEffect(Zone.HAND, exileId, this.getIdName(), new FilterCard()), 4); ability1.addTarget(new TargetPlayer()); this.addAbility(ability1); // -3: Exile target permanent. - LoyaltyAbility ability2 = new LoyaltyAbility(new ExileTargetEffect(exileId, "Karn Liberated"), -3); + LoyaltyAbility ability2 = new LoyaltyAbility(new ExileTargetEffect(exileId, this.getIdName()), -3); ability2.addTarget(new TargetPermanent()); this.addAbility(ability2); @@ -120,9 +120,9 @@ class KarnLiberatedEffect extends OneShotEffect { return false; } List cards = new ArrayList<>(); - for (ExileZone zone: game.getExile().getExileZones()) { + for (ExileZone zone : game.getExile().getExileZones()) { if (zone.getId().equals(exileId)) { - for (Card card: zone.getCards(game)) { + for (Card card : zone.getCards(game)) { if (!card.getSubtype().contains("Aura") && CardUtil.isPermanentCard(card)) { cards.add(card); } @@ -130,15 +130,15 @@ class KarnLiberatedEffect extends OneShotEffect { } } game.getState().clear(); - for (Card card: game.getCards()) { + for (Card card : game.getCards()) { game.getState().addCard(card); } - for (Player player: game.getPlayers().values()) { + for (Player player : game.getPlayers().values()) { player.getGraveyard().clear(); player.getHand().clear(); player.getLibrary().clear(); - for (Card card: game.getCards()) { - if (card.getOwnerId().equals(player.getId()) && !card.isCopy() // no copies + for (Card card : game.getCards()) { + if (card.getOwnerId().equals(player.getId()) && !card.isCopy() // no copies && !player.getSideboard().contains(card.getId()) && !cards.contains(card)) { // not the exiled cards player.getLibrary().putOnTop(card, game); @@ -146,8 +146,8 @@ class KarnLiberatedEffect extends OneShotEffect { } player.init(game); } - for (Card card: cards) { - if ( CardUtil.isPermanentCard(card) && !card.getSubtype().contains("Aura") ) { + for (Card card : cards) { + if (CardUtil.isPermanentCard(card) && !card.getSubtype().contains("Aura")) { game.getExile().add(exileId, sourceObject.getIdName(), card); } } @@ -215,10 +215,10 @@ class KarnLiberatedDelayedEffect extends OneShotEffect { if (exile != null) { Cards cards = new CardsImpl(); // needed because putOntoTheBattlefield removes from exile cards.addAll(exile); - for (Card card: cards.getCards(game)) { + for (Card card : cards.getCards(game)) { card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId()); Permanent permanent = game.getPermanent(card.getId()); - ((PermanentImpl)permanent).removeSummoningSickness(); + ((PermanentImpl) permanent).removeSummoningSickness(); } return true; } diff --git a/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java b/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java index 1c74a4d7b7..200188ec09 100644 --- a/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java +++ b/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java @@ -59,16 +59,14 @@ import mage.target.common.TargetCreaturePermanent; * @author jeffwadsworth */ public class SistersOfStoneDeath extends CardImpl { - + private UUID exileId = UUID.randomUUID(); - + public SistersOfStoneDeath(UUID ownerId) { super(ownerId, 231, "Sisters of Stone Death", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{G}{G}"); this.expansionSetCode = "RAV"; this.supertype.add("Legendary"); this.subtype.add("Gorgon"); - - this.power = new MageInt(7); this.toughness = new MageInt(5); @@ -79,7 +77,7 @@ public class SistersOfStoneDeath extends CardImpl { this.addAbility(ability); // {B}{G}: Exile target creature blocking or blocked by Sisters of Stone Death. - Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(exileId, "Sisters Of Stone Death"), new ManaCostsImpl("{B}{G}")); + Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(exileId, this.getIdName()), new ManaCostsImpl("{B}{G}")); FilterCreaturePermanent filter = new FilterCreaturePermanent("creature blocking or blocked by Sisters of Stone Death"); filter.add(Predicates.or(new BlockedByIdPredicate(this.getId()), new BlockingAttackerIdPredicate(this.getId()))); @@ -88,13 +86,13 @@ public class SistersOfStoneDeath extends CardImpl { // {2}{B}: Put a creature card exiled with Sisters of Stone Death onto the battlefield under your control. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SistersOfStoneDeathEffect(exileId), new ManaCostsImpl("{2}{B}"))); - + } - + public SistersOfStoneDeath(final SistersOfStoneDeath card) { super(card); } - + @Override public SistersOfStoneDeath copy() { return new SistersOfStoneDeath(this); @@ -102,20 +100,20 @@ public class SistersOfStoneDeath extends CardImpl { } class SistersOfStoneDeathEffect extends OneShotEffect { - + private UUID exileId; - + public SistersOfStoneDeathEffect(UUID exileId) { super(Outcome.PutCreatureInPlay); this.exileId = exileId; staticText = "Put a creature card exiled with {this} onto the battlefield under your control"; } - + public SistersOfStoneDeathEffect(final SistersOfStoneDeathEffect effect) { super(effect); this.exileId = effect.exileId; } - + @Override public boolean apply(Game game, Ability source) { CardsImpl cardsInExile = new CardsImpl(); @@ -137,7 +135,7 @@ class SistersOfStoneDeathEffect extends OneShotEffect { } return false; } - + @Override public SistersOfStoneDeathEffect copy() { return new SistersOfStoneDeathEffect(this); diff --git a/Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java b/Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java index a5d3a0e024..2a8dd53f01 100644 --- a/Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java +++ b/Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java @@ -52,33 +52,37 @@ import mage.target.common.TargetCreaturePermanent; import mage.util.CardUtil; /** - * If the land Chained to the Rocks is enchanting stops being a Mountain or another player - * gains control of it, Chained to the Rocks will be put into its owner's graveyard when - * state-based actions are performed. + * If the land Chained to the Rocks is enchanting stops being a Mountain or + * another player gains control of it, Chained to the Rocks will be put into its + * owner's graveyard when state-based actions are performed. * - * Chained to the Rocks's ability causes a zone change with a duration, a style of ability - * introduced in Magic 2014 that's somewhat reminiscent of older cards like Oblivion Ring. - * However, unlike Oblivion Ring, cards like Chained to the Rocks have a single ability - * that creates two one-shot effects: one that exiles the creature when the ability resolves, - * and another that returns the exiled card to the battlefield immediately after Chained to - * the Rocks leaves the battlefield. + * Chained to the Rocks's ability causes a zone change with a duration, a style + * of ability introduced in Magic 2014 that's somewhat reminiscent of older + * cards like Oblivion Ring. However, unlike Oblivion Ring, cards like Chained + * to the Rocks have a single ability that creates two one-shot effects: one + * that exiles the creature when the ability resolves, and another that returns + * the exiled card to the battlefield immediately after Chained to the Rocks + * leaves the battlefield. * - * If Chained to the Rocks leaves the battlefield before its triggered ability resolves, - * the target creature won't be exiled. + * If Chained to the Rocks leaves the battlefield before its triggered ability + * resolves, the target creature won't be exiled. * - * Auras attached to the exiled creature will be put into their owners' graveyards (unless - * they have bestow). Equipment attached to the exiled creature will become unattached and - * remain on the battlefield. Any counters on the exiled creature will cease to exist. + * Auras attached to the exiled creature will be put into their owners' + * graveyards (unless they have bestow). Equipment attached to the exiled + * creature will become unattached and remain on the battlefield. Any counters + * on the exiled creature will cease to exist. * - * If a creature token is exiled, it ceases to exist. It won't be returned to the battlefield. + * If a creature token is exiled, it ceases to exist. It won't be returned to + * the battlefield. * - * The exiled card returns to the battlefield immediately after Chained to the Rocks leaves - * the battlefield. Nothing happens between the two events, including state-based actions. + * The exiled card returns to the battlefield immediately after Chained to the + * Rocks leaves the battlefield. Nothing happens between the two events, + * including state-based actions. * - * In a multiplayer game, if Chained to the Rocks's owner leaves the game, the exiled card - * will return to the battlefield. Because the one-shot effect that returns the card isn't - * an ability that goes on the stack, it won't cease to exist along with the leaving player's - * spells and abilities on the stack. + * In a multiplayer game, if Chained to the Rocks's owner leaves the game, the + * exiled card will return to the battlefield. Because the one-shot effect that + * returns the card isn't an ability that goes on the stack, it won't cease to + * exist along with the leaving player's spells and abilities on the stack. * * @author LevelX2 */ @@ -86,6 +90,7 @@ public class ChainedToTheRocks extends CardImpl { private static final FilterControlledLandPermanent filter = new FilterControlledLandPermanent("Mountain you control"); private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("creature an opponent controls"); + static { filter.add(new SubtypePredicate("Mountain")); filterTarget.add(new ControllerPredicate(TargetController.OPPONENT)); @@ -96,7 +101,6 @@ public class ChainedToTheRocks extends CardImpl { this.expansionSetCode = "THS"; this.subtype.add("Aura"); - // Enchant Mountain you control TargetPermanent auraTarget = new TargetPermanent(filter); this.getSpellAbility().addTarget(auraTarget); @@ -144,7 +148,7 @@ class ChainedToTheRocksEffect extends OneShotEffect { // If Chained to the Rocks leaves the battlefield before its triggered ability resolves, // the target creature won't be exiled. if (permanent != null) { - return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()).apply(game, source); } return false; }