* Possibility Storm - Fixed a bug that it was not correctly checked if the player was able to cast modal spells.

This commit is contained in:
LevelX2 2015-07-03 08:29:17 +02:00
parent 4aebcd2399
commit a33ed68c74
4 changed files with 91 additions and 28 deletions

View file

@ -27,7 +27,6 @@
*/
package org.mage.test.cards.triggers;
import mage.cards.Card;
import mage.constants.PhaseStep;
import mage.constants.Zone;
@ -39,7 +38,6 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class PossibilityStormTest extends CardTestPlayerBase {
/**
@ -56,18 +54,17 @@ public class PossibilityStormTest extends CardTestPlayerBase {
* because the filter on this site claims it makes my post look too
* "spammy". Here's a screenshot of it instead(in spoiler tag).
*/
@Test
public void TestWithZoeticCavern() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
// Whenever a player casts a spell from his or her hand, that player exiles it, then exiles cards from
// the top of his or her library until he or she exiles a card that shares a card type with it. That
// player may cast that card without paying its mana cost. Then he or she puts all cards exiled with
// Possibility Storm on the bottom of his or her library in a random order.
// Possibility Storm on the bottom of his or her library in a random order.
addCard(Zone.BATTLEFIELD, playerA, "Possibility Storm", 2);
// {T}: Add {1} to your mana pool.
// Morph {2}
// Morph {2}
addCard(Zone.HAND, playerA, "Zoetic Cavern");
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion");
@ -80,16 +77,80 @@ public class PossibilityStormTest extends CardTestPlayerBase {
execute();
assertPermanentCount(playerA, "Zoetic Cavern", 0);
boolean zoeticCavernInLibrary = false;
for (Card card: playerA.getLibrary().getCards(currentGame)) {
for (Card card : playerA.getLibrary().getCards(currentGame)) {
if (card.getName().equals("Zoetic Cavern")) {
zoeticCavernInLibrary = true;
}
}
Assert.assertEquals("Zoetic Cavern has to be in the library", true, zoeticCavernInLibrary);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
}
}
/*
* Having another Possibility Storm issue(shocking, I know). This time it
* occurred when trying to finish off my opponent that was at 3 life.
* I cast an Izzet Charm choosing draw 2 discard 2 for mode,
* responded to the Possibility Storm trigger with Remand.
* Remand's trigger revealed a Pact of Negation I chose not to cast, then the trigger for Izzet Charm
* resolved apparently revealing a Cryptic Command. It automatically moved
* the spell from exile to my library, apparently because it believed it did
* not have a target(no spells remaining on the stack). I've seen this
* happen with Mana Leaks that get revealed with no targets, but Cryptic
* being modal means it should always be able to be cast. It's worth
* mentioning that I've revealed Cryptics off triggers with other spells on
* the stack and properly been asked if I wish to cast them. Thanks!
*/
@Test
public void TestWithCrypticCommand() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
// Whenever a player casts a spell from his or her hand, that player exiles it, then exiles cards from
// the top of his or her library until he or she exiles a card that shares a card type with it. That
// player may cast that card without paying its mana cost. Then he or she puts all cards exiled with
// Possibility Storm on the bottom of his or her library in a random order.
addCard(Zone.BATTLEFIELD, playerA, "Possibility Storm", 1);
// Choose one Counter target noncreature spell unless its controller pays {2};
// or Izzet Charm deals 2 damage to target creature;
// or draw two cards, then discard two cards.
addCard(Zone.HAND, playerA, "Izzet Charm"); // {U}{R}
// Counter target spell. If that spell is countered this way, put it into its owner's hand instead of into that player's graveyard.
// Draw a card.
addCard(Zone.HAND, playerA, "Remand");
// Choose two -
// Counter target spell;
// or return target permanent to its owner's hand;
// or tap all creatures your opponents control;
// or draw a card.
addCard(Zone.LIBRARY, playerA, "Cryptic Command");
addCard(Zone.LIBRARY, playerA, "Pact of Negation");
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Izzet Charm");
setModeChoice(playerA, "3");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Remand", "Izzet Charm", "Whenever a player casts");
setChoice(playerA, "No"); // Don't play Pact of Negotiation
setChoice(playerA, "Yes"); // Play Cryptic Command
setModeChoice(playerA, "3");
setModeChoice(playerA, "4");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertExileCount(playerA, 0);
assertGraveyardCount(playerA, "Cryptic Command", 1);
assertTapped("Silvercoat Lion", true);
assertHandCount(playerA, 1); // from Cryptic Command Draw
}
}