* Cryptoplasm - Fixed that the copied creature did not have the triggered ability (fixes #1367).

This commit is contained in:
LevelX2 2015-11-19 23:28:12 +01:00
parent 684cb2d472
commit b30a6c4b15
3 changed files with 25 additions and 7 deletions

View file

@ -112,7 +112,7 @@ class TheMimeoplasmEffect extends OneShotEffect {
Cards cardsToExile = new CardsImpl(); Cards cardsToExile = new CardsImpl();
cardsToExile.add(cardToCopy); cardsToExile.add(cardToCopy);
cardsToExile.add(cardForCounters); cardsToExile.add(cardForCounters);
controller.moveCards(cardsToExile, Zone.GRAVEYARD, Zone.EXILED, source, game); controller.moveCards(cardsToExile, Zone.EXILED, source, game);
CopyEffect copyEffect = new CopyEffect(Duration.Custom, cardToCopy, source.getSourceId()); CopyEffect copyEffect = new CopyEffect(Duration.Custom, cardToCopy, source.getSourceId());
game.addEffect(copyEffect, source); game.addEffect(copyEffect, source);
permanent.addCounters(CounterType.P1P1.createInstance(cardForCounters.getPower().getValue()), game); permanent.addCounters(CounterType.P1P1.createInstance(cardForCounters.getPower().getValue()), game);

View file

@ -33,7 +33,6 @@ import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -102,8 +101,7 @@ class CryptoplasmEffect extends OneShotEffect {
public boolean apply(Game game, final Ability source) { public boolean apply(Game game, final Ability source) {
Permanent creatureToCopy = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent creatureToCopy = game.getPermanent(getTargetPointer().getFirst(game, source));
if (creatureToCopy != null) { if (creatureToCopy != null) {
CopyEffect effect = new CopyEffect(creatureToCopy, source.getSourceId()); ApplyToPermanent applier = new ApplyToPermanent() {
effect.setApplier(new ApplyToPermanent() {
@Override @Override
public Boolean apply(Game game, Permanent permanent) { public Boolean apply(Game game, Permanent permanent) {
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true); Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true);
@ -120,9 +118,8 @@ class CryptoplasmEffect extends OneShotEffect {
return true; return true;
} }
}); };
game.addEffect(effect, source); game.copyPermanent(creatureToCopy, source.getSourceId(), source, applier);
} }
return true; return true;
} }

View file

@ -114,4 +114,25 @@ public class CryptoplasmTest extends CardTestPlayerBase {
assertLife(playerB, 16); assertLife(playerB, 16);
assertLife(playerA, 25); assertLife(playerA, 25);
} }
@Test
public void testTransformMultipleTime() {
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
addCard(Zone.BATTLEFIELD, playerA, "Cryptoplasm", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // 6/4
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm", 1); // 6/4
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptoplasm");
addTarget(playerA, "Silvercoat Lion");
addTarget(playerA, "Craw Wurm");
setStopAt(5, PhaseStep.PRECOMBAT_MAIN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Silvercoat Lion", 0);
assertPermanentCount(playerA, "Craw Wurm", 1);
}
} }