diff --git a/Mage.Sets/src/mage/sets/theros/ArtisanOfForms.java b/Mage.Sets/src/mage/sets/theros/ArtisanOfForms.java index e677b6f988..4a59843cb4 100644 --- a/Mage.Sets/src/mage/sets/theros/ArtisanOfForms.java +++ b/Mage.Sets/src/mage/sets/theros/ArtisanOfForms.java @@ -29,6 +29,7 @@ package mage.sets.theros; import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.keyword.HeroicAbility; @@ -38,6 +39,7 @@ import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; import mage.util.functions.ApplyToPermanent; /** @@ -57,9 +59,11 @@ public class ArtisanOfForms extends CardImpl { this.toughness = new MageInt(1); // Heroic - Whenever you cast a spell that targets Artisan of Forms, you may have Artisan of Forms become a copy of target creature and gain this ability. - Effect effect = new CopyPermanentEffect(new FilterCreaturePermanent(), new ArtisanOfFormsApplyToPermanent(), false); + Effect effect = new CopyPermanentEffect(new FilterCreaturePermanent(), new ArtisanOfFormsApplyToPermanent(), true); effect.setText("have {this} become a copy of target creature and gain this ability"); - this.addAbility(new HeroicAbility(effect, true)); + Ability ability = new HeroicAbility(effect, true); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); } public ArtisanOfForms(final ArtisanOfForms card) { diff --git a/Mage/src/mage/abilities/effects/common/CopyPermanentEffect.java b/Mage/src/mage/abilities/effects/common/CopyPermanentEffect.java index 6563c80aaf..7860911a2d 100644 --- a/Mage/src/mage/abilities/effects/common/CopyPermanentEffect.java +++ b/Mage/src/mage/abilities/effects/common/CopyPermanentEffect.java @@ -49,7 +49,7 @@ public class CopyPermanentEffect extends OneShotEffect { private FilterPermanent filter; private ApplyToPermanent applier; private Permanent bluePrintPermanent; - private boolean notTarget; + private boolean useTargetOfAbility; public CopyPermanentEffect() { this(new FilterCreaturePermanent()); @@ -64,13 +64,13 @@ public class CopyPermanentEffect extends OneShotEffect { } public CopyPermanentEffect(FilterPermanent filter, ApplyToPermanent applier) { - this(filter, applier, true); + this(filter, applier, false); } - public CopyPermanentEffect(FilterPermanent filter, ApplyToPermanent applier, boolean notTarget) { + public CopyPermanentEffect(FilterPermanent filter, ApplyToPermanent applier, boolean useTarget) { super(Outcome.Copy); this.applier = applier; this.filter = filter; - this.notTarget = notTarget; + this.useTargetOfAbility = useTarget; this.staticText = "You may have {this} enter the battlefield as a copy of any " + filter.getMessage() + " on the battlefield"; } @@ -79,7 +79,7 @@ public class CopyPermanentEffect extends OneShotEffect { this.filter = effect.filter.copy(); this.applier = effect.applier; this.bluePrintPermanent = effect.bluePrintPermanent; - this.notTarget = effect.notTarget; + this.useTargetOfAbility = effect.useTargetOfAbility; } @Override @@ -87,16 +87,21 @@ public class CopyPermanentEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (player != null && sourcePermanent != null) { - Target target = new TargetPermanent(filter); - target.setNotTarget(notTarget); - if (target.canChoose(source.getControllerId(), game)) { - player.choose(Outcome.Copy, target, source.getSourceId(), game); - Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget()); - if (copyFromPermanent != null) { - bluePrintPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent, source, applier); - return true; + Permanent copyFromPermanent = null; + if (useTargetOfAbility) { + copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + } else { + Target target = new TargetPermanent(filter); + target.setNotTarget(true); + if (target.canChoose(source.getControllerId(), game)) { + player.choose(Outcome.Copy, target, source.getSourceId(), game); + copyFromPermanent = game.getPermanent(target.getFirstTarget()); } } + if (copyFromPermanent != null) { + bluePrintPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent, source, applier); + } + return true; } return false; }