Layered copy effect is now removed, if source permanent leaves battlefield.

This commit is contained in:
LevelX2 2013-03-19 01:39:37 +01:00
parent d7cab00905
commit 6c21bf7ea6

View file

@ -50,7 +50,7 @@ public class CopyEffect extends ContinuousEffectImpl<CopyEffect> {
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<CopyEffect> {
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);