* Sacred Ground - Fixed that the Sacred Ground effect did also move the land if it was removed from graveyard since the ability triggered.

This commit is contained in:
ludwig.hirth 2016-12-23 12:29:33 +01:00
parent decc5c190c
commit e5a5911c6e
2 changed files with 53 additions and 17 deletions

View file

@ -50,7 +50,6 @@ public class SacredGround extends CardImpl {
public SacredGround(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
// Whenever a spell or ability an opponent controls causes a land to be put into your graveyard from the battlefield, return that card to the battlefield.
this.addAbility(new SacredGroundTriggeredAbility());
}
@ -92,7 +91,7 @@ class SacredGroundTriggeredAbility extends TriggeredAbilityImpl {
if (Zone.BATTLEFIELD.equals(zce.getFromZone()) && Zone.GRAVEYARD.equals(zce.getToZone())) {
Permanent targetPermanent = zce.getTarget();
if (targetPermanent.getCardType().contains(CardType.LAND) && targetPermanent.getControllerId().equals(getControllerId())) {
getEffects().get(0).setTargetPointer(new FixedTarget(targetPermanent.getId()));
getEffects().get(0).setTargetPointer(new FixedTarget(targetPermanent.getId(), game.getState().getZoneChangeCounter(targetPermanent.getId())));
return true;
}
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
@ -40,10 +39,9 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
public class SacredGroundTest extends CardTestPlayerBase {
/**
* Sacred Ground {1}{W}
* Enchantment
* Whenever a spell or ability an opponent controls causes a land to be put into your
* graveyard from the battlefield, return that card to the battlefield.
* Sacred Ground {1}{W} Enchantment Whenever a spell or ability an opponent
* controls causes a land to be put into your graveyard from the
* battlefield, return that card to the battlefield.
*
*
* Destroyed land returns to battlefield
@ -76,10 +74,9 @@ public class SacredGroundTest extends CardTestPlayerBase {
}
/**
* Sacred Ground {1}{W}
* Enchantment
* Whenever a spell or ability an opponent controls causes a land to be put into your
* graveyard from the battlefield, return that card to the battlefield.
* Sacred Ground {1}{W} Enchantment Whenever a spell or ability an opponent
* controls causes a land to be put into your graveyard from the
* battlefield, return that card to the battlefield.
*
*
* Destroyed land returns to battlefield
@ -111,10 +108,9 @@ public class SacredGroundTest extends CardTestPlayerBase {
}
/**
* Sacred Ground {1}{W}
* Enchantment
* Whenever a spell or ability an opponent controls causes a land to be put into your
* graveyard from the battlefield, return that card to the battlefield.
* Sacred Ground {1}{W} Enchantment Whenever a spell or ability an opponent
* controls causes a land to be put into your graveyard from the
* battlefield, return that card to the battlefield.
*
*
* Destroyed land returns to battlefield
@ -144,4 +140,45 @@ public class SacredGroundTest extends CardTestPlayerBase {
assertLife(playerB, 24); // + 2 * 2 life from Kabira Crossroads
}
/**
* I was playing against Sacred Ground. I Molten Rained oponents land and
* responded Sacred Ground trigger by exiling it with Surgical Extraction.
* Then after that resolved, Sacred Ground ability put the land from exile
* onto the battfield! Fix this, please
*/
@Test
public void testWithSurgicalExtraction() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
// Destroy target land.
// If that land was nonbasic, Molten Rain deals 2 damage to the land's controller.
addCard(Zone.HAND, playerA, "Molten Rain");// Instant {1}{R}{R}
// Choose target card in a graveyard other than a basic land card. Search its owner's graveyard,
// hand, and library for any number of cards with the same name as that card and exile them.
// Then that player shuffles his or her library.
addCard(Zone.HAND, playerA, "Surgical Extraction"); // Instant {BP}
addCard(Zone.BATTLEFIELD, playerB, "Caves of Koilos", 1);
/**
* Whenever a spell or ability an opponent controls causes a land to be
* put into your graveyard from the battlefield, return that card to the
* battlefield.
*/
addCard(Zone.BATTLEFIELD, playerB, "Sacred Ground");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Molten Rain", "Caves of Koilos");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Surgical Extraction", "Caves of Koilos");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Molten Rain", 1);
assertGraveyardCount(playerA, "Surgical Extraction", 1);
assertExileCount("Caves of Koilos", 1);
assertLife(playerA, 20);
assertLife(playerB, 18);
}
}