From 9c59ec698d0b480195ba2a5e3bd851f9dbef216b Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Sun, 4 Sep 2022 20:35:19 -0400 Subject: [PATCH] [GRN] Fix Wand of Vertebrae not working properly. Closes #9464 --- .../src/mage/cards/w/WandOfVertebrae.java | 44 ++----------------- .../cards/single/grn/WandOfVertebraeTest.java | 42 ++++++++++++++++++ 2 files changed, 45 insertions(+), 41 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/grn/WandOfVertebraeTest.java diff --git a/Mage.Sets/src/mage/cards/w/WandOfVertebrae.java b/Mage.Sets/src/mage/cards/w/WandOfVertebrae.java index 11e5cb7e6e..df11d67b5f 100644 --- a/Mage.Sets/src/mage/cards/w/WandOfVertebrae.java +++ b/Mage.Sets/src/mage/cards/w/WandOfVertebrae.java @@ -8,6 +8,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.MillCardsControllerEffect; +import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -35,10 +36,7 @@ public final class WandOfVertebrae extends CardImpl { )); // {2}, {T}, Exile Wand of Vertebrae: Shuffle up to five target cards from your graveyard into your library. - Ability ability = new SimpleActivatedAbility( - new WandOfVertebraeEffect(), - new GenericManaCost(2) - ); + Ability ability = new SimpleActivatedAbility(new ShuffleIntoLibraryTargetEffect(), new GenericManaCost(2)); ability.addCost(new TapSourceCost()); ability.addCost(new ExileSourceCost()); ability.addTarget(new TargetCardInYourGraveyard(0, 5)); @@ -53,40 +51,4 @@ public final class WandOfVertebrae extends CardImpl { public WandOfVertebrae copy() { return new WandOfVertebrae(this); } -} - -class WandOfVertebraeEffect extends OneShotEffect { - - public WandOfVertebraeEffect() { - super(Outcome.Benefit); - this.staticText = "Shuffle up to five target cards " - + "from your graveyard into your library."; - } - - public WandOfVertebraeEffect(final WandOfVertebraeEffect effect) { - super(effect); - } - - @Override - public WandOfVertebraeEffect copy() { - return new WandOfVertebraeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - Cards cards = new CardsImpl(); - for (UUID targetId : targetPointer.getTargets(game, source)) { - Card card = game.getCard(targetId); - if (card != null) { - cards.add(card); - } - } - player.getLibrary().addAll(cards.getCards(game), game); - player.shuffleLibrary(source, game); - return true; - } -} +} \ No newline at end of file diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/grn/WandOfVertebraeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/grn/WandOfVertebraeTest.java new file mode 100644 index 0000000000..0749f8884c --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/grn/WandOfVertebraeTest.java @@ -0,0 +1,42 @@ +package org.mage.test.cards.single.grn; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * {T}: Mill a card. + * {2}, {T}, Exile Wand of Vertebrae: Shuffle up to five target cards from your graveyard into your library. + * + * @author Alex-Vasile + */ +public class WandOfVertebraeTest extends CardTestPlayerBase { + + private static final String wandOfVertebrae = "Wand of Vertebrae"; + + /** + * Reported bug: https://github.com/magefree/mage/issues/9464 + * + */ + @Test + public void canChoosePreviouslyBuggedCard() { + String lavaCoil = "Lava Coil"; + + addCard(Zone.BATTLEFIELD, playerA, wandOfVertebrae); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.GRAVEYARD, playerA, lavaCoil); + + setStrictChooseMode(true); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, {T}"); + addTarget(playerA, lavaCoil); + + setStopAt(1, PhaseStep.PRECOMBAT_MAIN); + execute(); + + assertExileCount(playerA, wandOfVertebrae, 1); + assertGraveyardCount(playerA, lavaCoil, 0); + assertLibraryCount(playerA, lavaCoil, 1); + } +}