* Fixed some exile zone names not showing the ID of the owning object.

This commit is contained in:
LevelX2 2015-07-20 19:34:58 +02:00
parent a7f893ca25
commit 8f68f2b7d5
10 changed files with 84 additions and 78 deletions

View file

@ -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);
}

View file

@ -103,7 +103,7 @@ 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;
}

View file

@ -62,7 +62,6 @@ public class BanishingLight extends CardImpl {
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));
@ -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;
}

View file

@ -53,6 +53,7 @@ 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));
}
@ -61,7 +62,6 @@ public class SuspensionField extends CardImpl {
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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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";
@ -80,8 +79,8 @@ public class ConstrictingSliver extends CardImpl {
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;
}

View file

@ -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<Card> 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,14 +130,14 @@ 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()) {
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
@ -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;
}

View file

@ -68,8 +68,6 @@ public class SistersOfStoneDeath extends CardImpl {
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())));

View file

@ -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;
}