mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
* Fixed the handling of comparing characteristics concerning split cards (related to the recent rule changes).
This commit is contained in:
parent
4b421fa722
commit
0b827b239c
6 changed files with 67 additions and 31 deletions
|
|
@ -73,18 +73,48 @@ public class TransmuteTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void searchSplittedCardOneManaCmcSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
addCard(Zone.HAND, playerA, "Dizzy Spell");
|
||||
// Target creature gets -3/-0 until end of turn.
|
||||
// Transmute {1}{U}{U} ({1}{U}{U}, Discard this card: Search your library for a card with the same converted mana cost as this card, reveal it, and put it into your hand. Then shuffle your library. Transmute only as a sorcery.)
|
||||
addCard(Zone.HAND, playerA, "Dizzy Spell"); // Instant {U}
|
||||
|
||||
// Wear {1}{R}
|
||||
// Destroy target artifact.
|
||||
// Tear {W}
|
||||
// Destroy target enchantment.
|
||||
addCard(Zone.LIBRARY, playerA, "Wear // Tear");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{U}");
|
||||
setChoice(playerA, "Wear // Tear");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Dizzy Spell", 1);
|
||||
assertHandCount(playerA, "Wear", 1); // Filter search can only search for one side of a split card
|
||||
assertHandCount(playerA, "Tear", 1); // Filter search can only search for one side of a split card
|
||||
assertHandCount(playerA, "Wear // Tear", 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void searchSplittedCardThreeManaCmcSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
// Counter target spell unless its controller discards his or her hand.
|
||||
// Transmute {1}{U}{B}
|
||||
addCard(Zone.HAND, playerA, "Perplex"); // Instant {1}{U}{B}
|
||||
|
||||
// Wear {1}{R}
|
||||
// Destroy target artifact.
|
||||
// Tear {W}
|
||||
// Destroy target enchantment.
|
||||
addCard(Zone.LIBRARY, playerA, "Wear // Tear");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{B}");
|
||||
setChoice(playerA, "Wear // Tear");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Perplex", 1);
|
||||
assertHandCount(playerA, "Wear // Tear", 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ public class SplitCardCmcTest extends CardTestPlayerBase {
|
|||
public void testSplitCardCmcInHand() {
|
||||
// Total CMC of Failure // Comply is 3, so should be exiled by Transgress the Mind.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
// Devoid
|
||||
// Target player reveals his or her hand. You may choose a card from it with converted mana cost 3 or greater and exile that card.
|
||||
addCard(Zone.HAND, playerA, "Transgress the Mind");
|
||||
addCard(Zone.HAND, playerB, "Failure // Comply");
|
||||
|
||||
|
|
@ -42,11 +44,17 @@ public class SplitCardCmcTest extends CardTestPlayerBase {
|
|||
public void testSplitCardCmcOnStack() {
|
||||
// Counterbalance revealing Wear // Tear counters a spell with converted mana cost 3, but not 1 or 2.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
addCard(Zone.HAND, playerA, "Typhoid Rats");
|
||||
addCard(Zone.HAND, playerA, "Typhoid Rats"); // Creature 1/1 {B}
|
||||
|
||||
// Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell
|
||||
// if it has the same converted mana cost as the revealed card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Counterbalance");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
|
||||
// Wear {1}{R}
|
||||
// Destroy target artifact.
|
||||
// Tear {W}
|
||||
// Destroy target enchantment.
|
||||
addCard(Zone.LIBRARY, playerB, "Wear // Tear"); // CMC now 3
|
||||
skipInitShuffling(); // so the set to top card stays at top
|
||||
|
||||
|
|
|
|||
|
|
@ -65,12 +65,16 @@ public class DuskDawnTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerA, "Dusk // Dawn", 0);
|
||||
}
|
||||
|
||||
// Fail to cast Dawn (Aftermath part) from hand
|
||||
@Test
|
||||
public void testCastDawnFail() {
|
||||
// Fail to cast dawn from hand
|
||||
// Dusk {2}{W}{W}
|
||||
// Destroy all creatures with power 3 or greater.
|
||||
// Dawn {3}{W}{W}
|
||||
// Return all creature cards with power less than or equal to 2 from your graveyard to your hand.
|
||||
addCard(Zone.HAND, playerA, "Dusk // Dawn");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
|
||||
addCard(Zone.GRAVEYARD, playerA, "Devoted Hero");
|
||||
addCard(Zone.GRAVEYARD, playerA, "Devoted Hero"); // Creature 1/2 {W}
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dawn");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
|
|
|
|||
|
|
@ -805,9 +805,19 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertHandCount(Player player, String cardName, int count) throws AssertionError {
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new NamePredicate(cardName));
|
||||
int actual = currentGame.getPlayer(player.getId()).getHand().count(filter, player.getId(), currentGame);
|
||||
int actual;
|
||||
if (cardName.contains("//")) { // special logic for cheched split cards, because in game logic of card name filtering is different than for test
|
||||
actual = 0;
|
||||
for (Card card : currentGame.getPlayer(player.getId()).getHand().getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
actual++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new NamePredicate(cardName));
|
||||
actual = currentGame.getPlayer(player.getId()).getHand().count(filter, player.getId(), currentGame);
|
||||
}
|
||||
Assert.assertEquals("(Hand) Card counts for card " + cardName + " for " + player.getName() + " are not equal ", count, actual);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue