* Mangara of Corondor - Fixed that it's own exile itself effect only works, if Mangara is still on the battlefield.

This commit is contained in:
LevelX2 2014-04-19 16:25:00 +02:00
parent cd2752f296
commit a9419b4977
3 changed files with 17 additions and 7 deletions

View file

@ -63,7 +63,7 @@ public class DeadeyeNavigator extends CardImpl<DeadeyeNavigator> {
this.addAbility(SoulbondAbility.getInstance());
// As long as Deadeye Navigator is paired with another creature, each of those creatures has "{1}{U}: Exile this creature, then return it to the battlefield under your control."
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(), new ManaCostsImpl("{1}{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(Zone.BATTLEFIELD), new ManaCostsImpl("{1}{U}"));
ability.addEffect(new ReturnToBattlefieldUnderYourControlSourceEffect());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityPairedEffect(ability, ruleText)));
}

View file

@ -28,9 +28,6 @@
package mage.sets.timespiral;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -38,6 +35,8 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.ExileSourceEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.TargetPermanent;
@ -59,7 +58,7 @@ public class MangaraOfCorondor extends CardImpl<MangaraOfCorondor> {
this.toughness = new MageInt(1);
// {tap}: Exile Mangara of Corondor and target permanent.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(Zone.BATTLEFIELD), new TapSourceCost());
ability.addEffect(new ExileTargetEffect());
ability.addTarget(new TargetPermanent());
this.addAbility(ability);

View file

@ -28,10 +28,11 @@
package mage.abilities.effects.common;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -42,13 +43,21 @@ import mage.players.Player;
*/
public class ExileSourceEffect extends OneShotEffect<ExileSourceEffect> {
private Zone onlyfromZone;
public ExileSourceEffect() {
this(Zone.ALL);
}
public ExileSourceEffect(Zone onlyFromZone) {
super(Outcome.Exile);
staticText = "Exile {this}";
this.onlyfromZone = onlyFromZone;
}
public ExileSourceEffect(final ExileSourceEffect effect) {
super(effect);
this.onlyfromZone = effect.onlyfromZone;
}
@Override
@ -58,12 +67,14 @@ public class ExileSourceEffect extends OneShotEffect<ExileSourceEffect> {
@Override
public boolean apply(Game game, Ability source) {
if (!game.getState().getZone(source.getSourceId()).match(onlyfromZone)) {
return false;
}
Permanent permanent = game.getPermanent(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (permanent != null) {
return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, null);
} else {
// try to exile card -> is this correct in all cases? (LevelX2)
Card card = game.getCard(source.getSourceId());
if (card != null) {
return controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, null);