From 6c21bf7ea6e2cc72596e4411b91819e5a0955f7b Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 19 Mar 2013 01:39:37 +0100 Subject: [PATCH] Layered copy effect is now removed, if source permanent leaves battlefield. --- .../mage/abilities/effects/common/CopyEffect.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Mage/src/mage/abilities/effects/common/CopyEffect.java b/Mage/src/mage/abilities/effects/common/CopyEffect.java index 1a24037cd16..45587d10ca9 100644 --- a/Mage/src/mage/abilities/effects/common/CopyEffect.java +++ b/Mage/src/mage/abilities/effects/common/CopyEffect.java @@ -50,7 +50,7 @@ public class CopyEffect extends ContinuousEffectImpl { private UUID sourceId; public CopyEffect(Permanent target, UUID sourceId) { - super(Duration.WhileOnBattlefield, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature); + super(Duration.Custom, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature); this.target = target; this.sourceId = sourceId; } @@ -99,6 +99,16 @@ public class CopyEffect extends ContinuousEffectImpl { return true; } + @Override + public boolean isInactive(Ability source, Game game) { + // The copy effect is added, if the copy takes place. If source leaves battlefield, the copy effect must cease to exist + Permanent permanent = game.getPermanent(this.sourceId); + if (permanent == null) { + return true; + } + return false; + } + @Override public CopyEffect copy() { return new CopyEffect(this);