This commit is contained in:
jeffwadsworth 2020-07-09 11:10:28 -05:00
parent 77eadf92a5
commit a6d03c925f
2 changed files with 8 additions and 3 deletions

View file

@ -30,7 +30,7 @@ public final class Flicker extends CardImpl {
// Exile target nontoken permanent, then return it to the battlefield under its owner's control.
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new ExileTargetForSourceEffect());
this.getSpellAbility().addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect());
this.getSpellAbility().addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true));
}

View file

@ -8,6 +8,7 @@ import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
* @author nantuko
@ -19,7 +20,7 @@ public class ControlEnchantedEffect extends ContinuousEffectImpl {
}
public ControlEnchantedEffect(String targetDescription) {
super(Duration.WhileOnBattlefield, Outcome.GainControl);
super(Duration.WhileOnBattlefield, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
staticText = "You control enchanted " + targetDescription;
}
@ -35,8 +36,10 @@ public class ControlEnchantedEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
Player controllerOfEnchantment = game.getPlayer(source.getControllerId());
if (enchantment != null
&& enchantment.getAttachedTo() != null) {
&& enchantment.getAttachedTo() != null
&& controllerOfEnchantment != null) {
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
if (permanent != null) {
switch (layer) {
@ -50,6 +53,8 @@ public class ControlEnchantedEffect extends ContinuousEffectImpl {
break;
}
return true;
} else { //remove effect if the aura or attachedTo permanent or controller of the enchantment is null
discard();
}
}
return false;