* Fixed a problem with power/toughness setting of copied transformed permanents (fixes #5893).

This commit is contained in:
LevelX2 2019-12-23 15:35:53 +01:00
parent 7bb6757876
commit 2f998060a2
2 changed files with 52 additions and 4 deletions

View file

@ -1,4 +1,3 @@
package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
@ -362,4 +361,54 @@ public class TransformTest extends CardTestPlayerBase {
}
/**
* Having cast Phantasmal Image copying my opponent's flipped Thing in the
* Ice, I was left with a 0/4 Awoken Horror.
*
* https://github.com/magefree/mage/issues/5893
*
* The transform effect on the stack should fizzle. The card brought back
* from Exile should be a new object unless I am interpreting the rules
* incorrectly. The returned permanent uses the same GUID.
*/
@Test
public void testCopyTransformedThingInTheIce() {
// Defender
// Thing in the Ice enters the battlefield with four ice counters on it.
// Whenever you cast an instant or sorcery spell, remove an ice counter from Thing in the Ice. Then if it has no ice counters on it, transform it.
addCard(Zone.HAND, playerA, "Thing in the Ice"); // Creature {1}{U}
// Creatures you control get +1/+0 until end of turn.
addCard(Zone.HAND, playerA, "Banners Raised", 4); // Creature {R}
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
// You may have Phantasmal Image enter the battlefield as a copy of any creature
// on the battlefield, except it's an Illusion in addition to its other types and
// it has "When this creature becomes the target of a spell or ability, sacrifice it."
addCard(Zone.HAND, playerB, "Phantasmal Image", 1); // Creature {1}{U}
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Thing in the Ice");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banners Raised");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banners Raised");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banners Raised");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banners Raised");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image");
addTarget(playerB, "Awoken Horror");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertGraveyardCount(playerA, "Banners Raised", 4);
assertPermanentCount(playerA, "Thing in the Ice", 0);
assertPermanentCount(playerA, "Awoken Horror", 1);
assertPowerToughness(playerA, "Awoken Horror", 7, 8);
assertPermanentCount(playerB, "Awoken Horror", 1);
assertPowerToughness(playerB, "Awoken Horror", 7, 8);
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.keyword;
import mage.abilities.Ability;
@ -66,8 +65,8 @@ public class TransformAbility extends SimpleStaticAbility {
for (Ability ability : sourceCard.getAbilities()) {
permanent.addAbility(ability, game);
}
permanent.getPower().setValue(sourceCard.getPower().getValue());
permanent.getToughness().setValue(sourceCard.getToughness().getValue());
permanent.getPower().modifyBaseValue(sourceCard.getPower().getValue());
permanent.getToughness().modifyBaseValue(sourceCard.getToughness().getValue());
permanent.setTransformable(sourceCard.isTransformable());
}
}