Fixed FlashbackTest and made modifications to CascadeAbility allowing it to pass its test suite.

This commit is contained in:
Jeff 2017-02-09 10:20:21 -06:00
parent e18695489f
commit 1e82f0750a
2 changed files with 17 additions and 17 deletions

View file

@ -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);

View file

@ -49,7 +49,7 @@ import mage.players.Player;
public class CascadeAbility extends TriggeredAbilityImpl {
//20091005 - 702.82
private final static String reminderText = " <i>(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 = " <i>(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.)</i>";
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