Fixed that transformed event was triggerd while the transforming was not applied yet (e.g. Cult of the Waxing Moon - fixes #1687).

This commit is contained in:
LevelX2 2016-04-05 15:43:50 +02:00
parent 705daab22f
commit 8780a6101a
2 changed files with 14 additions and 11 deletions

View file

@ -155,17 +155,19 @@ public class TransformTest extends CardTestPlayerBase {
} }
/** /**
* 4G * 4G Creature - Human Shaman Whenever a permanent you control transforms
* Creature - Human Shaman * into a non-Human creature, put a 2/2 green Wolf creature token onto the
* Whenever a permanent you control transforms into a non-Human creature, put a 2/2 green Wolf creature token onto the battlefield. * battlefield.
* *
* Reported bug: "It appears to trigger either when a non-human creature transforms OR when a creature transforms from a non-human * Reported bug: "It appears to trigger either when a non-human creature
* into a human (as in when a werewolf flips back to the sun side), rather than when a creature transforms into a non-human, * transforms OR when a creature transforms from a non-human into a human
* as is the intended function and wording of the card." * (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 @Test
public void testCultOfTheWaxingMoon() { 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"); addCard(Zone.BATTLEFIELD, playerA, "Cult of the Waxing Moon");
// {1}{G} - Human Werewolf // {1}{G} - Human Werewolf
// At the beginning of each upkeep, if no spells were cast last turn, transform Hinterland Logger. // At the beginning of each upkeep, if no spells were cast last turn, transform Hinterland Logger.

View file

@ -512,7 +512,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
if (canTransform) { if (canTransform) {
if (!replaceEvent(EventType.TRANSFORM, game)) { if (!replaceEvent(EventType.TRANSFORM, game)) {
setTransformed(!transformed); setTransformed(!transformed);
fireEvent(EventType.TRANSFORMED, game); game.applyEffects();
game.addSimultaneousEvent(GameEvent.getEvent(EventType.TRANSFORMED, getId(), getControllerId()));
return true; return true;
} }
} }