From 8780a6101a33232b22ec1831103cb68ec2edf7aa Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 5 Apr 2016 15:43:50 +0200 Subject: [PATCH] Fixed that transformed event was triggerd while the transforming was not applied yet (e.g. Cult of the Waxing Moon - fixes #1687). --- .../abilities/keywords/TransformTest.java | 22 ++++++++++--------- .../mage/game/permanent/PermanentImpl.java | 3 ++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java index 9edca384c1a..026a59e12b2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java @@ -155,26 +155,28 @@ public class TransformTest extends CardTestPlayerBase { } /** - * 4G - * Creature - Human Shaman - * Whenever a permanent you control transforms into a non-Human creature, put a 2/2 green Wolf creature token onto the battlefield. - * - * Reported bug: "It appears to trigger either when a non-human creature transforms OR when a creature transforms from a non-human - * into a human (as in when a werewolf flips back to the sun side), rather than when a creature transforms into a non-human, - * as is the intended function and wording of the card." + * 4G Creature - Human Shaman Whenever a permanent you control transforms + * into a non-Human creature, put a 2/2 green Wolf creature token onto the + * battlefield. + * + * Reported bug: "It appears to trigger either when a non-human creature + * transforms OR when a creature transforms from a non-human into a human + * (as in when a werewolf flips back to the sun side), rather than when a + * creature transforms into a non-human, as is the intended function and + * wording of the card." */ @Test public void testCultOfTheWaxingMoon() { - + // Whenever a permanent you control transforms into a non-Human creature, put a 2/2 green Wolf creature token onto the battlefield. addCard(Zone.BATTLEFIELD, playerA, "Cult of the Waxing Moon"); // {1}{G} - Human Werewolf // At the beginning of each upkeep, if no spells were cast last turn, transform Hinterland Logger. addCard(Zone.BATTLEFIELD, playerA, "Hinterland Logger"); - + // At the beginning of each upkeep, if a player cast two or more spells last turn, transform Timber Shredder. setStopAt(2, PhaseStep.DRAW); execute(); - + assertPermanentCount(playerA, "Cult of the Waxing Moon", 1); assertPermanentCount(playerA, "Timber Shredder", 1); // Night-side card of Hinterland Logger, Werewolf (non-human) assertPermanentCount(playerA, "Wolf", 1); // wolf token created diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 541d1caa842..fe35761b5bb 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -512,7 +512,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { if (canTransform) { if (!replaceEvent(EventType.TRANSFORM, game)) { setTransformed(!transformed); - fireEvent(EventType.TRANSFORMED, game); + game.applyEffects(); + game.addSimultaneousEvent(GameEvent.getEvent(EventType.TRANSFORMED, getId(), getControllerId())); return true; } }