mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
[VOW] fixed Savior of Ollenbock issues (fixes #8786)
This commit is contained in:
parent
f28643d0f6
commit
effdf14579
4 changed files with 102 additions and 3 deletions
|
@ -112,7 +112,7 @@ class SaviorOfOllenbockEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
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(
|
return player != null && exileZone != null && !exileZone.isEmpty() && player.moveCards(
|
||||||
exileZone.getCards(game), Zone.BATTLEFIELD, source, game,
|
exileZone.getCards(game), Zone.BATTLEFIELD, source, game,
|
||||||
false, false, true, null
|
false, false, true, null
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -239,7 +239,7 @@ public class TargetCard extends TargetObject {
|
||||||
Card card = game.getCard(id);
|
Card card = game.getCard(id);
|
||||||
return card != null
|
return card != null
|
||||||
&& zone != null && zone.match(game.getState().getZone(id))
|
&& 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) {
|
public boolean canTarget(UUID playerId, UUID id, Ability source, Cards cards, Game game) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class TargetCardInGraveyardOrBattlefield extends TargetCard {
|
||||||
if (!super.canTarget(id, source, game)) { // in graveyard first
|
if (!super.canTarget(id, source, game)) { // in graveyard first
|
||||||
Permanent permanent = game.getPermanent(id);
|
Permanent permanent = game.getPermanent(id);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
return filterBattlefield.match(permanent, game);
|
return filterBattlefield.match(permanent, source.getControllerId(), source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue