mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
- Fixed #6806
This commit is contained in:
parent
77eadf92a5
commit
a6d03c925f
2 changed files with 8 additions and 3 deletions
|
@ -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));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue