diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/at/AmbushAtTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/at/AmbushAtTest.java new file mode 100644 index 000000000..a93dc32cc --- /dev/null +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/at/AmbushAtTest.java @@ -0,0 +1,65 @@ +package com.gempukku.lotro.at; + +import com.gempukku.lotro.common.Zone; +import com.gempukku.lotro.game.PhysicalCardImpl; +import com.gempukku.lotro.logic.decisions.AwaitingDecision; +import com.gempukku.lotro.logic.decisions.AwaitingDecisionType; +import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; +import org.junit.Test; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import static junit.framework.Assert.*; + +public class AmbushAtTest extends AbstractAtTest { + @Test + public void cantPlayIfNotEnoughAndCantExertAnything() throws DecisionResultInvalidException { + Map> extraCards = new HashMap>(); + initializeSimplestGame(extraCards); + + PhysicalCardImpl gimli = new PhysicalCardImpl(100, "5_7", P1, _library.getLotroCardBlueprint("5_7")); + PhysicalCardImpl desertLegion = new PhysicalCardImpl(101, "4_218", P2, _library.getLotroCardBlueprint("4_218")); + + skipMulligans(); + + // Fellowship phase + _game.getGameState().addCardToZone(_game, gimli, Zone.FREE_CHARACTERS); + playerDecided(P1, ""); + + // Shadow phase + _game.getGameState().addCardToZone(_game, desertLegion, Zone.SHADOW_CHARACTERS); + playerDecided(P2, ""); + + // End maneuver phase + playerDecided(P1, ""); + playerDecided(P2, ""); + + // End archery phase + playerDecided(P1, ""); + playerDecided(P2, ""); + + // End assignment phase + playerDecided(P1, ""); + playerDecided(P2, ""); + + // Assign + playerDecided(P1, gimli.getCardId() + " " + desertLegion.getCardId()); + + // FP player gets no Ambush trigger + assertNull(_userFeedback.getAwaitingDecision(P1)); + + // Shadow player gets an Ambush trigger + AwaitingDecision ambushTriggerDecision = _userFeedback.getAwaitingDecision(P2); + assertEquals(AwaitingDecisionType.CARD_ACTION_CHOICE, ambushTriggerDecision.getDecisionType()); + validateContents(new String[]{"" + desertLegion.getCardId()}, (String[]) ambushTriggerDecision.getDecisionParameters().get("cardId")); + assertTrue(((String[]) ambushTriggerDecision.getDecisionParameters().get("actionText"))[0].startsWith("Ambush ")); + + assertEquals(3, _game.getGameState().getTwilightPool()); + + playerDecided(P2, getCardActionId(ambushTriggerDecision, "Ambush ")); + + assertEquals(4, _game.getGameState().getTwilightPool()); + } +} diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/at/ArcheryAtTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/at/ArcheryAtTest.java index e5a419edd..0e4619649 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/at/ArcheryAtTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/at/ArcheryAtTest.java @@ -6,13 +6,14 @@ import com.gempukku.lotro.game.PhysicalCardImpl; import com.gempukku.lotro.logic.decisions.AwaitingDecision; import com.gempukku.lotro.logic.decisions.AwaitingDecisionType; import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; -import static junit.framework.Assert.assertEquals; import org.junit.Test; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import static junit.framework.Assert.assertEquals; + public class ArcheryAtTest extends AbstractAtTest { @Test public void archeryWorksBothWays() throws DecisionResultInvalidException { @@ -54,4 +55,49 @@ public class ArcheryAtTest extends AbstractAtTest { assertEquals(1, _game.getGameState().getWounds(archerMinion)); assertEquals(Phase.ASSIGNMENT, _game.getGameState().getCurrentPhase()); } + + @Test + public void archeryBonusesDontLeakToOtherSide() throws DecisionResultInvalidException { + Map> extraCards = new HashMap>(); + initializeSimplestGame(extraCards); + + PhysicalCardImpl legolas = new PhysicalCardImpl(100, "1_51", P1, _library.getLotroCardBlueprint("1_51")); + PhysicalCardImpl archerMinion = new PhysicalCardImpl(101, "4_138", P2, _library.getLotroCardBlueprint("4_138")); + PhysicalCardImpl doubleShot = new PhysicalCardImpl(102, "1_38", P1, _library.getLotroCardBlueprint("1_38")); + + skipMulligans(); + + _game.getGameState().addCardToZone(_game, legolas, Zone.FREE_CHARACTERS); + _game.getGameState().addCardToZone(_game, doubleShot, Zone.HAND); + + // End fellowship phase + assertEquals(Phase.FELLOWSHIP, _game.getGameState().getCurrentPhase()); + playerDecided(P1, ""); + + _game.getGameState().addCardToZone(_game, archerMinion, Zone.SHADOW_CHARACTERS); + + // End shadow phase + assertEquals(Phase.SHADOW, _game.getGameState().getCurrentPhase()); + playerDecided(P2, ""); + + // End maneuver phase + playerDecided(P1, ""); + playerDecided(P2, ""); + + // Play Double Shot + playerDecided(P1, "0"); + // End archery phase + playerDecided(P2, ""); + playerDecided(P1, ""); + + AwaitingDecision archeryWoundDecision = _userFeedback.getAwaitingDecision(P1); + assertEquals(AwaitingDecisionType.CARD_SELECTION, archeryWoundDecision.getDecisionType()); + assertEquals(2, ((String[]) archeryWoundDecision.getDecisionParameters().get("cardId")).length); + + playerDecided(P1, String.valueOf(legolas.getCardId())); + + assertEquals(1, _game.getGameState().getWounds(legolas)); + assertEquals(2, _game.getGameState().getWounds(archerMinion)); + assertEquals(Phase.ASSIGNMENT, _game.getGameState().getCurrentPhase()); + } }