From 693d5352f79fb09ed8e75ac3526636040c30263c Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Wed, 21 Dec 2022 00:45:00 -0600 Subject: [PATCH] Rath Dinen tests --- .../lotro/cards/GenericCardTestHelper.java | 103 ++++++++++++------ .../set_v00/Card_V0_001_ErrataTests.java | 91 ++++++++++++++++ 2 files changed, 161 insertions(+), 33 deletions(-) create mode 100644 gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v00/Card_V0_001_ErrataTests.java diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTestHelper.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTestHelper.java index 8d91f2797..d42b5eae4 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTestHelper.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTestHelper.java @@ -51,6 +51,7 @@ public class GenericCardTestHelper extends AbstractAtTest { public static final String FOTRFrodo = "1_290"; public static final String GimliRB = "9_4"; public static final String FOTRRing = "1_2"; + public static final String ATARRing = "4_1"; public static final String GreatRing = "19_1"; private final FilterFactory FilterFactory = new FilterFactory(); @@ -616,6 +617,9 @@ public class GenericCardTestHelper extends AbstractAtTest { } } + public void FreepsDismissRevealedCards() throws DecisionResultInvalidException { FreepsPassCurrentPhaseAction(); } + public void ShadowDismissRevealedCards() throws DecisionResultInvalidException { ShadowPassCurrentPhaseAction(); } + public void FreepsDeclineAssignments() throws DecisionResultInvalidException { FreepsPassCurrentPhaseAction(); } public void ShadowDeclineAssignments() throws DecisionResultInvalidException { ShadowPassCurrentPhaseAction(); } @@ -719,12 +723,31 @@ public class GenericCardTestHelper extends AbstractAtTest { playerDecided(player, String.join(",", bps)); } - public void FreepsChooseCardIDFromSelection(PhysicalCardImpl card) throws DecisionResultInvalidException { ChooseCardIDFromSelection(P1, card);} - public void ShadowChooseCardIDFromSelection(PhysicalCardImpl card) throws DecisionResultInvalidException { ChooseCardIDFromSelection(P2, card);} + public void FreepsChooseCardIDFromSelection(PhysicalCardImpl...cards) throws DecisionResultInvalidException { ChooseCardIDFromSelection(P1, cards);} + public void ShadowChooseCardIDFromSelection(PhysicalCardImpl...cards) throws DecisionResultInvalidException { ChooseCardIDFromSelection(P2, cards);} - public void ChooseCardIDFromSelection(String player, PhysicalCardImpl card) throws DecisionResultInvalidException { + public void ChooseCardIDFromSelection(String player, PhysicalCardImpl...cards) throws DecisionResultInvalidException { AwaitingDecision decision = _userFeedback.getAwaitingDecision(player); - playerDecided(player, "" + card.getCardId()); + //playerDecided(player, "" + card.getCardId()); + + String[] choices = GetAwaitingDecisionParam(player,"cardId"); + ArrayList ids = new ArrayList<>(); + ArrayList found = new ArrayList<>(); + + for (String choice : choices) { + for (PhysicalCardImpl card : cards) { + if (found.contains(card)) + continue; + + if (("" + card.getCardId()).equals(choice)) { + ids.add(choice); + found.add(card); + break; + } + } + } + + playerDecided(player, String.join(",", ids)); } public boolean IsCharAssigned(PhysicalCardImpl card) { @@ -815,6 +838,7 @@ public class GenericCardTestHelper extends AbstractAtTest { public void ShadowAcceptOptionalTrigger() throws DecisionResultInvalidException { playerDecided(P2, "0"); } public void ShadowDeclineOptionalTrigger() throws DecisionResultInvalidException { playerDecided(P2, ""); } + public void FreepsDeclineReconciliation() throws DecisionResultInvalidException { FreepsPassCurrentPhaseAction(); } public void ShadowDeclineReconciliation() throws DecisionResultInvalidException { ShadowPassCurrentPhaseAction(); } public void FreepsChooseYes() throws DecisionResultInvalidException { ChooseMultipleChoiceOption(P1, "Yes"); } @@ -888,38 +912,51 @@ public class GenericCardTestHelper extends AbstractAtTest { return _game.getModifiersQuerying().getOverwhelmMultiplier(_game, card); } + public void QuickSkip(int times) throws DecisionResultInvalidException { + for(int i = 0; i <= times; i++) { + SkipToPhase(Phase.REGROUP); + PassCurrentPhaseActions(); + ShadowDeclineReconciliation(); + FreepsChooseToMove(); + } + } + public void SkipToSite(int siteNum) throws DecisionResultInvalidException { for(int i = GetCurrentSite().getSiteNumber(); i < siteNum; i++) { - PhysicalCardImpl site = GetCurrentSite(); - - SkipToPhase(Phase.REGROUP); - if(i == 8) - return; // Game finished - PassCurrentPhaseActions(); - if(ShadowDecisionAvailable("reconcile")) - { - ShadowDeclineReconciliation(); - } - FreepsChooseToStay(); - if(FreepsDecisionAvailable("reconcile")) - { - FreepsChoose(""); //decline reconcile - } - - //Shadow player - SkipToPhase(Phase.REGROUP); - FreepsPassCurrentPhaseAction(); // actually shadow with the swap - if(FreepsDecisionAvailable("reconcile")) - { - FreepsChoose(""); //decline reconcile - } - ShadowChoose("1"); // Choose to stay - if(ShadowDecisionAvailable("reconcile")) - { - ShadowDeclineReconciliation(); - } - Assert.assertEquals(Phase.FELLOWSHIP, GetCurrentPhase()); + SkipCurrentSite(); } } + + public void SkipCurrentSite() throws DecisionResultInvalidException { + SkipToPhase(Phase.REGROUP); + PhysicalCardImpl site = GetCurrentSite(); + if(site.getSiteNumber() == 9) + return; // Game finished + PassCurrentPhaseActions(); + if(ShadowDecisionAvailable("reconcile")) + { + ShadowDeclineReconciliation(); + } + FreepsChooseToStay(); + if(FreepsDecisionAvailable("reconcile")) + { + FreepsDeclineReconciliation(); + } + + //Shadow player + SkipToPhase(Phase.REGROUP); + FreepsPassCurrentPhaseAction(); // actually shadow with the swap + if(FreepsDecisionAvailable("reconcile")) + { + FreepsDeclineReconciliation(); + } + ShadowChoose("1"); // Choose to stay + if(ShadowDecisionAvailable("reconcile")) + { + ShadowDeclineReconciliation(); + } + Assert.assertTrue(GetCurrentPhase() == Phase.BETWEEN_TURNS + || GetCurrentPhase() == Phase.FELLOWSHIP); + } } diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v00/Card_V0_001_ErrataTests.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v00/Card_V0_001_ErrataTests.java new file mode 100644 index 000000000..bf76b53ff --- /dev/null +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v00/Card_V0_001_ErrataTests.java @@ -0,0 +1,91 @@ +package com.gempukku.lotro.cards.unofficial.pc.vsets.set_v00; + +import com.gempukku.lotro.cards.GenericCardTestHelper; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.SitesBlock; +import com.gempukku.lotro.game.CardNotFoundException; +import com.gempukku.lotro.game.PhysicalCardImpl; +import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; +import org.junit.Test; + +import java.util.HashMap; + +import static org.junit.Assert.*; + +public class Card_V0_001_ErrataTests +{ + + protected GenericCardTestHelper GetScenario() throws CardNotFoundException, DecisionResultInvalidException { + return new GenericCardTestHelper( + new HashMap() + {{ + put("dummy", "1_311"); + }}, + new HashMap<>() {{ + put("East Road", "11_236"); + put("Ettenmoors", "11_237"); + put("Rath Dínen", "100_1"); + put("site4", "11_238"); + put("site5", "11_238"); + put("site6", "11_238"); + put("site7", "11_238"); + put("site8", "11_238"); + put("site9", "11_238"); + }}, + GenericCardTestHelper.FOTRFrodo, + GenericCardTestHelper.ATARRing, + "open" + ); + } + + @Test + public void RathDinenStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException { + + /** + * Set: V0 + * Title: Rath Dinen + * Side: Site + * Culture: + * Twilight Cost: 0 + * Type: site + * Subtype: Standard + * Game Text: When sanctuary healing at this site, the Free Peoples player heals only 3 wounds instead of 5. + */ + + //Pre-game setup + GenericCardTestHelper scn = GetScenario(); + + PhysicalCardImpl rath = scn.GetFreepsSite("Rath Dínen"); + + assertFalse(rath.getBlueprint().isUnique()); + assertEquals(CardType.SITE, rath.getBlueprint().getCardType()); + assertEquals(SitesBlock.SHADOWS, rath.getBlueprint().getSiteBlock()); + assertEquals(0, rath.getBlueprint().getTwilightCost()); + } + + @Test + public void SantuaryHealingOnlyHeals3() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTestHelper scn = GetScenario(); + + PhysicalCardImpl frodo = scn.GetRingBearer(); + PhysicalCardImpl site1 = scn.GetFreepsSite("East Road"); + PhysicalCardImpl site2 = scn.GetShadowSite("Ettenmoors"); + PhysicalCardImpl rath = scn.GetShadowSite("Rath Dínen"); + + scn.FreepsChooseCardBPFromSelection(site1); + scn.SkipStartingFellowships(); + scn.AddWoundsToChar(frodo, 5); + + scn.StartGame(); + scn.FreepsPassCurrentPhaseAction(); + scn.ShadowChooseCardBPFromSelection(site2); + scn.SkipCurrentSite(); + scn.FreepsPassCurrentPhaseAction(); + scn.ShadowChooseCardBPFromSelection(rath); + scn.SkipCurrentSite(); + + assertTrue(scn.FreepsDecisionAvailable("Sanctuary healing - Choose companion to heal - remaining heals: 3")); + + } +}