diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Tatterkite.java b/Mage.Sets/src/mage/sets/shadowmoor/Tatterkite.java index 781d2d7608f..27c846f33a5 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Tatterkite.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Tatterkite.java @@ -32,7 +32,6 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; -import mage.abilities.effects.common.ruleModifying.CantRegenerateTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.constants.CardType; @@ -59,10 +58,10 @@ public class Tatterkite extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - + // Tatterkite can't have counters placed on it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantHaveCountersSourceEffect(Duration.WhileOnBattlefield, "it"))); - + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantHaveCountersSourceEffect(Duration.WhileOnBattlefield))); + } public Tatterkite(final Tatterkite card) { @@ -77,7 +76,7 @@ public class Tatterkite extends CardImpl { class CantHaveCountersSourceEffect extends ContinuousRuleModifyingEffectImpl { - public CantHaveCountersSourceEffect(Duration duration, String objectText) { + public CantHaveCountersSourceEffect(Duration duration) { super(duration, Outcome.Detriment); staticText = "{this} can't have counters placed on it"; } @@ -91,14 +90,9 @@ class CantHaveCountersSourceEffect extends ContinuousRuleModifyingEffectImpl { return new CantHaveCountersSourceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ADD_COUNTER; + return event.getType() == EventType.ADD_COUNTERS; } @Override @@ -109,4 +103,4 @@ class CantHaveCountersSourceEffect extends ContinuousRuleModifyingEffectImpl { } return false; } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java index eca34b84cd3..31fc57868bf 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java @@ -11,7 +11,8 @@ import org.mage.test.serverside.base.CardTestPlayerBase; public class UndyingTest extends CardTestPlayerBase { /** - * Tests boost weren't be applied second time when creature back to battlefield + * Tests boost weren't be applied second time when creature back to + * battlefield */ @Test public void testWithBoost() { @@ -29,7 +30,8 @@ public class UndyingTest extends CardTestPlayerBase { } /** - * Tests boost weren't be applied second time when creature back to battlefield + * Tests boost weren't be applied second time when creature back to + * battlefield */ @Test public void testWithMassBoost() { @@ -62,7 +64,7 @@ public class UndyingTest extends CardTestPlayerBase { // Target creature gets -3/-3 until end of turn. addCard(Zone.HAND, playerA, "Last Gasp"); // Undying Evil - // Target creature gains undying until end of turn. + // Target creature gains undying until end of turn. // When it dies, if it had no +1/+1 counters on it, return it to the battlefield under its owner's control with a +1/+1 counter on it.) addCard(Zone.HAND, playerA, "Undying Evil"); @@ -76,9 +78,9 @@ public class UndyingTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Elite Vanguard", 3, 2); } - /** - * Tests "Threads of Disloyalty enchanting Strangleroot Geist: after geist died it returns to the bf under opponent's control." + * Tests "Threads of Disloyalty enchanting Strangleroot Geist: after geist + * died it returns to the bf under opponent's control." */ @Test public void testUndyingControlledReturnsToOwner() { @@ -105,18 +107,20 @@ public class UndyingTest extends CardTestPlayerBase { setStopAt(2, PhaseStep.END_TURN); execute(); - assertGraveyardCount(playerB, "Threads of Disloyalty", 1); - assertGraveyardCount(playerA, "Lightning Bolt",1); + assertGraveyardCount(playerB, "Threads of Disloyalty", 1); + assertGraveyardCount(playerA, "Lightning Bolt", 1); assertPermanentCount(playerB, "Strangleroot Geist", 0); assertPermanentCount(playerA, "Strangleroot Geist", 1); assertPowerToughness(playerA, "Strangleroot Geist", 3, 2); } /** - * Tests "Target creature with Undying will be exiled by Anafenza before it returns to battlefield - * - * Anafenza the foremost doesn't exile an undying creature when dying at the same time as - * that undying one. The undying comes back to the field when he shouldn't. + * Tests "Target creature with Undying will be exiled by Anafenza before it + * returns to battlefield + * + * Anafenza the foremost doesn't exile an undying creature when dying at the + * same time as that undying one. The undying comes back to the field when + * he shouldn't. */ @Test public void testReplacementEffectPreventsReturnOfUndying() { @@ -125,7 +129,7 @@ public class UndyingTest extends CardTestPlayerBase { // Creature - Zombie, 1/1 {1}{B} // Undying (When this creature dies, if it had no +1/+1 counters on it, return it to the battlefield under its owner's control with a +1/+1 counter on it.) addCard(Zone.HAND, playerA, "Butcher Ghoul"); - + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); addCard(Zone.HAND, playerB, "Lightning Bolt"); // Anafenza, the Foremost @@ -141,17 +145,18 @@ public class UndyingTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Anafenza, the Foremost", 1); assertGraveyardCount(playerB, "Lightning Bolt", 1); - + assertPermanentCount(playerA, "Butcher Ghoul", 0); assertExileCount("Butcher Ghoul", 1); } /** - * Tests "Target creature with Undying will be exiled by Anafenza before it returns to battlefield - * if both leave the battlefield at the same time + * Tests "Target creature with Undying will be exiled by Anafenza before it + * returns to battlefield if both leave the battlefield at the same time * - * Anafenza the foremost doesn't exile an undying creature when dying at the same time as - * that undying one. The undying comes back to the field when he shouldn't. + * Anafenza the foremost doesn't exile an undying creature when dying at the + * same time as that undying one. The undying comes back to the field when + * he shouldn't. */ @Test public void testReplacementEffectPreventsReturnOfUndyingWrath() { @@ -208,4 +213,33 @@ public class UndyingTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Silvercoat Lion", 4, 4); } + + /** + * Tatterkite is getting counters on it, i have him in a edh deck with + * Mikaeus, the Lunarch and when Tatterkite dies it triggers the undying and + * he gets the +1/+1 counters + */ + @Test + public void testUndyingMikaeusAndTatterkite() { + addCard(Zone.HAND, playerA, "Lightning Bolt", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + // Whenever a Human deals damage to you, destroy it. + // Other non-Human creatures you control get +1/+1 and have undying. + addCard(Zone.BATTLEFIELD, playerA, "Mikaeus, the Unhallowed", 1); + + addCard(Zone.BATTLEFIELD, playerA, "Tatterkite", 1); // Artifact Creature - Scarecrow 2/1 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Tatterkite"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Lightning Bolt", 1); + + assertPermanentCount(playerA, "Tatterkite", 1); + assertPermanentCount(playerA, "Mikaeus, the Unhallowed", 1); + assertPowerToughness(playerA, "Tatterkite", 3, 2); + + } + } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java index ecd169b3272..599b9f7f0aa 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java @@ -36,7 +36,6 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * * @author LevelX2 */ - public class AddingCountersToPermanentsTest extends CardTestPlayerBase { @Test @@ -47,7 +46,7 @@ public class AddingCountersToPermanentsTest extends CardTestPlayerBase { // Put X -1/-1 counters on each creature. Shuffle Black Sun's Zenith into its owner's library. addCard(Zone.HAND, playerA, "Black Sun's Zenith", 1); - + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); addCard(Zone.BATTLEFIELD, playerB, "Witch's Familiar", 1); @@ -59,14 +58,13 @@ public class AddingCountersToPermanentsTest extends CardTestPlayerBase { assertGraveyardCount(playerA, "Silvercoat Lion", 1); assertGraveyardCount(playerB, "Silvercoat Lion", 1); - - assertPermanentCount(playerA, "Witch's Familiar", 1); + + assertPermanentCount(playerA, "Witch's Familiar", 1); assertPowerToughness(playerA, "Witch's Familiar", 0, 1); - assertPermanentCount(playerB, "Witch's Familiar", 1); + assertPermanentCount(playerB, "Witch's Familiar", 1); assertPowerToughness(playerB, "Witch's Familiar", 0, 1); - } -} \ No newline at end of file +} diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index b72b534d449..56a2e90a133 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -602,10 +602,10 @@ public abstract class CardImpl extends MageObjectImpl implements Card { PermanentCard permanent = new PermanentCard(this, event.getPlayerId(), game); // make sure the controller of all continuous effects of this card are switched to the current controller game.getContinuousEffects().setController(objectId, event.getPlayerId()); - // check if there are counters to add to the permanent (e.g. from non replacement effects like Persist) - checkForCountersToAdd(permanent, game); game.addPermanent(permanent); setZone(Zone.BATTLEFIELD, game); + // check if there are counters to add to the permanent (e.g. from non replacement effects like Persist) + checkForCountersToAdd(permanent, game); game.setScopeRelevant(true); permanent.setTapped(tapped); permanent.setFaceDown(facedown, game);