From 13d9a56b7a721061483adcdb73fb5c06babaa97a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 14 Apr 2016 17:49:08 +0200 Subject: [PATCH] * Jace, Unraveler of Secrets - Fixed that the emblem still doesn't counter spells (fixes #1855). --- .../JaceUnravelerOfSecrets.java | 11 +++++-- .../test/cards/planeswalker/JaceTest.java | 32 +++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/JaceUnravelerOfSecrets.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/JaceUnravelerOfSecrets.java index 40bd6ee291..50906dad00 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/JaceUnravelerOfSecrets.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/JaceUnravelerOfSecrets.java @@ -27,6 +27,7 @@ */ package mage.sets.shadowsoverinnistrad; +import java.util.List; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; @@ -41,9 +42,12 @@ import mage.abilities.effects.keyword.ScryEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterSpell; import mage.game.Game; import mage.game.command.Emblem; import mage.game.events.GameEvent; +import mage.game.stack.Spell; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; import mage.watchers.common.SpellsCastWatcher; @@ -106,7 +110,7 @@ class JaceUnravelerOfSecretsEmblem extends Emblem { class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredAbility { public JaceUnravelerOfSecretsTriggeredAbility(Effect effect, boolean optional) { - super(effect, optional); + super(Zone.COMMAND, effect, new FilterSpell(), optional); } public JaceUnravelerOfSecretsTriggeredAbility(SpellCastOpponentTriggeredAbility ability) { @@ -115,7 +119,7 @@ class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredA @Override public SpellCastOpponentTriggeredAbility copy() { - return super.copy(); + return new JaceUnravelerOfSecretsTriggeredAbility(this); } @Override @@ -123,7 +127,8 @@ class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredA if (super.checkTrigger(event, game)) { SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName()); if (watcher != null) { - if (watcher.getSpellsCastThisTurn(event.getPlayerId()) == null) { + List spells = watcher.getSpellsCastThisTurn(event.getPlayerId()); + if (spells != null && spells.size() == 1) { for (Effect effect : getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java index 94f59f7f4c..879cec9f4f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java @@ -99,4 +99,36 @@ public class JaceTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Jace, Telepath Unbound", 1); } + + /** + * 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 testJaceUnravelerOfSecretsEmblem() { + // +1: Scry 1, then draw a card. + // -2: Return target creature to its owner's hand. + // -8: You get an emblem with "Whenever an opponent casts his or her first spell each turn, counter that spell." + addCard(Zone.BATTLEFIELD, playerA, "Jace, Unraveler of Secrets", 1); // starts with 5 Loyality counters + addCounters(1, PhaseStep.UPKEEP, playerA, "Jace, Unraveler of Secrets", CounterType.LOYALTY, 5); + + addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); + addCard(Zone.HAND, playerB, "Perimeter Captain", 2); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-8: You get an emblem"); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Perimeter Captain"); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Perimeter Captain"); + + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertEmblemCount(playerA, 1); + + assertPermanentCount(playerB, "Perimeter Captain", 1); + assertGraveyardCount(playerB, "Perimeter Captain", 1); + + } + }