mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Artisan of Forms - Fixed that the target of the copy effect was wrongly chosen as the effect resolves.
This commit is contained in:
parent
50483fc096
commit
fa788a1624
2 changed files with 24 additions and 15 deletions
|
@ -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);
|
||||
|
||||
// <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");
|
||||
this.addAbility(new HeroicAbility(effect, true));
|
||||
Ability ability = new HeroicAbility(effect, true);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public ArtisanOfForms(final ArtisanOfForms card) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue