diff --git a/Mage.Sets/src/mage/cards/a/ArchelosLagoonMystic.java b/Mage.Sets/src/mage/cards/a/ArchelosLagoonMystic.java index baed9ca6fc..ab2bee4eee 100644 --- a/Mage.Sets/src/mage/cards/a/ArchelosLagoonMystic.java +++ b/Mage.Sets/src/mage/cards/a/ArchelosLagoonMystic.java @@ -78,7 +78,18 @@ class ArchelosLagoonMysticEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - return !source.getSourceId().equals(((EntersTheBattlefieldEvent) event).getTarget().getId()); + Permanent sourceObject = game.getPermanent(source.getSourceId()); + if (sourceObject == null) { + return false; + } + + Permanent targetObject = ((EntersTheBattlefieldEvent) event).getTarget(); + if (targetObject == null) { + return false; + } + + return !sourceObject.getId().equals(targetObject.getId()) + && sourceObject.isTapped() == this.tapped; } @Override diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/cmr/ArchelosLagoonMysticTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/cmr/ArchelosLagoonMysticTest.java new file mode 100644 index 0000000000..b637b9e747 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/cmr/ArchelosLagoonMysticTest.java @@ -0,0 +1,46 @@ +package org.mage.test.cards.single.cmr; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author JayDi85 + */ + +public class ArchelosLagoonMysticTest extends CardTestPlayerBase { + + @Test + public void test_Playable() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 2 + 2); // add lands before Archelos, Lagoon Mystic to ignore ETB effects + + // As long as Archelos, Lagoon Mystic is tapped, other permanents enter the battlefield tapped. + // As long as Archelos, Lagoon Mystic is untapped, other permanents enter the battlefield untapped. + addCard(Zone.BATTLEFIELD, playerA, "Archelos, Lagoon Mystic", 1); + // + addCard(Zone.HAND, playerA, "Grizzly Bears", 1); // {1}{G} + addCard(Zone.HAND, playerA, "Deranged Outcast", 1); // {1}{G} + + // first - untapped + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + checkPermanentTapped("untapped", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Archelos, Lagoon Mystic", false, 1); + checkPermanentTapped("untapped", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", false, 1); + + // prepare tapped mystic + attack(1, playerA, "Archelos, Lagoon Mystic", playerB); + checkPermanentTapped("tapped", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Archelos, Lagoon Mystic", true, 1); + + // second - tapped + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Deranged Outcast"); + waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN); + checkPermanentTapped("tapped", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Archelos, Lagoon Mystic", true, 1); + checkPermanentTapped("tapped", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Deranged Outcast", true, 1); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + } +} 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 e34fcf1649..8e27ddeed2 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 @@ -1956,7 +1956,7 @@ public class TestPlayer implements Player { int index = 0; for (Map.Entry entry : rEffects.entrySet()) { if (entry.getValue().startsWith(choice)) { - choices.remove(choice); + choices.remove(0); return index; } index++;