* Followed Footsteps - Fixed that the token copy was not working correctly if the target was already copying something (e.g. a Cryptoplasm).

This commit is contained in:
LevelX2 2015-09-01 17:34:21 +02:00
parent a289169708
commit 1213fd22c8
3 changed files with 52 additions and 16 deletions

View file

@ -30,8 +30,10 @@ package mage.sets.ravnica;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -40,15 +42,14 @@ import mage.constants.Rarity;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.EmptyToken;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LoneFox
*
*/
public class FollowedFootsteps extends CardImpl {
@ -99,10 +100,9 @@ class FollowedFootstepsEffect extends OneShotEffect {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
Permanent target = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
if (target != null) {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(target);
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true;
Effect effect = new PutTokenOntoBattlefieldCopyTargetEffect();
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
return effect.apply(game, source);
}
return false;
}

View file

@ -19,4 +19,40 @@ public class CryptoplasmTest extends CardTestPlayerBase {
assertLife(playerB, 20);
assertPermanentCount(playerA, "Craw Wurm", 2);
}
/**
* I have a Cryptoplasm in play, currently copying a Sigiled Paladin, and I
* enchant it with a Followed Footsteps. Next turn the aura triggers (the
* Crypto is still copying the same creature) and places a token on the
* battlefield, except the token is an untransformed Cryptoplasm, when it
* should be a Sigiled Paladin with Cryptoplasm's ability (as per rule
* 706.3), since that's what the enchanted creature currently is.
*
* 6/1/2011 If another creature becomes a copy of Cryptoplasm, it will
* become a copy of whatever Cryptoplasm is currently copying (if anything),
* plus it will have Cryptoplasm's triggered ability.
*/
@Test
public void testFollowedFootsteps() {
// First strike
// Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
addCard(Zone.BATTLEFIELD, playerA, "Sigiled Paladin", 1); // {W}{W}
addCard(Zone.BATTLEFIELD, playerB, "Island", 5);
// Enchant creature
// At the beginning of your upkeep, put a token that's a copy of enchanted creature onto the battlefield.
addCard(Zone.HAND, playerB, "Followed Footsteps", 1); // {3}{U}{U}
// 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, playerB, "Cryptoplasm", 1); // {1}{U}{U}
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Followed Footsteps");
addTarget(playerB, "Sigiled Paladin[only copy]");
setStopAt(4, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Followed Footsteps", 1);
assertPermanentCount(playerB, "Cryptoplasm", 0);
assertPermanentCount(playerB, "Sigiled Paladin", 2);
}
}

View file

@ -61,24 +61,24 @@ public class CopyTokenFunction implements Function<Token, Card> {
if (source instanceof PermanentToken) {
sourceObj = ((PermanentToken) source).getToken();
// to show the source image, the original values have to be used
target.setOriginalExpansionSetCode(((Token)sourceObj).getOriginalExpansionSetCode());
target.setOriginalCardNumber(((Token)sourceObj).getOriginalCardNumber());
target.setCopySourceCard(((PermanentToken)source).getToken().getCopySourceCard());
target.setOriginalExpansionSetCode(((Token) sourceObj).getOriginalExpansionSetCode());
target.setOriginalCardNumber(((Token) sourceObj).getOriginalCardNumber());
target.setCopySourceCard(((PermanentToken) source).getToken().getCopySourceCard());
} else if (source instanceof PermanentCard) {
if (((PermanentCard)source).isMorphed() || ((PermanentCard)source).isManifested()) {
if (((PermanentCard) source).isMorphed() || ((PermanentCard) source).isManifested()) {
MorphAbility.setPermanentToFaceDownCreature(target);
return target;
} else {
sourceObj = ((PermanentCard) source).getCard();
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
target.setOriginalCardNumber(source.getCardNumber());
target.setCopySourceCard((Card)sourceObj);
sourceObj = ((PermanentCard) source).getCard();
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
target.setOriginalCardNumber(source.getCardNumber());
target.setCopySourceCard((Card) sourceObj);
}
} else {
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
target.setOriginalCardNumber(source.getCardNumber());
if (source instanceof Card) {
target.setCopySourceCard((Card)source);
target.setCopySourceCard((Card) source);
}
}