diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java index 97f0aca9f52..75b3caa948b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java @@ -251,5 +251,40 @@ public class ManifestTest extends CardTestPlayerBase { } } - } + } + + // Qarsi High Priest went to manifest Illusory Gains, + // but it made me choose a target for gains, then enchanted the card to that creature. + + @Test + public void testManifestAura() { + + addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2); + // {1}{B}, {T}, Sacrifice another creature: Manifest the top card of your library. + addCard(Zone.BATTLEFIELD, playerB, "Qarsi High Priest", 1); + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); + + addCard(Zone.LIBRARY, playerB, "Illusory Gains", 1); + addCard(Zone.LIBRARY, playerB, "Mountain", 1); + + skipInitShuffling(); + + activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B},{T}, Sacrifice another creature"); + addTarget(playerB, "Silvercoat Lion"); + + setStopAt(2, PhaseStep.BEGIN_COMBAT); + execute(); + + // no life gain + assertLife(playerA, 20); + assertLife(playerB, 20); + + assertGraveyardCount(playerB, "Illusory Gains", 0); + assertGraveyardCount(playerB, "Silvercoat Lion", 1); + + + // a facedown creature is on the battlefield + assertPermanentCount(playerB, "face down creature", 1); + + } } diff --git a/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java b/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java index 04352bac5a6..dd56b14b16d 100644 --- a/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java +++ b/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java @@ -87,7 +87,7 @@ public class ManifestEffect extends OneShotEffect { } } MageObjectReference objectReference= new MageObjectReference(card.getId(), card.getZoneChangeCounter() +1, game); - game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource); + game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource); controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, newSource.getSourceId(), false, true); Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index ece52408259..cd41fee396b 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -499,7 +499,13 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList appliedEffects){ ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD, appliedEffects, tapped); + if (facedown) { + this.setFaceDown(true, game); + } if (!game.replaceEvent(event)) { + if (facedown) { + this.setFaceDown(false, game); + } if (fromZone != null) { boolean removed = false; switch (fromZone) { @@ -546,6 +552,9 @@ public abstract class CardImpl extends MageObjectImpl implements Card { game.fireEvent(new ZoneChangeEvent(permanent, event.getPlayerId(), fromZone, Zone.BATTLEFIELD)); return true; } + if (facedown) { + this.setFaceDown(false, game); + } return false; }