From 77ab276d83de42e982bc63b3c28e52c7304e69d9 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Thu, 19 Sep 2019 14:11:12 +0000 Subject: [PATCH] Add Path to Exile, Act of Treason test (The player whose controller of the creature taken by Act of Treason in this test after casting Path to Exile to the creature is the one who will get the benefit of getting the land) --- .../ai/simulation/GameSimulatorTest.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java b/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java index 88dc275e257..0c92e4716ef 100644 --- a/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java +++ b/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java @@ -2055,4 +2055,42 @@ public class GameSimulatorTest extends SimulationTestCase { assertTrue(c2.getNetPower() == 4); assertTrue(c2.getNetToughness() == 4); } + + public void testPathtoExileActofTreason() { + Game game = initAndCreateGame(); + Player p0 = game.getPlayers().get(0); + Player p1 = game.getPlayers().get(1); + Card serraAngel = addCardToZone("Serra Angel", p1, ZoneType.Battlefield); + Card actOfTreason = addCardToZone("Act of Treason", p0, ZoneType.Hand); + Card pathToExile = addCardToZone("Path to Exile", p0, ZoneType.Hand); + for (int i = 0; i < 4; i++) { + addCardToZone("Plateau", p0, ZoneType.Battlefield); + } + addCardToZone("Island", p1, ZoneType.Library); + addCardToZone("Forest", p0, ZoneType.Library); + + game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p0); + game.getAction().checkStateEffects(true); + + GameSimulator sim = createSimulator(game, p0); + Game simGame = sim.getSimulatedGameState(); + + SpellAbility actSA = actOfTreason.getSpellAbilities().get(0); + assertNotNull(actSA); + actSA.setActivatingPlayer(p0); + actSA.setTargetCard(serraAngel); + sim.simulateSpellAbility(actSA); + simGame.getAction().checkStateEffects(true); + + SpellAbility pathSA = pathToExile.getSpellAbilities().get(0); + assertNotNull(pathSA); + pathSA.setActivatingPlayer(p0); + pathSA.setTargetCard(serraAngel); + sim.simulateSpellAbility(pathSA); + simGame.getAction().checkStateEffects(true); + + int numForest = countCardsWithName(simGame, "Forest"); + assertTrue(numForest == 1); + assertEquals(0, simGame.getPlayers().get(1).getCardsIn(ZoneType.Battlefield).size()); + } }