* Jace, Unraveler of Secrets - Fixed that the emblem still doesn't counter spells (fixes #1855).

This commit is contained in:
LevelX2 2016-04-14 17:49:08 +02:00
parent d00f1adf38
commit 13d9a56b7a
2 changed files with 40 additions and 3 deletions

View file

@ -27,6 +27,7 @@
*/ */
package mage.sets.shadowsoverinnistrad; package mage.sets.shadowsoverinnistrad;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
@ -41,9 +42,12 @@ import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.game.Game; import mage.game.Game;
import mage.game.command.Emblem; import mage.game.command.Emblem;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.SpellsCastWatcher; import mage.watchers.common.SpellsCastWatcher;
@ -106,7 +110,7 @@ class JaceUnravelerOfSecretsEmblem extends Emblem {
class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredAbility { class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredAbility {
public JaceUnravelerOfSecretsTriggeredAbility(Effect effect, boolean optional) { public JaceUnravelerOfSecretsTriggeredAbility(Effect effect, boolean optional) {
super(effect, optional); super(Zone.COMMAND, effect, new FilterSpell(), optional);
} }
public JaceUnravelerOfSecretsTriggeredAbility(SpellCastOpponentTriggeredAbility ability) { public JaceUnravelerOfSecretsTriggeredAbility(SpellCastOpponentTriggeredAbility ability) {
@ -115,7 +119,7 @@ class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredA
@Override @Override
public SpellCastOpponentTriggeredAbility copy() { public SpellCastOpponentTriggeredAbility copy() {
return super.copy(); return new JaceUnravelerOfSecretsTriggeredAbility(this);
} }
@Override @Override
@ -123,7 +127,8 @@ class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredA
if (super.checkTrigger(event, game)) { if (super.checkTrigger(event, game)) {
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName()); SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
if (watcher != null) { if (watcher != null) {
if (watcher.getSpellsCastThisTurn(event.getPlayerId()) == null) { List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
if (spells != null && spells.size() == 1) {
for (Effect effect : getEffects()) { for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId())); effect.setTargetPointer(new FixedTarget(event.getTargetId()));
} }

View file

@ -99,4 +99,36 @@ public class JaceTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Jace, Telepath Unbound", 1); 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);
}
} }