diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/PrizedAmalgam.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/PrizedAmalgam.java index a8cdc96a90d..d7474149370 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/PrizedAmalgam.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/PrizedAmalgam.java @@ -37,9 +37,11 @@ import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffec import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; +import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; @@ -49,6 +51,11 @@ import mage.game.events.GameEvent; * @author LevelX2 */ public class PrizedAmalgam extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature"); + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + } public PrizedAmalgam(UUID ownerId) { super(ownerId, 249, "Prized Amalgam", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}{B}"); @@ -59,7 +66,7 @@ public class PrizedAmalgam extends CardImpl { // Whenever a creature enters the battlefield, if it entered from your graveyard or you cast it from your graveyard, return Prized Amalgam from your graveyard to the battlefield tapped at the beginning of the next end step. this.addAbility(new PrizedAmalgamTriggerdAbility(new CreateDelayedTriggeredAbilityEffect( - new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnSourceFromGraveyardToBattlefieldEffect(true))), new FilterCreaturePermanent())); + new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnSourceFromGraveyardToBattlefieldEffect(true))), filter)); } public PrizedAmalgam(final PrizedAmalgam card) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/PrizedAmalgamTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/PrizedAmalgamTest.java new file mode 100644 index 00000000000..e2d02ad552f --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/PrizedAmalgamTest.java @@ -0,0 +1,82 @@ +package org.mage.test.cards.single.soi; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + *1UB +* Creature - Zombie +* Whenever a creature enters the battlefield, if it entered from your graveyard or you cast it from your graveyard, +* return Prized Amalgam from your graveyard to the battlefield tapped at the beginning of the next end step. + * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) + */ +public class PrizedAmalgamTest extends CardTestPlayerBase { + + /** + * Reanimated creature recurs Prized Amalgam + */ + @Test + public void testReanimation() { + + addCard(Zone.HAND, playerA, "Reanimate", 1); // {B} Put target creature card from a graveyard onto the battlefield under your control. You lose life equal to its converted mana cost. + addCard(Zone.GRAVEYARD, playerA, "Bronze Sable", 1); // (2) 2/1 + addCard(Zone.GRAVEYARD, playerA, "Prized Amalgam", 1); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate"); + addTarget(playerA, "Bronze Sable"); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 18); // loss of 2 from reanimate + assertGraveyardCount(playerA, "Reanimate", 1); + assertPermanentCount(playerA, "Bronze Sable", 1); + assertPermanentCount(playerA, "Prized Amalgam", 1); + assertTapped("Prized Amalgam", true); + } + + /** + * Reported bug - Gravecrawler cast from grave does not trigger Prized Amalgam. + */ + @Test + public void testGravecrawlerCastFromGrave() { + + addCard(Zone.GRAVEYARD, playerA, "Gravecrawler", 1); + addCard(Zone.GRAVEYARD, playerA, "Prized Amalgam", 1); + addCard(Zone.BATTLEFIELD, playerA, "Gnawing Zombie", 1); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gravecrawler"); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Gravecrawler", 1); + assertPermanentCount(playerA, "Prized Amalgam", 1); + assertTapped("Prized Amalgam", true); + } + + /** + * Reported bug - creature returned from opponent's graveyard to battlefield by Ojutai's Command incorrectly triggers Prized Amalgam + */ + @Test + public void testOpponentReturnsCreatureFromGrave() { + + addCard(Zone.HAND, playerA, "Reanimate", 1); + addCard(Zone.GRAVEYARD, playerA, "Hill Giant", 1); // {3}{R} 3/3 + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + addCard(Zone.GRAVEYARD, playerB, "Prized Amalgam", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate"); + addTarget(playerA, "Hill Giant"); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 16); // lose 4 life from reanimate 4 CMC + assertPermanentCount(playerA, "Hill Giant", 1); + assertPermanentCount(playerB, "Prized Amalgam", 0); // should not recur + assertGraveyardCount(playerB, "Prized Amalgam", 1); // stays in grave + } +}