From d8df53dde74897c2db4a1d19e77c0903d926a940 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 16 Jun 2015 14:41:28 +0200 Subject: [PATCH] Added some tests. --- .../abilities/activated/ReturnToHandTest.java | 43 ++++++++++++++- .../abilities/keywords/LandfallTest.java | 55 ++++++++++++++++++- .../common/FilterCreatureForCombatBlock.java | 3 - 3 files changed, 96 insertions(+), 5 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java index 7d4ea0d43cd..9864c33cfdb 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/ReturnToHandTest.java @@ -73,5 +73,46 @@ public class ReturnToHandTest extends CardTestPlayerBase { } + /** + * Return from graveyard to hand if you play a swamp + */ + @Test + public void VeilbornGhoulTest1() { + // Veilborn Ghoul can't block. + // Whenever a Swamp enters the battlefield under your control, you may return Veilborn Ghoul from your graveyard to your hand. + addCard(Zone.GRAVEYARD, playerA, "Veilborn Ghoul"); + addCard(Zone.HAND, playerA, "Swamp"); + + playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Swamp"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Swamp", 1); + assertHandCount(playerA, "Veilborn Ghoul", 1); + + } + /** + * Return from graveyard to hand if you play a non swamp land but Urborg, Tomb of Yawgmoth is in play + */ + @Test + public void VeilbornGhoulTest2() { + // Veilborn Ghoul can't block. + // Whenever a Swamp enters the battlefield under your control, you may return Veilborn Ghoul from your graveyard to your hand. + addCard(Zone.GRAVEYARD, playerA, "Veilborn Ghoul"); + addCard(Zone.HAND, playerA, "Flood Plain"); + + // Each land is a Swamp in addition to its other land types. + addCard(Zone.BATTLEFIELD, playerA, "Urborg, Tomb of Yawgmoth", 1); + + playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flood Plain"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Flood Plain", 1); + assertHandCount(playerA, "Veilborn Ghoul", 1); + + } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java index 0f4ab1f663b..5e3b1b177cc 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java @@ -146,5 +146,58 @@ public class LandfallTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Silvercoat Lion" , 1); } - + + @Test + public void testGroundswellWithoutLandfall() { + // Target creature gets +2/+2 until end of turn. + //Landfall - If you had a land enter the battlefield under your control this turn, that creature gets +4/+4 until end of turn instead. + addCard(Zone.HAND, playerB, "Groundswell",1); + addCard(Zone.BATTLEFIELD, playerB, "Forest",1); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion",1); + + attack(2, playerB, "Silvercoat Lion"); + castSpell(2, PhaseStep.DECLARE_ATTACKERS, playerB, "Groundswell", "Silvercoat Lion"); + + + setStopAt(2, PhaseStep.END_COMBAT); + execute(); + + assertPermanentCount(playerB, "Forest", 1); + assertGraveyardCount(playerB, "Groundswell" , 1); + + assertPermanentCount(playerB, "Silvercoat Lion" , 1); + assertPowerToughness(playerB, "Silvercoat Lion", 4, 4); + + assertLife(playerA, 16); // 2 + 4 + assertLife(playerB, 20); + } + + @Test + public void testGroundswellWithLandfall() { + // Target creature gets +2/+2 until end of turn. + //Landfall - If you had a land enter the battlefield under your control this turn, that creature gets +4/+4 until end of turn instead. + addCard(Zone.HAND, playerB, "Groundswell",1); + addCard(Zone.HAND, playerB, "Forest"); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion",1); + + + playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Forest"); + attack(2, playerB, "Silvercoat Lion"); + castSpell(2, PhaseStep.DECLARE_ATTACKERS, playerB, "Groundswell", "Silvercoat Lion"); + + + setStopAt(2, PhaseStep.END_COMBAT); + execute(); + + assertPermanentCount(playerB, "Forest", 1); + assertGraveyardCount(playerB, "Groundswell" , 1); + + assertPermanentCount(playerB, "Silvercoat Lion" , 1); + assertPowerToughness(playerB, "Silvercoat Lion", 6, 6); + + assertLife(playerA, 14); // 2 + 4 + assertLife(playerB, 20); + } } diff --git a/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java b/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java index d8ad11777f9..fc9bb9edbfc 100644 --- a/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java +++ b/Mage/src/mage/filter/common/FilterCreatureForCombatBlock.java @@ -29,10 +29,7 @@ package mage.filter.common; import mage.constants.AsThoughEffectType; -import mage.filter.predicate.ObjectPlayer; -import mage.filter.predicate.ObjectPlayerPredicate; import mage.filter.predicate.Predicate; -import mage.game.Controllable; import mage.game.Game; import mage.game.permanent.Permanent;