diff --git a/Mage.Sets/src/mage/cards/c/CourtOfLocthwain.java b/Mage.Sets/src/mage/cards/c/CourtOfLocthwain.java index cab532de7cb..0793c17445a 100644 --- a/Mage.Sets/src/mage/cards/c/CourtOfLocthwain.java +++ b/Mage.Sets/src/mage/cards/c/CourtOfLocthwain.java @@ -195,8 +195,10 @@ class CourtOfLocthwainCastForFreeEffect extends AsThoughEffectImpl { UUID exileId = CourtOfLocthwain.getExileZoneId(mor, game); ExileZone exileZone = game.getExile().getExileZone(exileId); + + Card card = game.getCard(objectId); // Is the card attempted to be played in the ExiledZone? - if (exileZone == null || !exileZone.contains(objectId)) { + if (exileZone == null || card == null || !exileZone.contains(card.getMainCard().getId())) { return false; } // can this ability still be used this turn? diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/woc/CourtOfLocthwainTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/woc/CourtOfLocthwainTest.java index e27774ade10..03aa8b72042 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/woc/CourtOfLocthwainTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/woc/CourtOfLocthwainTest.java @@ -11,9 +11,9 @@ public class CourtOfLocthwainTest extends CardTestPlayerBase { * Court of Locthwain * {2}{B}{B} * Enchantment - * + *
* When Court of Locthwain enters the battlefield, you become the monarch. - * + *
* At the beginning of your upkeep, exile the top card of target opponent's library. You may play that card for as long as it remains exiled, and mana of any type can be spent to cast it. If you're the monarch, until end of turn, you may cast a spell from among cards exiled with Court of Locthwain without paying its mana cost. */ private static String court = "Court of Locthwain"; @@ -22,7 +22,7 @@ public class CourtOfLocthwainTest extends CardTestPlayerBase { * Armageddon * {3}{W} * Sorcery - * + *
* Destroy all lands. */ private static String armageddon = "Armageddon"; @@ -85,6 +85,35 @@ public class CourtOfLocthwainTest extends CardTestPlayerBase { assertTappedCount("Scrubland", true, 0); } + @Test + public void testMonarchChoiceCastMDFCForFree() { + setStrictChooseMode(true); + + addCard(Zone.HAND, playerA, court); + addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); + addCard(Zone.LIBRARY, playerB, "Fire // Ice"); + addCard(Zone.LIBRARY, playerB, "Island"); // playerB will draw it. + skipInitShuffling(); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, court); + + addTarget(playerA, playerB); // trigger target for turn 3 + checkExileCount("fire/ice got exiled", 3, PhaseStep.PRECOMBAT_MAIN, playerA, "Fire // Ice", 1); + + // We need to choose the proper AsThough, even if only one is valid. + setChoice(playerA, "Without paying manacost: "); + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Ice", "Grizzly Bears"); + + setStopAt(3, PhaseStep.BEGIN_COMBAT); + execute(); + + assertTappedCount("Swamp", true, 0); + assertGraveyardCount(playerB, "Fire // Ice", 1); + assertTappedCount("Grizzly Bears", true, 1); + assertHandCount(playerA, 1 + 1 + 1); // 1 regular draw, 1 with monarch trigger, 1 with Ice + } + @Test public void testMonarchChoiceCastForMana() { setStrictChooseMode(true);