From 1e82f0750a8105b5e6ed2c901c295c6a45b9c31d Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 9 Feb 2017 10:20:21 -0600 Subject: [PATCH] Fixed FlashbackTest and made modifications to CascadeAbility allowing it to pass its test suite. --- .../abilities/keywords/FlashbackTest.java | 4 +-- .../abilities/keyword/CascadeAbility.java | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java index 7f83e5c9a5..2e4971fef6 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java @@ -108,12 +108,12 @@ public class FlashbackTest extends CardTestPlayerBase { * Test Granting Flashback to spells with X in mana cost, where X has no * influence on targeting requirements * - * Specific instance: Snapcaser Mage granting Flashback to Blaze + * Specific instance: Snapcaster Mage granting Flashback to Blaze */ @Test public void testSnapcasterMageWithBlaze() { addCard(Zone.BATTLEFIELD, playerA, "Island", 5); - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); // you still need extra red mana in case the Snapcaster Mage is paid for via UR, X=1 using R, etc addCard(Zone.HAND, playerA, "Snapcaster Mage", 1); addCard(Zone.GRAVEYARD, playerA, "Blaze", 1); diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index 98ccd6a3db..b39b5e2f74 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -49,7 +49,7 @@ import mage.players.Player; public class CascadeAbility extends TriggeredAbilityImpl { //20091005 - 702.82 - private final static String reminderText = " (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less." + private final static String REMINDERTEXT = " (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less." + " You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.)"; private boolean withReminder; @@ -82,7 +82,7 @@ public class CascadeAbility extends TriggeredAbilityImpl { public String getRule() { StringBuilder sb = new StringBuilder("Cascade"); if (withReminder) { - sb.append(reminderText); + sb.append(REMINDERTEXT); } return sb.toString(); } @@ -119,7 +119,9 @@ class CascadeEffect extends OneShotEffect { break; } controller.moveCardsToExile(card, source, game, true, exile.getId(), exile.getName()); - } while (controller.isInGame() && (card.getCardType().contains(CardType.LAND) || !cardThatCostsLess(sourceCost, card, game))); + } while (controller.isInGame() + && (card.getCardType().contains(CardType.LAND) + || !cardThatCostsLess(sourceCost, card, game))); controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw @@ -127,19 +129,17 @@ class CascadeEffect extends OneShotEffect { if (controller.chooseUse(outcome, "Use cascade effect on " + card.getLogName() + '?', source, game)) { controller.cast(card.getSpellAbility(), game, true); } - // Move the remaining cards to the buttom of the library in a random order - Cards cardsFromExile = new CardsImpl(); - Cards cardsToLibrary = new CardsImpl(); - cardsFromExile.addAll(exile); - while (!cardsFromExile.isEmpty()) { - card = cardsFromExile.getRandom(game); - cardsFromExile.remove(card.getId()); - cardsToLibrary.add(card); - } - controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false); - } - return true; + // Move the remaining cards to the buttom of the library in a random order + Cards cardsFromExile = new CardsImpl(); + Cards cardsToLibrary = new CardsImpl(); + cardsFromExile.addAll(exile); + while (!cardsFromExile.isEmpty()) { + card = cardsFromExile.getRandom(game); + cardsFromExile.remove(card.getId()); + cardsToLibrary.add(card); + } + return controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false); } @Override