From abca80e95143c91e692739ab587e456e954e5694 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 2 Oct 2015 15:05:00 +0200 Subject: [PATCH] * Cascade - Fixed that the remaining cards were not set to graveyard in a random order. --- .../abilities/keyword/CascadeAbility.java | 68 +++++-------------- .../mage/abilities/keyword/DelveAbility.java | 54 +++++++-------- 2 files changed, 42 insertions(+), 80 deletions(-) diff --git a/Mage/src/mage/abilities/keyword/CascadeAbility.java b/Mage/src/mage/abilities/keyword/CascadeAbility.java index 5895bc79d7..68e593baa2 100644 --- a/Mage/src/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/mage/abilities/keyword/CascadeAbility.java @@ -92,8 +92,20 @@ public class CascadeAbility extends TriggeredAbilityImpl { return new CascadeAbility(this); } - // moved to static method because it's called also from class {link} MaelstromNexus - public static boolean applyCascade(Outcome outcome, Game game, Ability source) { +} + +class CascadeEffect extends OneShotEffect { + + public CascadeEffect() { + super(Outcome.PutCardInPlay); + } + + public CascadeEffect(CascadeEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { Card card; Player player = game.getPlayer(source.getControllerId()); if (player == null) { @@ -117,7 +129,7 @@ public class CascadeAbility extends TriggeredAbilityImpl { } } } - // Mobe the remaining cards to the buttom of the libraray in a random order + // 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); @@ -126,57 +138,9 @@ public class CascadeAbility extends TriggeredAbilityImpl { cardsFromExile.remove(card.getId()); cardsToLibrary.add(card); } - player.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, true); + player.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false); return true; } -} - -// !!! Changes to the cascade effect here have to be copied to the cascadeEffect of Maelstrom Nexus card eventually. -// There is a functional copy of this effect -class CascadeEffect extends OneShotEffect { - - public CascadeEffect() { - super(Outcome.PutCardInPlay); - } - - public CascadeEffect(CascadeEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - return CascadeAbility.applyCascade(outcome, game, source); -// Card card; -// Player player = game.getPlayer(source.getControllerId()); -// if (player == null) { -// return false; -// } -// ExileZone exile = game.getExile().createZone(source.getSourceId(), player.getName() + " Cascade"); -// int sourceCost = game.getCard(source.getSourceId()).getManaCost().convertedManaCost(); -// do { -// card = player.getLibrary().getFromTop(game); -// if (card == null) { -// break; -// } -// player.moveCardToExileWithInfo(card, exile.getId(), exile.getName(), source.getSourceId(), game, Zone.LIBRARY); -// } while (player.isInGame() && card.getCardType().contains(CardType.LAND) || card.getManaCost().convertedManaCost() >= sourceCost); -// -// if (card != null) { -// if (player.chooseUse(outcome, "Use cascade effect on " + card.getName() + "?", game)) { -// if(player.cast(card.getSpellAbility(), game, true)){ -// exile.remove(card.getId()); -// } -// } -// } -// -// while (exile.size() > 0) { -// card = exile.getRandom(game); -// exile.remove(card.getId()); -// player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, false, false); -// } -// -// return true; - } @Override public CascadeEffect copy() { diff --git a/Mage/src/mage/abilities/keyword/DelveAbility.java b/Mage/src/mage/abilities/keyword/DelveAbility.java index c6172cc242..45d91c5e26 100644 --- a/Mage/src/mage/abilities/keyword/DelveAbility.java +++ b/Mage/src/mage/abilities/keyword/DelveAbility.java @@ -48,35 +48,32 @@ import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; import mage.util.CardUtil; - /** - * 702.65. Delve - * 702.65a Delve is a static ability that functions while the spell with delve is on the stack. - * “Delve” means “For each generic mana in this spell’s total cost, you may exile a card - * from your graveyard rather than pay that mana.” The delve ability isn’t an additional - * or alternative cost and applies only after the total cost of the spell with delve is - * determined. + * 702.65. Delve 702.65a Delve is a static ability that functions while the + * spell with delve is on the stack. “Delve” means “For each generic mana in + * this spell’s total cost, you may exile a card from your graveyard rather than + * pay that mana.” The delve ability isn’t an additional or alternative cost and + * applies only after the total cost of the spell with delve is determined. * 702.65b Multiple instances of delve on the same spell are redundant. - * - * * The rules for delve have changed slightly since it was last in an expansion. Previously, delve - * reduced the cost to cast a spell. Under the current rules, you exile cards from your graveyard - * at the same time you pay the spell’s cost. Exiling a card this way is simply another way to pay - * that cost. - * * Delve doesn’t change a spell’s mana cost or converted mana cost. For example, Dead Drop’s converted - * mana cost is 10 even if you exiled three cards to cast it. - * * You can’t exile cards to pay for the colored mana requirements of a spell with delve. - * * You can’t exile more cards than the generic mana requirement of a spell with delve. For example, - * you can’t exile more than nine cards from your graveyard to cast Dead Drop. - * * Because delve isn’t an alternative cost, it can be used in conjunction with alternative costs. - * + * + * * The rules for delve have changed slightly since it was last in an + * expansion. Previously, delve reduced the cost to cast a spell. Under the + * current rules, you exile cards from your graveyard at the same time you pay + * the spell’s cost. Exiling a card this way is simply another way to pay that + * cost. * Delve doesn’t change a spell’s mana cost or converted mana cost. For + * example, Dead Drop’s converted mana cost is 10 even if you exiled three cards + * to cast it. * You can’t exile cards to pay for the colored mana requirements + * of a spell with delve. * You can’t exile more cards than the generic mana + * requirement of a spell with delve. For example, you can’t exile more than + * nine cards from your graveyard to cast Dead Drop. * Because delve isn’t an + * alternative cost, it can be used in conjunction with alternative costs. + * * @author LevelX2 * - * TODO: Change card exiling to a way to pay mana costs, now it's maybe not passible to pay costs from effects that - * increase the mana costs. + * TODO: Change card exiling to a way to pay mana costs, now it's maybe not + * passible to pay costs from effects that increase the mana costs. */ - - public class DelveAbility extends SimpleStaticAbility implements AlternateManaPaymentAbility { - +public class DelveAbility extends SimpleStaticAbility implements AlternateManaPaymentAbility { public DelveAbility() { super(Zone.STACK, null); @@ -89,12 +86,12 @@ import mage.util.CardUtil; @Override public DelveAbility copy() { - return new DelveAbility(this); + return new DelveAbility(this); } @Override public String getRule() { - return "Delve (Each card you exile from your graveyard while casting this spell pays for {1})"; + return "Delve (Each card you exile from your graveyard while casting this spell pays for {1})"; } @Override @@ -110,7 +107,7 @@ import mage.util.CardUtil; unpaidAmount = 1; } specialAction.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard( - 0, Math.min(controller.getGraveyard().size(), unpaidAmount), new FilterCard()))); + 0, Math.min(controller.getGraveyard().size(), unpaidAmount), new FilterCard()))); if (specialAction.canActivate(source.getControllerId(), game)) { game.getState().getSpecialActions().add(specialAction); } @@ -160,9 +157,10 @@ class DelveEffect extends OneShotEffect { List exiledCards = exileFromGraveCost.getExiledCards(); if (exiledCards.size() > 0) { ManaPool manaPool = controller.getManaPool(); - manaPool.addMana(new Mana(0,0,0,0,0,exiledCards.size(),0), game, source); + manaPool.addMana(new Mana(0, 0, 0, 0, 0, exiledCards.size(), 0), game, source); manaPool.unlockManaType(ManaType.COLORLESS); String keyString = CardUtil.getCardZoneString("delvedCards", source.getSourceId(), game); + @SuppressWarnings("unchecked") List delvedCards = (List) game.getState().getValue(keyString); if (delvedCards == null) { game.getState().setValue(keyString, exiledCards);