mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Refactor - moved MistmeadowWeitchEffect to shared area
This commit is contained in:
parent
37f01e88f3
commit
08ac7ab342
3 changed files with 50 additions and 39 deletions
|
|
@ -0,0 +1,46 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* Created by Eric on 9/24/2016.
|
||||
*/
|
||||
public class MistmeadowWitchEffect extends OneShotEffect {
|
||||
|
||||
public MistmeadowWitchEffect() {
|
||||
super(Outcome.Detriment);
|
||||
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) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
if (permanent.moveToExile(source.getSourceId(), "Mistmeadow Witch Exile", source.getSourceId(), game)) {
|
||||
//create delayed triggered ability
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MistmeadowWitchEffect copy() {
|
||||
return new MistmeadowWitchEffect(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue