diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java index 9f737ee59e6..d0d4961b7ab 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java @@ -1,6 +1,10 @@ package org.mage.test.cards.copy; +import junit.framework.Assert; import mage.Constants; +import mage.abilities.keyword.IndestructibleAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.game.permanent.Permanent; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -49,4 +53,45 @@ public class PhantasmalImageTest extends CardTestPlayerBase { assertLife(playerB, 17); } + /** + * Tests that copy won't have level up counters and will have zero level. + */ + @Test + public void testCopyCreatureWithLevelUpAbility() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Transcendent Master"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 12); + + addCard(Constants.Zone.BATTLEFIELD, playerB, "Island", 2); + addCard(Constants.Zone.HAND, playerB, "Phantasmal Image"); + + + for (int i = 0; i < 12; i++) { + activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Level up {1}"); + } + + castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image"); + + + setStopAt(2, Constants.PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Transcendent Master", 1); + assertPermanentCount(playerB, "Transcendent Master", 1); + + Permanent master = getPermanent("Transcendent Master", playerA.getId()); + Permanent masterCopied = getPermanent("Transcendent Master", playerB.getId()); + + // Original master should be upgraded to 3rd level + Assert.assertEquals("Power different", 9, master.getPower().getValue()); + Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); + Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance())); + Assert.assertTrue(master.getAbilities().contains(IndestructibleAbility.getInstance())); + + // But copied one should not + Assert.assertEquals("Power different", 3, masterCopied.getPower().getValue()); + Assert.assertEquals("Toughness different", 3, masterCopied.getToughness().getValue()); + Assert.assertFalse(masterCopied.getAbilities().contains(LifelinkAbility.getInstance())); + Assert.assertFalse(masterCopied.getAbilities().contains(IndestructibleAbility.getInstance())); + } + }