From a845340e0d8c11bb9da3514ad2c55eae0f91999b Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 22 Apr 2015 23:06:07 +0200 Subject: [PATCH] * Morph - Fixed that token copies of morphed creatures (e.g. by Supplant Form) came into play like the morphed creature face up instead of a 2/2 nameless creatures. --- .../cards/abilities/keywords/MorphTest.java | 33 +++++++++++++++++++ .../mage/abilities/keyword/MorphAbility.java | 29 ++++++++-------- .../util/functions/CopyTokenFunction.java | 6 ++++ 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java index d3dfc96350..00eb58e0e9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java @@ -552,4 +552,37 @@ public class MorphTest extends CardTestPlayerBase { assertLife(playerB, 20); } + /** + * Supplant Form does not work correctly with morph creatures. If you bounce and copy + * a face-down morph, the created token should be a colorless 2/2, but the token created + * is instead the face-up of what the morph creature was. + */ + + @Test + public void testSupplantFormWithMorphedCreature() { + addCard(Zone.HAND, playerA, "Akroma, Angel of Fury", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + + // Return target creature to its owner's hand. You put a token onto the battlefield that's a copy of that creature + addCard(Zone.HAND, playerB, "Supplant Form", 1); + addCard(Zone.BATTLEFIELD, playerB, "Island", 6); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Fury"); + setChoice(playerA, "Yes"); // cast it face down as 2/2 creature + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Supplant Form", "face down creature"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerB, 20); + + assertGraveyardCount(playerB, "Supplant Form", 1); + assertHandCount(playerA, "Akroma, Angel of Fury", 1); + + assertPermanentCount(playerB, "Akroma, Angel of Fury", 0); + assertPermanentCount(playerB, "a creature without name", 1); + assertPowerToughness(playerB, "a creature without name", 2, 2); + + } } diff --git a/Mage/src/mage/abilities/keyword/MorphAbility.java b/Mage/src/mage/abilities/keyword/MorphAbility.java index 1ca583a76d..d6ec234738 100644 --- a/Mage/src/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/mage/abilities/keyword/MorphAbility.java @@ -29,6 +29,7 @@ package mage.abilities.keyword; import java.util.Iterator; +import mage.MageObject; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.StaticAbility; @@ -292,19 +293,21 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost return alternateCosts; } - public static void setPermanentToFaceDownCreature(Permanent permanent) { - permanent.getPower().initValue(2); - permanent.getToughness().initValue(2); - permanent.getAbilities().clear(); - permanent.getColor().setColor(new ObjectColor()); - permanent.setName(""); - permanent.getCardType().clear(); - permanent.getCardType().add(CardType.CREATURE); - permanent.getSubtype().clear(); - permanent.getSupertype().clear(); - permanent.getManaCost().clear(); -// permanent.setExpansionSetCode("KTK"); - permanent.setRarity(Rarity.NA); + public static void setPermanentToFaceDownCreature(MageObject mageObject) { + mageObject.getPower().initValue(2); + mageObject.getToughness().initValue(2); + mageObject.getAbilities().clear(); + mageObject.getColor().setColor(new ObjectColor()); + mageObject.setName(""); + mageObject.getCardType().clear(); + mageObject.getCardType().add(CardType.CREATURE); + mageObject.getSubtype().clear(); + mageObject.getSupertype().clear(); + mageObject.getManaCost().clear(); + if (mageObject instanceof Permanent) { + ((Permanent)mageObject).setExpansionSetCode(""); + ((Permanent)mageObject).setRarity(Rarity.NA); + } } } diff --git a/Mage/src/mage/util/functions/CopyTokenFunction.java b/Mage/src/mage/util/functions/CopyTokenFunction.java index fc34cdb03d..28e737801b 100644 --- a/Mage/src/mage/util/functions/CopyTokenFunction.java +++ b/Mage/src/mage/util/functions/CopyTokenFunction.java @@ -29,6 +29,7 @@ package mage.util.functions; import mage.MageObject; import mage.abilities.Ability; +import mage.abilities.keyword.MorphAbility; import mage.cards.Card; import mage.constants.CardType; import mage.game.permanent.PermanentCard; @@ -64,10 +65,15 @@ public class CopyTokenFunction implements Function { target.setOriginalCardNumber(((Token)sourceObj).getOriginalCardNumber()); target.setCopySourceCard(((PermanentToken)source).getToken().getCopySourceCard()); } else if (source instanceof PermanentCard) { + 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); + } } else { target.setOriginalExpansionSetCode(source.getExpansionSetCode()); target.setOriginalCardNumber(source.getCardNumber());