mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 14:02:05 -08:00
Merge origin/master
This commit is contained in:
commit
238152d6c4
8 changed files with 399 additions and 186 deletions
|
|
@ -914,4 +914,97 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
Permanent akroma = getPermanent("Akroma, Angel of Fury");
|
||||
Assert.assertTrue("Akroma has to be red", akroma.getColor(currentGame).isRed());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_LandWithMorph_PlayLand() {
|
||||
// Morph {2}
|
||||
addCard(Zone.HAND, playerA, "Zoetic Cavern");
|
||||
|
||||
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Zoetic Cavern", true);
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Zoetic Cavern");
|
||||
setChoice(playerA, "No"); // no morph (canPay for generic/colored mana returns true all the time, so xmage ask about face down cast)
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
// 1 action must be here ("no" option is restores on failed morph call in playLand)
|
||||
//assertAllCommandsUsed();
|
||||
assertChoicesCount(playerA, 1);
|
||||
|
||||
assertPermanentCount(playerA, "Zoetic Cavern", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_LandWithMorph_Morph() {
|
||||
// Morph {2}
|
||||
addCard(Zone.HAND, playerA, "Zoetic Cavern");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
|
||||
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Zoetic Cavern", true);
|
||||
checkPlayableAbility("morph must be replaced by play ability", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Morph", false);
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Zoetic Cavern");
|
||||
setChoice(playerA, "Yes"); // morph
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Zoetic Cavern", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_LandWithMorph_MorphAfterLand() {
|
||||
removeAllCardsFromHand(playerA);
|
||||
|
||||
// Morph {2}
|
||||
addCard(Zone.HAND, playerA, "Zoetic Cavern");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
//
|
||||
addCard(Zone.HAND, playerA, "Island", 1);
|
||||
|
||||
// play land first
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Island");
|
||||
|
||||
// morph ability (play as face down) calls from playLand method, so it visible for play land command
|
||||
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Zoetic Cavern", true);
|
||||
checkPlayableAbility("morph must be replaced by play ability", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Morph", false);
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Zoetic Cavern");
|
||||
setChoice(playerA, "Yes"); // morph
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Island", 1);
|
||||
assertPermanentCount(playerA, "Zoetic Cavern", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_LandWithMorph_MorphFromLibrary() {
|
||||
removeAllCardsFromLibrary(playerA);
|
||||
|
||||
// You may play lands and cast spells from the top of your library.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Future Sight");
|
||||
//
|
||||
// Morph {2}
|
||||
addCard(Zone.LIBRARY, playerA, "Zoetic Cavern");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
|
||||
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Zoetic Cavern", true);
|
||||
checkPlayableAbility("morph must be replaced by play ability", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Morph", false);
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Zoetic Cavern");
|
||||
setChoice(playerA, "Yes"); // morph
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Zoetic Cavern", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ public class DoublingCubeTest extends CardTestPlayerBase {
|
|||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}, {T}:");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
assertManaPool(playerA, ManaType.COLORLESS, 4);
|
||||
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
package org.mage.test.cards.split;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class CastSplitCardsWithAsThoughManaTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_AsThoughMana_Simple() {
|
||||
// {1}{R}
|
||||
// When Dire Fleet Daredevil enters the battlefield, exile target instant or sorcery card from an opponent’s graveyard.
|
||||
// You may cast that card this turn, and you may spend mana as though it were mana of any type to cast that spell.
|
||||
// If that card would be put into a graveyard this turn, exile it instead.
|
||||
addCard(Zone.HAND, playerA, "Dire Fleet Daredevil", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
//
|
||||
addCard(Zone.GRAVEYARD, playerB, "Lightning Bolt", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
|
||||
// cast fleet
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}", 2);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dire Fleet Daredevil");
|
||||
addTarget(playerA, "Lightning Bolt");
|
||||
|
||||
// cast bolt with blue mana
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerB, 20 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_AsThoughMana_Split_WearTear() {
|
||||
// {1}{R}
|
||||
// When Dire Fleet Daredevil enters the battlefield, exile target instant or sorcery card from an opponent’s graveyard.
|
||||
// You may cast that card this turn, and you may spend mana as though it were mana of any type to cast that spell.
|
||||
// If that card would be put into a graveyard this turn, exile it instead.
|
||||
addCard(Zone.HAND, playerA, "Dire Fleet Daredevil", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
//
|
||||
// Wear {1}{R} Destroy target artifact.
|
||||
// Tear {W} Destroy target enchantment.
|
||||
addCard(Zone.GRAVEYARD, playerB, "Wear // Tear", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Bident of Thassa", 1); // Legendary Enchantment Artifact
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Bow of Nylea", 1); // Legendary Enchantment Artifact
|
||||
|
||||
// cast fleet
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}", 2);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dire Fleet Daredevil");
|
||||
addTarget(playerA, "Wear // Tear");
|
||||
|
||||
// cast Wear with black mana
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wear", "Bident of Thassa");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerB, "Bident of Thassa", 1);
|
||||
assertPermanentCount(playerB, "Bow of Nylea", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_AsThoughMana_Split_CatchRelease() {
|
||||
// {1}{R}
|
||||
// When Dire Fleet Daredevil enters the battlefield, exile target instant or sorcery card from an opponent’s graveyard.
|
||||
// You may cast that card this turn, and you may spend mana as though it were mana of any type to cast that spell.
|
||||
// If that card would be put into a graveyard this turn, exile it instead.
|
||||
addCard(Zone.HAND, playerA, "Dire Fleet Daredevil", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
//
|
||||
// Catch {1}{U}{R} Gain control of target permanent until end of turn. Untap it. It gains haste until end of turn.
|
||||
// Release {4}{R}{W} Each player sacrifices an artifact, a creature, an enchantment, a land, and a planeswalker.
|
||||
addCard(Zone.GRAVEYARD, playerB, "Catch // Release", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1);
|
||||
|
||||
// cast fleet
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}", 2);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dire Fleet Daredevil");
|
||||
addTarget(playerA, "Catch // Release");
|
||||
|
||||
// cast Catch with black mana
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Catch", "Balduvian Bears");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Balduvian Bears", 1);
|
||||
assertPermanentCount(playerB, "Balduvian Bears", 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package org.mage.test.cards.split;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class CastSplitCardsWithFlashbackTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_Flashback_Simple() {
|
||||
// {1}{U}
|
||||
// When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Snapcaster Mage", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
//
|
||||
addCard(Zone.GRAVEYARD, playerA, "Lightning Bolt", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
|
||||
// add flashback
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage");
|
||||
addTarget(playerA, "Lightning Bolt");
|
||||
|
||||
// cast as flashback
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback", playerB);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerB, 20 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Flashback_Split() {
|
||||
// {1}{U}
|
||||
// When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Snapcaster Mage", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
//
|
||||
// Wear {1}{R} Destroy target artifact.
|
||||
// Tear {W} Destroy target enchantment.
|
||||
addCard(Zone.GRAVEYARD, playerA, "Wear // Tear", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Bident of Thassa", 1); // Legendary Enchantment Artifact
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Bow of Nylea", 1); // Legendary Enchantment Artifact
|
||||
|
||||
// add flashback
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage");
|
||||
addTarget(playerA, "Wear // Tear");
|
||||
|
||||
// cast as flashback
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {1}{R}", "Bident of Thassa");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerB, "Bident of Thassa", 1);
|
||||
assertPermanentCount(playerB, "Bow of Nylea", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -963,7 +963,7 @@ public class TestPlayer implements Player {
|
|||
// you don't need to use stack command all the time, so some cast commands can be skiped to next check
|
||||
if (game.getStack().isEmpty()) {
|
||||
this.chooseStrictModeFailed("cast/activate", game,
|
||||
"Can't find available command - " + action.getAction() + " (use checkPlayableAbility for non castable checks)", true);
|
||||
"Can't find available command - " + action.getAction() + " (use checkPlayableAbility for \"non available\" checks)", true);
|
||||
}
|
||||
} // turn/step
|
||||
}
|
||||
|
|
@ -1088,7 +1088,7 @@ public class TestPlayer implements Player {
|
|||
.map(a -> (a.getZone() + " -> "
|
||||
+ a.getSourceObject(game).getIdName() + " -> "
|
||||
+ (a.toString().length() > 0
|
||||
? a.toString().substring(0, Math.min(20, a.toString().length()) - 1)
|
||||
? a.toString().substring(0, Math.min(20, a.toString().length()))
|
||||
: a.getClass().getSimpleName())
|
||||
+ "..."))
|
||||
.sorted()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue