1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-03-29 11:43:34 -09:00

* Fixed a problem with P/T of permanets that transform back again to the original source card (fixes ).

This commit is contained in:
LevelX2 2020-01-09 08:25:29 +01:00
parent b366a83a45
commit 7ce7c2ad70
2 changed files with 35 additions and 0 deletions
Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords
Mage/src/main/java/mage/abilities/effects/common

View file

@ -356,11 +356,40 @@ public class TransformTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Ravager of the Fells", 0);
assertPermanentCount(playerA, "Huntmaster of the Fells", 1);
assertPowerToughness(playerA, "Huntmaster of the Fells", 2, 2);
assertTappedCount("Plains", true, 2);
assertTappedCount("Wastes", true, 1);
}
@Test
public void testHuntmasterTransformed() {
// Whenever this creature enters the battlefield or transforms into Huntmaster of the Fells, create a 2/2 green Wolf creature token and you gain 2 life.
// At the beginning of each upkeep, if no spells were cast last turn, transform Huntmaster of the Fells.
// Ravager of the Fells
// Whenever this creature transforms into Ravager of the Fells, it deals 2 damage to target opponent and 2 damage to up to one target creature that player controls.
// At the beginning of each upkeep, if a player cast two or more spells last turn, transform Ravager of the Fells.
addCard(Zone.HAND, playerA, "Huntmaster of the Fells"); // Creature {2}{R}{G}
addCard(Zone.HAND, playerA, "Silvercoat Lion", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Huntmaster of the Fells");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
setStopAt(4, PhaseStep.PRECOMBAT_MAIN);
execute();
assertLife(playerA, 24);
assertLife(playerB, 18);
assertPermanentCount(playerA, "Wolf", 2);
assertPermanentCount(playerA, "Silvercoat Lion", 2);
assertPermanentCount(playerA, "Ravager of the Fells", 0);
assertPermanentCount(playerA, "Huntmaster of the Fells", 1);
assertPowerToughness(playerA, "Huntmaster of the Fells", 2, 2);
}
/**
* Having cast Phantasmal Image copying my opponent's flipped Thing in the
* Ice, I was left with a 0/4 Awoken Horror.

View file

@ -4,6 +4,7 @@ package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -55,6 +56,11 @@ public class TransformSourceEffect extends OneShotEffect {
if (withoutTrigger) {
sourcePermanent.setTransformed(fromDayToNight);
} else {
if (sourcePermanent.isTransformed()) {
Card orgCard = game.getCard(source.getSourceId());
sourcePermanent.getPower().modifyBaseValue(orgCard.getPower().getValue());
sourcePermanent.getToughness().modifyBaseValue(orgCard.getToughness().getValue());
}
sourcePermanent.transform(game);
}
if (!game.isSimulation()) {