From c449a9b2fd466dc01535be81d60993ea3f1fb75b Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 17 Aug 2014 02:48:19 +0200 Subject: [PATCH] Some tests and minor formatting. --- .../src/mage/sets/mirrodin/WrenchMind.java | 3 - .../cards/abilities/keywords/PersistTest.java | 73 +++++++++++++++++++ .../java/org/mage/test/player/TestPlayer.java | 2 + 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/mirrodin/WrenchMind.java b/Mage.Sets/src/mage/sets/mirrodin/WrenchMind.java index 1f8c07f0f6a..958dc8b6b0a 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/WrenchMind.java +++ b/Mage.Sets/src/mage/sets/mirrodin/WrenchMind.java @@ -35,12 +35,9 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; -import mage.filter.common.FilterArtifactCard; import mage.game.Game; import mage.players.Player; -import mage.target.Target; import mage.target.TargetPlayer; -import mage.target.common.TargetCardInHand; import mage.target.common.TargetDiscard; /** diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java index 2461c00f1dc..21731614903 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java @@ -10,6 +10,7 @@ import junit.framework.Assert; import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; +import mage.filter.Filter; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -90,5 +91,77 @@ public class PersistTest extends CardTestPlayerBase { } + @Test + public void testInteractionWithLifelink() { + + // Kitchen Finks 3/2 {1}{G/W}{G/W} + // Creature - Ouphe + // When Kitchen Finks enters the battlefield, you gain 2 life. + // Persist (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.) + // + // Persist + addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 1); + + /** + * Deathtouch, lifelink + * When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with + * deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield. + */ + addCard(Zone.BATTLEFIELD, playerB, "Wurmcoil Engine",1); + + attack(2, playerB, "Wurmcoil Engine"); + block(2, playerA, "Kitchen Finks", "Wurmcoil Engine"); + + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerB, "Wurmcoil Engine", 1); + assertPermanentCount(playerA, "Kitchen Finks", 1); + assertPowerToughness(playerA, "Kitchen Finks", 2,1); + + assertLife(playerA, 22); // Kitchen Finks +2 life + assertLife(playerB, 26); // Wurmcoil Engine +6 ife + + } + + + @Test + public void testInteractionWithToporOrb() { + + // Kitchen Finks 3/2 {1}{G/W}{G/W} + // Creature - Ouphe + // When Kitchen Finks enters the battlefield, you gain 2 life. + // Persist (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.) + // + // Persist + addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 2); + + /** + * Deathtouch, lifelink + * When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with + * deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield. + */ + addCard(Zone.BATTLEFIELD, playerB, "Wurmcoil Engine",1); + addCard(Zone.BATTLEFIELD, playerB, "Torpor Orb",1); + + attack(2, playerB, "Wurmcoil Engine"); + block(2, playerA, "Kitchen Finks", "Wurmcoil Engine"); + block(2, playerA, "Kitchen Finks", "Wurmcoil Engine"); + + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerB, "Wurmcoil Engine", 0); + assertPermanentCount(playerB, "Wurm", 2); + assertPermanentCount(playerA, "Kitchen Finks", 2); + assertPowerToughness(playerA, "Kitchen Finks", 2,1, Filter.ComparisonScope.Any); + assertPowerToughness(playerA, "Kitchen Finks", 3,2, Filter.ComparisonScope.Any); + + assertLife(playerA, 20); // No life from Kitchen Finks ETB becaus of Torpor Orb + assertLife(playerB, 22); // AI assigns damage only 2 damage to one blocker so only 2 life link (It's a kind of bug (or bad play) of AI) + + } + + // some tests were moved to LastKnownInformationTest } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index cbb1994fdf8..bd6bc86f13e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -61,6 +61,7 @@ import java.util.Map; import java.util.UUID; import mage.filter.predicate.Predicates; import mage.filter.predicate.permanent.AttackingPredicate; +import mage.filter.predicate.permanent.BlockingPredicate; /** * @@ -199,6 +200,7 @@ public class TestPlayer extends ComputerPlayer { String[] groups = command.split(";"); FilterCreatureForCombatBlock filterBlocker = new FilterCreatureForCombatBlock(); filterBlocker.add(new NamePredicate(groups[0])); + filterBlocker.add(Predicates.not(new BlockingPredicate())); Permanent blocker = findPermanent(filterBlocker, playerId, game); if (blocker != null) { FilterAttackingCreature filterAttacker = new FilterAttackingCreature();