From 6bded2404ef42dbbb7f91041f7ef48c0b391afe4 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 11 Feb 2019 15:00:36 -0600 Subject: [PATCH] - Fixed #5586. --- .../mage/cards/k/KaradorGhostChieftain.java | 11 +++++-- .../cards/asthough/CastFromLibraryTest.java | 30 ++++++++++++++++--- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/k/KaradorGhostChieftain.java b/Mage.Sets/src/mage/cards/k/KaradorGhostChieftain.java index db01b9f2226..2715dd70e89 100644 --- a/Mage.Sets/src/mage/cards/k/KaradorGhostChieftain.java +++ b/Mage.Sets/src/mage/cards/k/KaradorGhostChieftain.java @@ -1,4 +1,3 @@ - package mage.cards.k; import java.util.UUID; @@ -115,9 +114,11 @@ class KaradorGhostChieftainContinuousEffect extends ContinuousEffectImpl { return false; } for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) { + //if (!card.isLand()) { // cards like Dryad Arbor ContinuousEffect effect = new KaradorGhostChieftainCastFromGraveyardEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); + //} } return true; } @@ -148,10 +149,14 @@ class KaradorGhostChieftainCastFromGraveyardEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (objectId.equals(getTargetPointer().getFirst(game, source))) { + Card objectCard = game.getCard(objectId); + if (objectCard.getId().equals(getTargetPointer().getFirst(game, source)) + && objectCard.isCreature() + && objectCard.getSpellAbility() != null + && objectCard.getSpellAbility().spellCanBeActivatedRegularlyNow(affectedControllerId, game)) { if (affectedControllerId.equals(source.getControllerId())) { KaradorGhostChieftainWatcher watcher = game.getState().getWatcher(KaradorGhostChieftainWatcher.class, source.getSourceId()); - return watcher != null && !watcher.isAbilityUsed(); + return watcher != null && !watcher.isAbilityUsed(); } } return false; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java index 6482f1731a0..63380c9cce5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java @@ -1,4 +1,3 @@ - package org.mage.test.cards.asthough; import mage.constants.PhaseStep; @@ -14,17 +13,16 @@ public class CastFromLibraryTest extends CardTestPlayerBase { /** * Any creature that you cast through Vizier of the Menagerie (ie the card - * on top of your deck) is castable at instant speed. This means that they + * on top of your deck) is cast-able at instant speed. This means that they * can be cast on your opponent's turn, before you scry (and thus change the * top card), or even right before the Vizier gets destroyed by a fatal push * or similar. */ @Test - public void testVizierOfTheMenagerie() { + public void testVizierOfTheMenagerieWithGenericCreatures() { addCard(Zone.BATTLEFIELD, playerA, "Forest", 8); addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2); - // You may look at the top card of your library. (You may do this at any time.) // You may cast the top card of your library if it's a creature card. // You may spend mana as though it were mana of any type to cast creature spells. @@ -44,4 +42,28 @@ public class CastFromLibraryTest extends CardTestPlayerBase { assertLibraryCount(playerA, "Silvercoat Lion", 1); } + + @Test + public void testVizierOfTheMenagerieWithDryadArbor() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 8); + addCard(Zone.LIBRARY, playerA, "Dryad Arbor", 2); + // You may look at the top card of your library. (You may do this at any time.) + // You may cast the top card of your library if it's a creature card. + // You may spend mana as though it were mana of any type to cast creature spells. + addCard(Zone.HAND, playerA, "Vizier of the Menagerie", 1); // Creature 3/4 {3}{G} + + skipInitShuffling(); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vizier of the Menagerie"); + castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Dryad Arbor"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Dryad Arbor"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Vizier of the Menagerie", 1); + assertPermanentCount(playerA, "Dryad Arbor", 0); // can't be cast, only played + assertLibraryCount(playerA, "Dryad Arbor", 2); + + } }