From 5fb08958f22efee7d59a77c3231e31839ad2d096 Mon Sep 17 00:00:00 2001 From: Derek Monturo Date: Wed, 10 May 2017 15:08:36 -0400 Subject: [PATCH] UT for #3328 unable to duplicate issue with priv position --- .../test/combat/AttackPlaneswalkerTest.java | 34 +++++++++ .../multiplayer/PrivilegedPositionTest.java | 70 +++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 Mage.Tests/src/test/java/org/mage/test/multiplayer/PrivilegedPositionTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/combat/AttackPlaneswalkerTest.java b/Mage.Tests/src/test/java/org/mage/test/combat/AttackPlaneswalkerTest.java index b4041ceac8..91bbdb0d48 100644 --- a/Mage.Tests/src/test/java/org/mage/test/combat/AttackPlaneswalkerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/combat/AttackPlaneswalkerTest.java @@ -27,6 +27,7 @@ */ package org.mage.test.combat; +import mage.abilities.keyword.HexproofAbility; import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; @@ -95,6 +96,39 @@ public class AttackPlaneswalkerTest extends CardTestPlayerBase { assertCounterCount("Kiora, the Crashing Wave", CounterType.LOYALTY, 1); } + /* + * Reported bug: see issue #3328 + * Players unable to attack Planeswalker with Privileged Position on battlefield. + */ + @Test + public void testAttackPlaneswalkerWithHexproofPrivilegedPosition() { + + /* + Privileged Position {2}{G/W}{G/W}{G/W} + Enchantment + Other permanents you control have hexproof. + */ + String pPosition = "Privileged Position"; + String sorin = "Sorin, Solemn Visitor"; // planeswalker {2}{W}{B} 4 loyalty + String memnite = "Memnite"; // {0} 1/1 + + addCard(Zone.BATTLEFIELD, playerB, pPosition); + addCard(Zone.BATTLEFIELD, playerB, sorin); + addCard(Zone.BATTLEFIELD, playerA, memnite); + + attack(3, playerA, memnite, sorin); + + setStopAt(3, PhaseStep.END_COMBAT); + execute(); + + assertPermanentCount(playerB, pPosition, 1); + assertPermanentCount(playerB, sorin, 1); + assertTapped(memnite, true); + assertLife(playerB, 20); + assertCounterCount(sorin, CounterType.LOYALTY, 3); + assertAbility(playerB, sorin, HexproofAbility.getInstance(), true); + } + /** * Tests that attacking a planeswalker triggers and resolves Silent Skimmer * correctly diff --git a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PrivilegedPositionTest.java b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PrivilegedPositionTest.java new file mode 100644 index 0000000000..b935b12442 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PrivilegedPositionTest.java @@ -0,0 +1,70 @@ +package org.mage.test.multiplayer; + +import mage.abilities.keyword.HexproofAbility; +import mage.constants.MultiplayerAttackOption; +import mage.constants.PhaseStep; +import mage.constants.RangeOfInfluence; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.FreeForAll; +import mage.game.Game; +import mage.game.GameException; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestMultiPlayerBase; + +import java.io.FileNotFoundException; + +/** + * Created by escplan9 + */ +public class PrivilegedPositionTest extends CardTestMultiPlayerBase { + + @Override + protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { + Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 40); + // Player order: A -> D -> C -> B + playerA = createPlayer(game, playerA, "PlayerA"); + playerB = createPlayer(game, playerB, "PlayerB"); + playerC = createPlayer(game, playerC, "PlayerC"); + playerD = createPlayer(game, playerD, "PlayerD"); + return game; + } + + /* + * Reported bug: see issue #3328 + * Players unable to attack Planeswalker with Privileged Position on battlefield. + */ + @Test + public void testAttackPlaneswalkerWithHexproofPrivilegedPosition() { + + /* + Privileged Position {2}{G/W}{G/W}{G/W} + Enchantment + Other permanents you control have hexproof. + */ + String pPosition = "Privileged Position"; + String sorin = "Sorin, Solemn Visitor"; // planeswalker {2}{W}{B} 4 loyalty + String memnite = "Memnite"; // {0} 1/1 + + addCard(Zone.BATTLEFIELD, playerD, pPosition); + addCard(Zone.BATTLEFIELD, playerD, sorin); + addCard(Zone.BATTLEFIELD, playerA, memnite); + addCard(Zone.BATTLEFIELD, playerB, memnite); + addCard(Zone.BATTLEFIELD, playerC, memnite); + + // Player order: A -> D -> C -> B + attack(1, playerA, memnite, sorin); + attack(3, playerC, memnite, sorin); + attack(4, playerB, memnite, sorin); + + setStopAt(4, PhaseStep.END_COMBAT); + execute(); + + assertPermanentCount(playerD, pPosition, 1); + assertPermanentCount(playerD, sorin, 1); + assertTappedCount(memnite, true, 3); + assertLife(playerD, 40); + assertCounterCount(sorin, CounterType.LOYALTY, 1); + assertAbility(playerD, sorin, HexproofAbility.getInstance(), true); + } +}