diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java index 8595a113a24..3d8949f6316 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java @@ -162,4 +162,36 @@ public class CascadeTest extends CardTestPlayerBase { } + /** + * Tooth and Nail off a cascade is bugged. It let me pay the entwine cost + * for free even though I had no mana open and the entwine is an additional + * cost. + */ + @Test + public void testHaveToPayAdditionalCosts() { + + playerA.getLibrary().clear(); + // Choose one - You draw five cards and you lose 5 life; + // or put an X/X black Demon creature token with flying onto the battlefield, where X is the number of cards in your hand as the token enters the battlefield. + // Entwine {4} (Choose both if you pay the entwine cost.) + //addCard(Zone.LIBRARY, playerA, "Promise of Power", 10); + addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2); + + addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); + + // Cascade + addCard(Zone.HAND, playerA, "Enlisted Wurm"); // Creature {4}{G}{W} 5/5 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Enlisted Wurm"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Enlisted Wurm", 1); + assertLife(playerA, 15); + assertHandCount(playerA, 5); + assertPermanentCount(playerA, "Demon", 1); + + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index 4076c112dd9..3050ad57236 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -107,24 +107,24 @@ class CascadeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Card card; - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { return false; } - ExileZone exile = game.getExile().createZone(source.getSourceId(), player.getName() + " Cascade"); + ExileZone exile = game.getExile().createZone(source.getSourceId(), controller.getName() + " Cascade"); int sourceCost = game.getCard(source.getSourceId()).getConvertedManaCost(); do { - card = player.getLibrary().getFromTop(game); + card = controller.getLibrary().getFromTop(game); if (card == null) { break; } - player.moveCardsToExile(card, source, game, true, exile.getId(), exile.getName()); - } while (player.isInGame() && card.getCardType().contains(CardType.LAND) || card.getConvertedManaCost() >= sourceCost); - player.getLibrary().reset(); + controller.moveCardsToExile(card, source, game, true, exile.getId(), exile.getName()); + } while (controller.isInGame() && card.getCardType().contains(CardType.LAND) || card.getConvertedManaCost() >= sourceCost); + controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw if (card != null) { - if (player.chooseUse(outcome, "Use cascade effect on " + card.getLogName() + "?", source, game)) { - if (player.cast(card.getSpellAbility(), game, true)) { + if (controller.chooseUse(outcome, "Use cascade effect on " + card.getLogName() + "?", source, game)) { + if (controller.cast(card.getSpellAbility(), game, true)) { exile.remove(card.getId()); } } @@ -138,7 +138,7 @@ class CascadeEffect extends OneShotEffect { cardsFromExile.remove(card.getId()); cardsToLibrary.add(card); } - player.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false); + controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false); return true; }