This commit is contained in:
Jeff 2019-02-11 15:00:36 -06:00
parent c8a4e7a46b
commit 6bded2404e
2 changed files with 34 additions and 7 deletions

View file

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

View file

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