mirror of
https://github.com/correl/mage.git
synced 2025-03-16 09:16:26 -09:00
* 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:
parent
cd2752f296
commit
a9419b4977
3 changed files with 17 additions and 7 deletions
|
@ -63,7 +63,7 @@ public class DeadeyeNavigator extends CardImpl<DeadeyeNavigator> {
|
||||||
this.addAbility(SoulbondAbility.getInstance());
|
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."
|
// 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());
|
ability.addEffect(new ReturnToBattlefieldUnderYourControlSourceEffect());
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityPairedEffect(ability, ruleText)));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityPairedEffect(ability, ruleText)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
package mage.sets.timespiral;
|
package mage.sets.timespiral;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
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.ExileSourceEffect;
|
||||||
import mage.abilities.effects.common.ExileTargetEffect;
|
import mage.abilities.effects.common.ExileTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ public class MangaraOfCorondor extends CardImpl<MangaraOfCorondor> {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// {tap}: Exile Mangara of Corondor and target permanent.
|
// {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.addEffect(new ExileTargetEffect());
|
||||||
ability.addTarget(new TargetPermanent());
|
ability.addTarget(new TargetPermanent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
|
@ -28,10 +28,11 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -42,13 +43,21 @@ import mage.players.Player;
|
||||||
*/
|
*/
|
||||||
public class ExileSourceEffect extends OneShotEffect<ExileSourceEffect> {
|
public class ExileSourceEffect extends OneShotEffect<ExileSourceEffect> {
|
||||||
|
|
||||||
|
private Zone onlyfromZone;
|
||||||
|
|
||||||
public ExileSourceEffect() {
|
public ExileSourceEffect() {
|
||||||
|
this(Zone.ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExileSourceEffect(Zone onlyFromZone) {
|
||||||
super(Outcome.Exile);
|
super(Outcome.Exile);
|
||||||
staticText = "Exile {this}";
|
staticText = "Exile {this}";
|
||||||
|
this.onlyfromZone = onlyFromZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExileSourceEffect(final ExileSourceEffect effect) {
|
public ExileSourceEffect(final ExileSourceEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.onlyfromZone = effect.onlyfromZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,12 +67,14 @@ public class ExileSourceEffect extends OneShotEffect<ExileSourceEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (!game.getState().getZone(source.getSourceId()).match(onlyfromZone)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, null);
|
return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, null);
|
||||||
} else {
|
} else {
|
||||||
// try to exile card -> is this correct in all cases? (LevelX2)
|
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
return controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, null);
|
return controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, null);
|
||||||
|
|
Loading…
Add table
Reference in a new issue