mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
AsThough effects improves and fixes:
* AsThough: added documentation about code usage and restrictions; * AsThough: added additional checks for correct usage; * AsThough: simplified some code; * PlayFromNotOwnHandZoneTargetEffect - added permanents support as targets; * Release to the Wind - fixed that it can't cast exiled cards (#7415, #7416); * Test framework: fixed that checkExileCount checking card's owner; * GUI: fixed typo in Trample card icons;
This commit is contained in:
parent
b8a95765fc
commit
2d96d36ec8
28 changed files with 375 additions and 217 deletions
|
|
@ -437,12 +437,18 @@ public class PlayFromNonHandZoneTest extends CardTestPlayerBaseWithAIHelps {
|
|||
|
||||
skipInitShuffling();
|
||||
|
||||
// attack and exile 2 cards from library
|
||||
attack(2, playerB, "Fallen Shinobi");
|
||||
checkExileCount("after exile a", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Purge", 1);
|
||||
checkExileCount("after exile b", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Curious Pair", 1);
|
||||
|
||||
// cast purge from exile
|
||||
checkPlayableAbility("after exile - can play purge", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cast Angelic Purge", true);
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Purge");
|
||||
setChoice(playerB, "Silvercoat Lion"); // Sacrifice for Purge
|
||||
addTarget(playerB, "Amulet of Kroog"); // Exile with Purge
|
||||
setChoice(playerB, "Silvercoat Lion"); // sacrifice cost
|
||||
addTarget(playerB, "Amulet of Kroog"); // exile target
|
||||
|
||||
// cast adventure spell from exile
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Treats to Share");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
|
|
|
|||
|
|
@ -238,8 +238,7 @@ public class TakeControlWhileSearchingLibraryTest extends CardTestPlayerBase {
|
|||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkGraveyardCount("after grave a", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 0);
|
||||
checkGraveyardCount("after grave b", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Balduvian Bears", 0);
|
||||
checkExileCount("after exile a", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
|
||||
checkExileCount("after exile b", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Balduvian Bears", 0);
|
||||
checkExileCount("after exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
|
||||
|
||||
// B can cast green bear for red mana
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Balduvian Bears");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
package org.mage.test.cards.single.rix;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class ReleaseToTheWindTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_Exile_PermanentCard() {
|
||||
// Exile target nonland permanent. For as long as that card remains exiled, its owner may cast it without paying its mana cost.
|
||||
addCard(Zone.HAND, playerA, "Release to the Wind"); // {2}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1);
|
||||
|
||||
// exile
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Release to the Wind", "Grizzly Bears");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkExileCount("after exile", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Grizzly Bears", 1);
|
||||
checkPlayableAbility("after exile - non owner can't play 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Grizzly Bears", false);
|
||||
|
||||
// owner can play
|
||||
checkPlayableAbility("after exile - non owner can't play 2", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Grizzly Bears", false);
|
||||
checkPlayableAbility("after exile - owner can play", 2, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Grizzly Bears", true);
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Grizzly Bears");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerB, "Grizzly Bears", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Exile_ModalDoubleFacesCard() {
|
||||
// Exile target nonland permanent. For as long as that card remains exiled, its owner may cast it without paying its mana cost.
|
||||
addCard(Zone.HAND, playerA, "Release to the Wind"); // {2}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
//
|
||||
// Akoum Warrior {5}{R} - creature
|
||||
// Akoum Teeth - land
|
||||
addCard(Zone.HAND, playerA, "Akoum Warrior");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
|
||||
|
||||
// prepare mdf
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}", 6);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
checkPermanentCount("prepare", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 1);
|
||||
|
||||
// exile mdf creature
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Release to the Wind", "Akoum Warrior");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkExileCount("after exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 1);
|
||||
|
||||
// you can cast mdf, but can't play a land
|
||||
checkPlayableAbility("after exile - can play mdf creature", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Akoum Warrior", true);
|
||||
checkPlayableAbility("after exile - can't play mdf land", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Akoum Teeth", false);
|
||||
|
||||
// cast mdf again for free
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Akoum Warrior", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -820,7 +820,7 @@ public class TestPlayer implements Player {
|
|||
|
||||
// check exile count: card name, count
|
||||
if (params[0].equals(CHECK_COMMAND_EXILE_COUNT) && params.length == 3) {
|
||||
assertExileCount(action, game, computerPlayer, params[1], Integer.parseInt(params[2]));
|
||||
assertExileCount(action, game, params[1], Integer.parseInt(params[2]));
|
||||
actions.remove(action);
|
||||
wasProccessed = true;
|
||||
}
|
||||
|
|
@ -1355,15 +1355,20 @@ public class TestPlayer implements Player {
|
|||
Assert.assertEquals(action.getActionName() + " - permanent " + permanentName + " must have " + count + " " + counterType.toString(), count, foundCount);
|
||||
}
|
||||
|
||||
private void assertExileCount(PlayerAction action, Game game, Player player, String permanentName, int count) {
|
||||
private void assertExileCount(PlayerAction action, Game game, String permanentName, int count) {
|
||||
int foundCount = 0;
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
if (hasObjectTargetNameOrAlias(card, permanentName) && card.isOwnedBy(player.getId())) {
|
||||
if (hasObjectTargetNameOrAlias(card, permanentName)) {
|
||||
foundCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.assertEquals(action.getActionName() + " - card " + permanentName + " must exists in exile zone with " + count + " instances", count, foundCount);
|
||||
if (foundCount != count) {
|
||||
printStart("Exile cards");
|
||||
printCards(game.getExile().getAllCards(game));
|
||||
printEnd();
|
||||
Assert.fail(action.getActionName() + " - exile zone must have " + count + " cards with name " + permanentName + ", but found " + foundCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertGraveyardCount(PlayerAction action, Game game, Player player, String permanentName, int count) {
|
||||
|
|
@ -1374,7 +1379,12 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
}
|
||||
|
||||
Assert.assertEquals(action.getActionName() + " - card " + permanentName + " must exists in graveyard zone with " + count + " instances", count, foundCount);
|
||||
if (foundCount != count) {
|
||||
printStart("Graveyard of " + player.getName());
|
||||
printCards(player.getGraveyard().getCards(game));
|
||||
printEnd();
|
||||
Assert.fail(action.getActionName() + " - graveyard zone must have " + count + " cards with name " + permanentName + ", but found " + foundCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertLibraryCount(PlayerAction action, Game game, Player player, String permanentName, int count) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue