mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Containment Priest - Fixed that it also did exile permanents that entered the battlefield transformed and the transformed permanent was no creature (e.g. flipwalker).
This commit is contained in:
parent
2ec404a2e4
commit
53f48a6602
2 changed files with 35 additions and 0 deletions
|
@ -33,6 +33,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
@ -122,6 +123,10 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId());
|
||||
if (entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) {
|
||||
card = card.getSecondCardFace();
|
||||
}
|
||||
if (card.getCardType().contains(CardType.CREATURE)) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get("CreatureWasCast");
|
||||
if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) {
|
||||
|
|
|
@ -69,4 +69,34 @@ public class JaceTest extends CardTestPlayerBase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* I know it's been a bit a rules question recently but I believe flip
|
||||
* planeswalkers shouldn't be exiled by Containment priest when flipping as
|
||||
* happens when using xmage (at least with Jace).
|
||||
*/
|
||||
@Test
|
||||
public void testContainmentPriestWithFlipPlaneswalker() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Zone.GRAVEYARD, playerA, "Mountain", 4);
|
||||
|
||||
// {T}: Draw a card, then discard a card. If there are five or more cards in your graveyard,
|
||||
// exile Jace, Vryn's Prodigy, then return him to the battefield transformed under his owner's control.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Jace, Vryn's Prodigy", 1); // {2}{R} - 3/2
|
||||
addCard(Zone.HAND, playerA, "Pillarfield Ox", 1);
|
||||
|
||||
// Flash
|
||||
// If a nontoken creature would enter the battlefield and it wasn't cast, exile it instead.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Containment Priest", 1); // {2}{U}{U}
|
||||
|
||||
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card");
|
||||
setChoice(playerA, "Pillarfield Ox");
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Pillarfield Ox", 1);
|
||||
assertExileCount("Jace, Vryn's Prodigy", 0);
|
||||
assertPermanentCount(playerA, "Jace, Telepath Unbound", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue