Fix Knowledge Pool exile target

This commit is contained in:
jmlundeen 2025-10-26 16:22:50 -05:00
parent 5bbcda3d4e
commit ef4d48a654
2 changed files with 63 additions and 2 deletions

View file

@ -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)) {

View file

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