updated various cards to improve how they handle exiling with info (#7615)

This commit is contained in:
Evan Kranzler 2021-02-22 15:26:58 -05:00 committed by GitHub
parent bb0a995541
commit bd3777997e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 349 additions and 442 deletions

View file

@ -1,5 +1,6 @@
package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -7,6 +8,8 @@ import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
/**
* Created by Eric on 9/24/2016.
@ -18,22 +21,21 @@ public class MistmeadowWitchEffect extends OneShotEffect {
staticText = "Exile target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step";
}
public MistmeadowWitchEffect(final MistmeadowWitchEffect effect) {
private MistmeadowWitchEffect(final MistmeadowWitchEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
if (permanent.moveToExile(source.getSourceId(), "Mistmeadow Witch Exile", source, game)) {
//create delayed triggered ability
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
MageObject sourceObject = source.getSourceObject(game);
if (player == null || permanent == null || sourceObject == null) {
return false;
}
return false;
player.moveCardsToExile(permanent, source, game, true, CardUtil.getExileZoneId(game, source), sourceObject.getName());
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(Zone.BATTLEFIELD, "return the exiled card to the battlefield under its owner's control")), source);
return true;
}
@Override