From dc5908e7f1f79406ea3e1788524a89de5cb853d3 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 22 Apr 2018 17:54:43 +0400 Subject: [PATCH] Return some ignored tests after massive texts replacements, added new tests for "any target" spells (see prev commit); --- .../src/mage/cards/b/BrutalExpulsion.java | 3 +- .../cards/single/bfz/BrutalExpulsionTest.java | 99 +++++++++++++++++-- .../base/impl/CardTestPlayerAPIImpl.java | 1 + 3 files changed, 91 insertions(+), 12 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BrutalExpulsion.java b/Mage.Sets/src/mage/cards/b/BrutalExpulsion.java index dd256d21231..a12786b9f28 100644 --- a/Mage.Sets/src/mage/cards/b/BrutalExpulsion.java +++ b/Mage.Sets/src/mage/cards/b/BrutalExpulsion.java @@ -51,7 +51,6 @@ import mage.watchers.common.DamagedByWatcher; public class BrutalExpulsion extends CardImpl { private static final FilterSpellOrPermanent filter = new FilterSpellOrPermanent("spell or creature"); - static { filter.setPermanentFilter(new FilterCreaturePermanent()); } @@ -70,8 +69,8 @@ public class BrutalExpulsion extends CardImpl { this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); // or Brutal Expulsion deals 2 damage to target creature or planeswalker. If that permanent would be put into a graveyard this turn, exile it instead. Mode mode = new Mode(); - mode.getEffects().add(new DamageTargetEffect(2)); mode.getTargets().add(new TargetCreatureOrPlaneswalker()); + mode.getEffects().add(new DamageTargetEffect(2)); Effect effect = new DealtDamageToCreatureBySourceDies(this, Duration.EndOfTurn); effect.setText("If that permanent would be put into a graveyard this turn, exile it instead"); mode.getEffects().add(effect); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/BrutalExpulsionTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/BrutalExpulsionTest.java index 9401158492f..1fa4024618e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/BrutalExpulsionTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/BrutalExpulsionTest.java @@ -35,10 +35,90 @@ import org.mage.test.serverside.base.CardTestPlayerBase; /** * - * @author Quercitron + * @author JayDi85 */ public class BrutalExpulsionTest extends CardTestPlayerBase { + @Test + public void test_useSecondModeOnCreature() { + // Choose one or both + // - Return target spell or creature to its owner's hand. + // - Brutal Expulsion deals 2 damage to target creature or planeswalker. If that permanent would be put into a graveyard this turn, exile it instead. + addCard(Zone.HAND, playerA, "Brutal Expulsion"); // {2}{U}{R} + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + + addCard(Zone.BATTLEFIELD, playerB, "Augmenting Automaton", 1); // 1 life + addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2 life + addCard(Zone.BATTLEFIELD, playerB, "Razorclaw Bear", 1); // 3 life + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Brutal Expulsion", "mode=2Augmenting Automaton"); + setModeChoice(playerA, "2"); + setModeChoice(playerA, null); // ignore last one mode + //addTarget(playerA, "mode=2Augmenting Automaton"); // doesn't work with mode + + setStopAt(1, PhaseStep.END_COMBAT); + execute(); + + assertHandCount(playerA, 0); + assertPermanentCount(playerA, "Brutal Expulsion", 0); + assertPermanentCount(playerB, "Augmenting Automaton", 0); + assertPermanentCount(playerB, "Balduvian Bears", 1); + assertPermanentCount(playerB, "Razorclaw Bear", 1); + } + + @Test + public void test_useSecondModeOnPlaneswalker() { + // Choose one or both + // - Return target spell or creature to its owner's hand. + // - Brutal Expulsion deals 2 damage to target creature or planeswalker. If that permanent would be put into a graveyard this turn, exile it instead. + addCard(Zone.HAND, playerA, "Brutal Expulsion"); // {2}{U}{R} + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + + addCard(Zone.BATTLEFIELD, playerB, "Augmenting Automaton", 1); // 1 life + addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2 life + addCard(Zone.BATTLEFIELD, playerB, "Razorclaw Bear", 1); // 3 life + addCard(Zone.BATTLEFIELD, playerB, "Kiora, the Crashing Wave"); // 2 life + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Brutal Expulsion", "mode=2Kiora, the Crashing Wave"); + setModeChoice(playerA, "2"); + setModeChoice(playerA, null); // ignore last one mode + + setStopAt(1, PhaseStep.END_COMBAT); + execute(); + + assertHandCount(playerA, 0); + assertPermanentCount(playerA, "Brutal Expulsion", 0); + assertPermanentCount(playerB, "Augmenting Automaton", 1); + assertPermanentCount(playerB, "Balduvian Bears", 1); + assertPermanentCount(playerB, "Razorclaw Bear", 1); + assertPermanentCount(playerB, "Kiora, the Crashing Wave", 0); + } + + @Test + public void test_useSpellOnPlaneswalker() { + addCard(Zone.HAND, playerA, "Shock"); // {R} + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + + addCard(Zone.BATTLEFIELD, playerB, "Augmenting Automaton", 1); // 1 life + addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2 life + addCard(Zone.BATTLEFIELD, playerB, "Razorclaw Bear", 1); // 3 life + addCard(Zone.BATTLEFIELD, playerB, "Kiora, the Crashing Wave"); // 2 life + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "Kiora, the Crashing Wave"); + + setStopAt(1, PhaseStep.END_COMBAT); + execute(); + + assertHandCount(playerA, 0); + assertPermanentCount(playerA, "Shock", 0); + assertPermanentCount(playerB, "Augmenting Automaton", 1); + assertPermanentCount(playerB, "Balduvian Bears", 1); + assertPermanentCount(playerB, "Razorclaw Bear", 1); + assertPermanentCount(playerB, "Kiora, the Crashing Wave", 0); + } + /** * Brutal Expulsion targeting Gideon, Ally of Zendikar. Gideon has 3 * loyalty. Brutal Expulsion resolves, leaves 1 loyalty. I attack Gideon for @@ -46,33 +126,32 @@ public class BrutalExpulsionTest extends CardTestPlayerBase { * Expulsion sends Gideon to exile. However, in game Gideon went to * graveyard. */ - @Ignore @Test public void testPlaneswalkerExile() { // Choose one or both // - Return target spell or creature to its owner's hand. // - Brutal Expulsion deals 2 damage to target creature or planeswalker. If that permanent would be put into a graveyard this turn, exile it instead. addCard(Zone.HAND, playerA, "Brutal Expulsion"); // {2}{U}{R} + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); // Shock deals 2 damage to any target. addCard(Zone.HAND, playerA, "Shock"); // {R} - addCard(Zone.BATTLEFIELD, playerA, "Island", 1); - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); // Planeswalker with 4 loyalty. addCard(Zone.BATTLEFIELD, playerB, "Gideon, Ally of Zendikar"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Brutal Expulsion"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Brutal Expulsion", "mode=2Gideon, Ally of Zendikar"); setModeChoice(playerA, "2"); - setModeChoice(playerA, null); - addTarget(playerA, "Gideon, Ally of Zendikar"); - - castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Shock", "Gideon, Ally of Zendikar"); + setModeChoice(playerA, null); // ignore last one mode + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "Gideon, Ally of Zendikar"); setStopAt(1, PhaseStep.END_COMBAT); execute(); + assertHandCount(playerA, 0); + assertPermanentCount(playerA, "Shock", 0); assertPermanentCount(playerB, "Gideon, Ally of Zendikar", 0); - assertGraveyardCount(playerB, "Gideon, Ally of Zendikar", 0); assertExileCount("Gideon, Ally of Zendikar", 1); } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index c5a01a37418..d405956f83b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -1248,6 +1248,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement * are copies. For modal spells use a prefix with the mode number: * mode=1Lightning Bolt^mode=2Silvercoat Lion */ + // TODO: mode options doesn't work here (see BrutalExpulsionTest) public void addTarget(TestPlayer player, String target) { player.addTarget(target); }