* Vesuvan Shapeshifter - Fixed that copying creatures with morph and a turn face up trigger did not work correctly (fixes #2864).

This commit is contained in:
LevelX2 2017-05-28 11:01:04 +02:00
parent 40c434f5df
commit 9c773ba3cb
3 changed files with 15 additions and 17 deletions

View file

@ -78,7 +78,7 @@ public class VesuvanShapeshifter extends CardImpl {
ability.setWorksFaceDown(true);
this.addAbility(ability);
// As Vesuvan Shapeshifter etbs, may choose another creature. If you do, until Vesuvan Shapeshifter is turned face down, it becomes a copy of that creature
// As Vesuvan Shapeshifter etbs, you may choose another creature. If you do, until Vesuvan Shapeshifter is turned face down, it becomes a copy of that creature
Effect effect = new CopyPermanentEffect(new FilterCreaturePermanent(), new VesuvanShapeShifterFaceUpApplier());
effect.setText(effectText);
ability = new EntersBattlefieldAbility(effect, true);
@ -108,6 +108,7 @@ class VesuvanShapeShifterFaceUpApplier extends ApplyToPermanent {
Effect effect = new VesuvanShapeshifterFaceDownEffect();
Ability ability = new BeginningOfUpkeepTriggeredAbility(effect, TargetController.YOU, true);
permanent.getAbilities().add(ability);
// Why is this needed?
permanent.addAbility(new MorphAbility(permanent, new ManaCostsImpl("{1}{U}")), permanent.getId(), game);
return true;
}
@ -153,6 +154,7 @@ class VesuvanShapeshifterEffect extends OneShotEffect {
if (copyFromCreature != null) {
game.copyPermanent(Duration.Custom, copyFromCreature, copyToCreature.getId(), source, new VesuvanShapeShifterFaceUpApplier());
source.getTargets().clear();
game.applyEffects(); // needed to get effects ready if copy happens in replacment and the copied abilities react of the same event (e.g. turn face up)
return true;
}
}

View file

@ -764,9 +764,9 @@ public class MorphTest extends CardTestPlayerBase {
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Vesuvan Shapeshifter");
setChoice(playerB, "Yes");
setChoice(playerB, "Brine Elemental");
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{1}{U}: Turn this face-down permanent");
setChoice(playerB, "Brine Elemental");
setStopAt(2, PhaseStep.END_TURN);

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects;
import mage.MageObject;
@ -40,24 +39,23 @@ import mage.players.Player;
*
* @author LevelX2
*/
public class AsTurnedFaceUpEffect extends ReplacementEffectImpl {
protected Effects baseEffects = new Effects();
protected boolean optional;
protected boolean optional;
public AsTurnedFaceUpEffect(Effect baseEffect, boolean optional) {
super(Duration.WhileOnBattlefield, baseEffect.getOutcome(), true);
this.baseEffects.add(baseEffect);
this.optional = optional;
this.optional = optional;
}
public AsTurnedFaceUpEffect(final AsTurnedFaceUpEffect effect) {
super(effect);
this.baseEffects = effect.baseEffects.copy();
this.optional = effect.optional;
}
public void addEffect(Effect effect) {
baseEffects.add(effect);
}
@ -71,7 +69,7 @@ public class AsTurnedFaceUpEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getTargetId().equals(source.getSourceId());
}
@Override
public boolean apply(Game game, Ability source) {
return false;
@ -85,16 +83,15 @@ public class AsTurnedFaceUpEffect extends ReplacementEffectImpl {
if (controller == null || object == null) {
return false;
}
if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append('?').toString(), source, game)) {
if (!controller.chooseUse(outcome, "Use effect of " + object.getIdName() + "?", source, game)) {
return false;
}
}
for (Effect effect: baseEffects) {
for (Effect effect : baseEffects) {
if (source.activate(game, false)) {
if (effect instanceof ContinuousEffect) {
game.addEffect((ContinuousEffect) effect, source);
}
else {
} else {
effect.apply(game, source);
}
}
@ -109,11 +106,10 @@ public class AsTurnedFaceUpEffect extends ReplacementEffectImpl {
}
return "As {this} is turned face up, " + baseEffects.getText(mode);
}
@Override
public AsTurnedFaceUpEffect copy() {
return new AsTurnedFaceUpEffect(this);
}
}