diff --git a/Mage.Sets/src/mage/cards/s/SaviorOfOllenbock.java b/Mage.Sets/src/mage/cards/s/SaviorOfOllenbock.java index 98b39e5a0b..c1e8fdd262 100644 --- a/Mage.Sets/src/mage/cards/s/SaviorOfOllenbock.java +++ b/Mage.Sets/src/mage/cards/s/SaviorOfOllenbock.java @@ -112,7 +112,7 @@ class SaviorOfOllenbockEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source)); + ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source, -1)); return player != null && exileZone != null && !exileZone.isEmpty() && player.moveCards( exileZone.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/vow/SaviorOfOllenbockTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/vow/SaviorOfOllenbockTest.java new file mode 100644 index 0000000000..7ae499f98b --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/vow/SaviorOfOllenbockTest.java @@ -0,0 +1,99 @@ +package org.mage.test.cards.single.vow; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author TheElk801 + */ +public class SaviorOfOllenbockTest extends CardTestPlayerBase { + private static final String savior = "Savior of Ollenbock"; + private static final String lion = "Silvercoat Lion"; + private static final String bear = "Grizzly Bears"; + private static final String murder = "Murder"; + + @Test + public void test_ExilePermanent() { + addCard(Zone.BATTLEFIELD, playerA, savior); + addCard(Zone.BATTLEFIELD, playerA, lion); + + attack(1, playerA, savior); + attack(1, playerA, lion); + addTarget(playerA, lion); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertExileCount(playerA, lion, 1); + } + + @Test + public void test_ExileCard() { + addCard(Zone.BATTLEFIELD, playerA, savior); + addCard(Zone.BATTLEFIELD, playerA, lion); + addCard(Zone.GRAVEYARD, playerA, bear); + + attack(1, playerA, savior); + attack(1, playerA, lion); + addTarget(playerA, bear); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertExileCount(playerA, bear, 1); + } + + @Test + public void test_ExilePermanentAndReturn() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); + addCard(Zone.BATTLEFIELD, playerA, savior); + addCard(Zone.BATTLEFIELD, playerA, lion); + addCard(Zone.HAND, playerA, murder); + + attack(1, playerA, savior); + attack(1, playerA, lion); + addTarget(playerA, lion); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, murder, savior); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertPermanentCount(playerA, savior, 0); + assertPermanentCount(playerA, lion, 1); + assertGraveyardCount(playerA, murder, 1); + } + + @Test + public void test_ExileCardAndReturn() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); + addCard(Zone.BATTLEFIELD, playerA, savior); + addCard(Zone.BATTLEFIELD, playerA, lion); + addCard(Zone.GRAVEYARD, playerB, bear); + addCard(Zone.HAND, playerA, murder); + + attack(1, playerA, savior); + attack(1, playerA, lion); + addTarget(playerA, bear); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, murder, savior); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertPermanentCount(playerA, savior, 0); + assertPermanentCount(playerA, lion, 1); + assertPermanentCount(playerB, bear, 1); + assertGraveyardCount(playerA, murder, 1); + } +} diff --git a/Mage/src/main/java/mage/target/TargetCard.java b/Mage/src/main/java/mage/target/TargetCard.java index cbcff16d39..c2dfee9e96 100644 --- a/Mage/src/main/java/mage/target/TargetCard.java +++ b/Mage/src/main/java/mage/target/TargetCard.java @@ -239,7 +239,7 @@ public class TargetCard extends TargetObject { Card card = game.getCard(id); return card != null && zone != null && zone.match(game.getState().getZone(id)) - && getFilter() != null && getFilter().match(card, playerId, game); + && getFilter() != null && getFilter().match(card, playerId, source, game); } public boolean canTarget(UUID playerId, UUID id, Ability source, Cards cards, Game game) { diff --git a/Mage/src/main/java/mage/target/common/TargetCardInGraveyardOrBattlefield.java b/Mage/src/main/java/mage/target/common/TargetCardInGraveyardOrBattlefield.java index a8ff770be6..09d692361c 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInGraveyardOrBattlefield.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInGraveyardOrBattlefield.java @@ -54,7 +54,7 @@ public class TargetCardInGraveyardOrBattlefield extends TargetCard { if (!super.canTarget(id, source, game)) { // in graveyard first Permanent permanent = game.getPermanent(id); if (permanent != null) { - return filterBattlefield.match(permanent, game); + return filterBattlefield.match(permanent, source.getControllerId(), source, game); } } return true;