diff --git a/Mage.Sets/src/mage/cards/k/KnowledgePool.java b/Mage.Sets/src/mage/cards/k/KnowledgePool.java index e553c7110c3..f7855166fc0 100644 --- a/Mage.Sets/src/mage/cards/k/KnowledgePool.java +++ b/Mage.Sets/src/mage/cards/k/KnowledgePool.java @@ -1,5 +1,6 @@ package mage.cards.k; +import mage.ApprovingObject; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -26,7 +27,6 @@ import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; import java.util.UUID; -import mage.ApprovingObject; /** * @author BetaSteward_at_googlemail.com @@ -181,7 +181,7 @@ class KnowledgePoolExileAndPlayEffect extends OneShotEffect { FilterNonlandCard filter = new FilterNonlandCard("nonland card exiled with Knowledge Pool"); filter.add(Predicates.not(new CardIdPredicate(spell.getSourceId()))); - TargetCardInExile target = new TargetCardInExile(0, 1, filter, source.getSourceId()); + TargetCardInExile target = new TargetCardInExile(0, 1, filter, exileZoneId); target.withNotTarget(true); if (!spellController.choose(Outcome.PlayForFree, game.getExile().getExileZone(exileZoneId), target, source, game)) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/mbs/KnowledgePoolTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/mbs/KnowledgePoolTest.java new file mode 100644 index 00000000000..746e487577a --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/mbs/KnowledgePoolTest.java @@ -0,0 +1,61 @@ +package org.mage.test.cards.single.mbs; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author Jmlundeen + */ +public class KnowledgePoolTest extends CardTestPlayerBase { + + /* + Knowledge Pool + {6} + Artifact + Imprint - When Knowledge Pool enters the battlefield, each player exiles the top three cards of their library. + Whenever a player casts a spell from their hand, that player exiles it. If the player does, they may cast another nonland card exiled with Knowledge Pool without paying that card's mana cost. + */ + private static final String knowledgePool = "Knowledge Pool"; + + /* + Lightning Bolt + {R} + Instant + Lightning Bolt deals 3 damage to any target. + */ + private static final String lightningBolt = "Lightning Bolt"; + + /* + Shock + {R} + Instant + Shock deals 2 damage to any target. + */ + private static final String shock = "Shock"; + + @Test + public void testKnowledgePool() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain"); + addCard(Zone.BATTLEFIELD, playerB, "Mountain"); + addCard(Zone.BATTLEFIELD, playerA, knowledgePool); + addCard(Zone.HAND, playerA, lightningBolt); + addCard(Zone.HAND, playerB, shock); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, lightningBolt, playerB); + setChoice(playerA, false); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, shock, playerA); + setChoice(playerB, true); + setChoice(playerB, lightningBolt); + addTarget(playerB, playerA); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertLife(playerA, 20 - 3); // shock exiled, bolt cast from knowledge pool + assertLife(playerB, 20); // bolt exiled, no card to cast from knowledge pool + } +} \ No newline at end of file