mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
Improved test for #6244
This commit is contained in:
parent
4c5ea62cea
commit
78a9279438
2 changed files with 22 additions and 8 deletions
|
|
@ -2,8 +2,6 @@ package org.mage.test.cards.abilities.activated;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
|
@ -11,16 +9,31 @@ public class ChaosWandTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChaosWant() {
|
public void testChaosWant() {
|
||||||
|
removeAllCardsFromLibrary(playerB);
|
||||||
|
|
||||||
|
// {4}, {T}: Target opponent exiles cards from the top of their library until they exile an instant or sorcery card.
|
||||||
|
// You may cast that card without paying its mana cost. Then put the exiled cards that weren't cast this way
|
||||||
|
// on the bottom of that library in a random order.
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Chaos Wand");
|
addCard(Zone.BATTLEFIELD, playerA, "Chaos Wand");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||||
|
//
|
||||||
|
// Each opponent loses 3 life. You gain life equal to the life lost this way.
|
||||||
|
addCard(Zone.LIBRARY, playerB, "Island", 1); // save after exile
|
||||||
addCard(Zone.LIBRARY, playerB, "Blood Tithe");
|
addCard(Zone.LIBRARY, playerB, "Blood Tithe");
|
||||||
|
addCard(Zone.LIBRARY, playerB, "Swamp", 3); // choose for exile
|
||||||
|
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{4}, {T}: ");
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{4}, {T}: ");
|
||||||
setChoice(playerA, "Yes");
|
addTarget(playerA, playerB);
|
||||||
|
setChoice(playerA, "Yes"); // cast for free
|
||||||
|
setChoice(playerA, "Cast Blood Tithe");
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
assertLife(playerB, 17);
|
assertLife(playerA, 20 + 3); // +3 from blood
|
||||||
|
assertLife(playerB, 20 - 3); // -3 from blood
|
||||||
|
assertLibraryCount(playerB, "Island", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3653,9 +3653,12 @@ public class TestPlayer implements Player {
|
||||||
@Override
|
@Override
|
||||||
public SpellAbility chooseAbilityForCast(Card card, Game game, boolean noMana) {
|
public SpellAbility chooseAbilityForCast(Card card, Game game, boolean noMana) {
|
||||||
String allInfo = "";
|
String allInfo = "";
|
||||||
|
|
||||||
|
Map<UUID, ActivatedAbility> useable = PlayerImpl.getSpellAbilities(this.getId(), card, game.getState().getZone(card.getId()), game);
|
||||||
|
allInfo = useable.values().stream().map(Object::toString).collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
assertAliasSupportInChoices(false);
|
assertAliasSupportInChoices(false);
|
||||||
if (!choices.isEmpty()) {
|
if (!choices.isEmpty()) {
|
||||||
Map<UUID, ActivatedAbility> useable = PlayerImpl.getSpellAbilities(this.getId(), card, game.getState().getZone(card.getId()), game);
|
|
||||||
for (ActivatedAbility ability : useable.values()) {
|
for (ActivatedAbility ability : useable.values()) {
|
||||||
if (ability.toString().startsWith(choices.get(0))) {
|
if (ability.toString().startsWith(choices.get(0))) {
|
||||||
choices.remove(0);
|
choices.remove(0);
|
||||||
|
|
@ -3663,8 +3666,6 @@ public class TestPlayer implements Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allInfo = useable.values().stream().map(Object::toString).collect(Collectors.joining("\n"));
|
|
||||||
|
|
||||||
// TODO: enable fail checks and fix tests
|
// TODO: enable fail checks and fix tests
|
||||||
//Assert.fail("Wrong choice");
|
//Assert.fail("Wrong choice");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue