* Artisan of Forms - Fixed that the target of the copy effect was wrongly chosen as the effect resolves.

This commit is contained in:
LevelX2 2014-11-22 11:23:06 +01:00
parent 50483fc096
commit fa788a1624
2 changed files with 24 additions and 15 deletions

View file

@ -29,6 +29,7 @@ package mage.sets.theros;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
import mage.abilities.keyword.HeroicAbility; import mage.abilities.keyword.HeroicAbility;
@ -38,6 +39,7 @@ import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.util.functions.ApplyToPermanent; import mage.util.functions.ApplyToPermanent;
/** /**
@ -57,9 +59,11 @@ public class ArtisanOfForms extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// <i>Heroic</i> - 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. // <i>Heroic</i> - 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"); 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) { public ArtisanOfForms(final ArtisanOfForms card) {

View file

@ -49,7 +49,7 @@ public class CopyPermanentEffect extends OneShotEffect {
private FilterPermanent filter; private FilterPermanent filter;
private ApplyToPermanent applier; private ApplyToPermanent applier;
private Permanent bluePrintPermanent; private Permanent bluePrintPermanent;
private boolean notTarget; private boolean useTargetOfAbility;
public CopyPermanentEffect() { public CopyPermanentEffect() {
this(new FilterCreaturePermanent()); this(new FilterCreaturePermanent());
@ -64,13 +64,13 @@ public class CopyPermanentEffect extends OneShotEffect {
} }
public CopyPermanentEffect(FilterPermanent filter, ApplyToPermanent applier) { 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); super(Outcome.Copy);
this.applier = applier; this.applier = applier;
this.filter = filter; 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"; 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.filter = effect.filter.copy();
this.applier = effect.applier; this.applier = effect.applier;
this.bluePrintPermanent = effect.bluePrintPermanent; this.bluePrintPermanent = effect.bluePrintPermanent;
this.notTarget = effect.notTarget; this.useTargetOfAbility = effect.useTargetOfAbility;
} }
@Override @Override
@ -87,16 +87,21 @@ public class CopyPermanentEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (player != null && sourcePermanent != null) { if (player != null && sourcePermanent != null) {
Target target = new TargetPermanent(filter); Permanent copyFromPermanent = null;
target.setNotTarget(notTarget); if (useTargetOfAbility) {
if (target.canChoose(source.getControllerId(), game)) { copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
player.choose(Outcome.Copy, target, source.getSourceId(), game); } else {
Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget()); Target target = new TargetPermanent(filter);
if (copyFromPermanent != null) { target.setNotTarget(true);
bluePrintPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent, source, applier); if (target.canChoose(source.getControllerId(), game)) {
return true; 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; return false;
} }