forked from External/mage
* Fixed a bug that ended continuous effects were not already removed before an aura enters the battlefield (e.g. Brago + Pentarch Ward combo) fixes #1238.
This commit is contained in:
parent
fe80d292ab
commit
0aacff4e6a
3 changed files with 63 additions and 3 deletions
|
|
@ -70,4 +70,64 @@ public class GainProtectionTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Elite Vanguard", 6, 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGainProtectionByEnchantment() {
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 5);
|
||||
// Flying
|
||||
// When Brago, King Eternal deals combat damage to a player, exile any number of target nonland permanents you control, then return those cards to the battlefield under their owner's control.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Brago, King Eternal");
|
||||
// Enchant creature
|
||||
// When Pentarch Ward enters the battlefield, draw a card.
|
||||
// As Pentarch Ward enters the battlefield, choose a color.
|
||||
// Enchanted creature has protection from the chosen color. This effect doesn't remove Pentarch Ward.
|
||||
addCard(Zone.HAND, playerB, "Pentarch Ward");// "{2}{W}"
|
||||
// Enchant creature
|
||||
// Enchanted creature gets +1/+1 and has "Whenever this creature attacks, tap target creature defending player controls."
|
||||
addCard(Zone.HAND, playerB, "Grasp of the Hieromancer");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Pentarch Ward", "Brago, King Eternal");
|
||||
setChoice(playerB, "White");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Grasp of the Hieromancer", "Brago, King Eternal");
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Pentarch Ward", 1);
|
||||
assertHandCount(playerB, "Grasp of the Hieromancer", 1);
|
||||
assertHandCount(playerB, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pentarch Ward on Brago naming white. Brago combat trigger resolves
|
||||
* blinking Pentarch Ward. Brago retains protection from white even though
|
||||
* Pentarch Ward is now exiled, making him unable to be re-enchanted by
|
||||
* Pentarch Ward.
|
||||
*/
|
||||
@Test
|
||||
public void testGainLooseProtectionByEnchantment() {
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 3);
|
||||
// Flying
|
||||
// When Brago, King Eternal deals combat damage to a player, exile any number of target nonland permanents you control, then return those cards to the battlefield under their owner's control.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Brago, King Eternal");
|
||||
// Enchant creature
|
||||
// When Pentarch Ward enters the battlefield, draw a card.
|
||||
// As Pentarch Ward enters the battlefield, choose a color.
|
||||
// Enchanted creature has protection from the chosen color. This effect doesn't remove Pentarch Ward.
|
||||
addCard(Zone.HAND, playerB, "Pentarch Ward");// "{2}{W}"
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Pentarch Ward", "Brago, King Eternal");
|
||||
setChoice(playerB, "White");
|
||||
|
||||
attack(2, playerB, "Brago, King Eternal");
|
||||
addTarget(playerB, "Pentarch Ward");
|
||||
addTarget(playerB, "Brago, King Eternal");
|
||||
|
||||
setStopAt(2, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 18);
|
||||
assertPermanentCount(playerB, "Pentarch Ward", 1);
|
||||
assertHandCount(playerB, 3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
game.applyEffects(); // So continuousEffects are removed if previous effect of the same ability did move objects that cuase continuous effects
|
||||
if (targetId == null) {
|
||||
Target target = card.getSpellAbility().getTargets().get(0);
|
||||
enchantCardInGraveyard = target instanceof TargetCardInGraveyard;
|
||||
|
|
@ -169,7 +170,6 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
PermanentCard permanent = new PermanentCard(card, card.getOwnerId(), game);
|
||||
game.getBattlefield().addPermanent(permanent);
|
||||
card.setZone(Zone.BATTLEFIELD, game);
|
||||
game.applyEffects();
|
||||
boolean entered = permanent.entersBattlefield(event.getSourceId(), game, fromZone, true);
|
||||
game.applyEffects();
|
||||
if (!entered) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class ReturnFromExileEffect extends OneShotEffect {
|
|||
case BATTLEFIELD:
|
||||
card.moveToZone(zone, source.getSourceId(), game, tapped);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " moves " + card.getName() + " to " + zone.toString().toLowerCase());
|
||||
game.informPlayers(controller.getLogName() + " moves " + card.getLogName() + " to " + zone.toString().toLowerCase());
|
||||
}
|
||||
break;
|
||||
case HAND:
|
||||
|
|
@ -111,7 +111,7 @@ public class ReturnFromExileEffect extends OneShotEffect {
|
|||
default:
|
||||
card.moveToZone(zone, source.getSourceId(), game, tapped);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " moves " + card.getName() + " to " + zone.toString().toLowerCase());
|
||||
game.informPlayers(controller.getLogName() + " moves " + card.getLogName() + " to " + zone.toString().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue