diff --git a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java index 353bc8682e6..3b1a0392be3 100644 --- a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java +++ b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java @@ -96,7 +96,12 @@ class KalitasDestroyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (permanent != null && permanent.destroy(source.getSourceId(), game, false)) { // if not destroyed or moved to other zone (replacement effect) it returns false + if (permanent != null && permanent.destroy(source.getSourceId(), game, false)) { // if not destroyed it returns false + if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId()) + && !game.getState().getZone(permanent.getId()).equals(Zone.GRAVEYARD)) { + // A replacement effect has moved the card to another zone as grvayard + return true; + } new CreateTokenEffect(new KalitasVampireToken(permanent.getPower().getValue(), permanent.getToughness().getValue())).apply(game, source); } return true; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/KalitasBloodchiefOfGhetTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/KalitasBloodchiefOfGhetTest.java index ce58ce1b55d..ea8217863b9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/KalitasBloodchiefOfGhetTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/KalitasBloodchiefOfGhetTest.java @@ -6,20 +6,25 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; public class KalitasBloodchiefOfGhetTest extends CardTestPlayerBase { + @Test public void testTokenCreatedOnlyIfTargetDies() { + // {B}{B}{B}, {T}: Destroy target creature. If that creature dies this way, create a black Vampire creature token. + // Its power is equal to that creature's power and its toughness is equal to that creature's toughness. addCard(Zone.BATTLEFIELD, playerA, "Kalitas, Bloodchief of Ghet", 1); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); - addCard(Zone.BATTLEFIELD, playerA, "Rest in Peace", 1); - addCard(Zone.BATTLEFIELD, playerB, "Gray Ogre", 1); + // When Rest in Peace enters the battlefield, exile all cards from all graveyards. + // If a card or token would be put into a graveyard from anywhere, exile it instead. + addCard(Zone.BATTLEFIELD, playerA, "Rest in Peace", 1); // Enchantment + + addCard(Zone.BATTLEFIELD, playerB, "Gray Ogre", 1); // Creature - Ogre 2/2 activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{B}{B}{B}", "Gray Ogre"); setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); - assertPermanentCount(playerA, 5); - assertPermanentCount(playerB, 0); + assertPermanentCount(playerA, "Vampire", 0); } }