Test that reproduces bug with PhantasmalImage and creature with LevelUpAbility

This commit is contained in:
magenoxx 2012-05-02 17:25:10 +04:00
parent f40df8a453
commit 76c6362df1

View file

@ -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()));
}
}