Fixed that to manifest an aura enchantments did not work correctly.

This commit is contained in:
LevelX2 2015-03-23 00:03:09 +01:00
parent b7b54cd464
commit 1b90730aeb
3 changed files with 46 additions and 2 deletions

View file

@ -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);
}
}

View file

@ -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) {

View file

@ -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<UUID> 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;
}