From 87b27551b2173b338a93572406659760496f0e62 Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Thu, 28 Jan 2021 23:09:02 -0600 Subject: [PATCH] Adding phase 1 errata candidates with unit tests --- .../src/main/web/cards/set21/set1-errata.json | 132 ++++++++--------- .../gempukku/lotro/cards/GenericCardTest.java | 131 ++++++++++++----- .../pc/errata/Elrond_LoRErrataTest.java | 101 +++++++------ .../pc/errata/FlamingBrandErrataTest.java | 134 ++++++++++++++++++ .../pc/errata/Galadriel_LoLErrataTest.java | 90 ++++++++++++ .../pc/errata/Sam_SoHErrataTest.java | 71 ++++++++++ 6 files changed, 495 insertions(+), 164 deletions(-) create mode 100644 gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/FlamingBrandErrataTest.java create mode 100644 gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Galadriel_LoLErrataTest.java create mode 100644 gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Sam_SoHErrataTest.java diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/cards/set21/set1-errata.json b/gemp-lotr/gemp-lotr-async/src/main/web/cards/set21/set1-errata.json index 9314f8b55..1ac6cf340 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/cards/set21/set1-errata.json +++ b/gemp-lotr/gemp-lotr-async/src/main/web/cards/set21/set1-errata.json @@ -58,7 +58,7 @@ "effect": { "type": "heal", "filter": "choose(ally,allyHome(fellowship,6))", - "count": 2 + "count": "0-2" } }, { @@ -279,36 +279,18 @@ { "type": "activated", "phase": "fellowship", - "cost": [ - { - "type": "spot", + "condition": { + "type": "canSpot", "filter": "name(Frodo)" - }, - { + }, + "cost": { "type": "exert", "filter": "self", "times": 2 - } - ], - - "effect": { - "type": "preventable", - "text": "Would you like to discard a minion from hand (or place a Nazgul from hand on your draw deck) to prevent removing 2 burdens?", - "player": "shadowPlayer", - "cost": [ - { - "type": "putcardsfromhandontopofdeck", - "filter": "choose(nazgul)" - }, - { - "type": "discardFromHand", - "filter": "choose(minion)" - } - ], + }, "effect": { "type": "removeBurdens", - "amount": 2 - } + "amount": 1 } }, { @@ -347,8 +329,9 @@ { "type": "revealrandomcardsfromhand", "hand": "shadowPlayer", + "forced": true, "memorize": "revealedCards", - "amount":3 + "count":3 }, { "type": "addKeyword", @@ -384,17 +367,19 @@ } }, { - "type": "modifier", - "modifier": { + "type": "trigger", + "trigger": { + "type": "moves" + }, + "cost": { + "type": "exert", + "filter": "choose(hobbit)" + }, + "effect": { "type": "addKeyword", - "filter": "site,choose(companion)", - "keyword": "concealed", - "until": "start(regroup)", - "condition": { - "type": "canSpot", - "count": 2, - "filter": "companion", - }, + "filter": "self", + "keyword": "defender+1", + "until": "start(regroup)" } } ] @@ -416,7 +401,10 @@ { "type": "activated", "phase": "skirmish", - "filter": "bearer,inSkirmishAgainst(Nazgul)", + "condition": { + "type": "canSpot", + "filter": "bearer,inSkirmishAgainst(Nazgul)", + }, "cost": [ { "type": "memorize", @@ -428,15 +416,15 @@ "filter": "self" } ], - "effects":[ + "effect":[ { "type": "modifyStrength", - "filter": "bearer", + "filter": "memory(bearer)", "amount": 3 }, { "type": "addKeyword", - "filter": "bearer", + "filter": "memory(bearer)", "keyword": "damage+1" } ] @@ -444,46 +432,40 @@ ] }, - "21_2075": { - "title": "*Bill Ferny", - "subtitle": "Swarthy Sneering Fellow", - "culture": "wraith", - "cost": 2, - "type": "minion", - "race": "Man", - "strength": 4, - "vitality": 1, - "site": 2, + "21_3042": { + "side": "free_people", + "cost": 0, + "culture": "Gondor", + "title": "*Horn of Boromir", + "type": "possession", + "target": "name(Boromir)", "effects": { "type": "activated", - "phase": "skirmish", - "cost": { - "type": "removeTwilight" - }, - "effects": [ + "phase": "assignment", + "cost": [ { - "type": "modifier", - "modifier": { - "type": "removeKeyword", - "filter": "nazgul", - "keyword": "roaming" - } + "type": "exert", + "filter": "self" }, { - "type": "trigger", - "trigger": { - "type": "condition", - "condition": [ - { - "type": "location", - "filter": "underground" - } - ] - }, - "effect": { - "type": "discard", - "filter": "self" - } + "type": "assignFpCharacterToSkirmish", + "player": "fp", + "fpCharacter": "self", + "against": "minion" + } + ], + "effect":[ + { + "type": "modifyStrength", + "filter": "choose(ally,allyInCurrentRegion)", + "amount": 3, + "until": "start(regroup)", + "memorize": "summonedAlly" + }, + { + "type": "allyCanParticipateInArcheryFireAndSkirmishes", + "filter": "memory(summonedAlly)", + "until": "start(regroup)" } ] } diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTest.java index 54cd73333..a635ecaf6 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/GenericCardTest.java @@ -1,9 +1,12 @@ package com.gempukku.lotro.cards; import com.gempukku.lotro.at.AbstractAtTest; +import com.gempukku.lotro.common.Keyword; import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.common.Side; import com.gempukku.lotro.common.Zone; import com.gempukku.lotro.game.CardNotFoundException; +import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.PhysicalCardImpl; import com.gempukku.lotro.logic.decisions.AwaitingDecision; import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; @@ -14,57 +17,42 @@ import static org.junit.Assert.assertEquals; public class GenericCardTest extends AbstractAtTest { - private int LastCardID; + private int LastCardID = 100; + //TODO: refactor this to not have different freeps/shadows collections public Map freepsCards = new HashMap<>(); public Map shadowCards = new HashMap<>(); - public GenericCardTest(Map freepsIDs, Map shadowIDs, Collection freepsdeck, Collection shadowdeck) throws CardNotFoundException, DecisionResultInvalidException { + public GenericCardTest(Map freepsIDs, Map shadowIDs) throws CardNotFoundException, DecisionResultInvalidException { super(); - LastCardID = 100; + initializeSimplestGame(); if(freepsIDs != null) { for(String name : freepsIDs.keySet()) { String id = freepsIDs.get(name); - freepsCards.put(name, CreateCard(P1, id)); + PhysicalCardImpl card = CreateCard(P1, id); + freepsCards.put(name, card); + FreepsMoveCardToDeck(card); + ShadowMoveCardToDeck(CreateCard(P2, id)); } } if(shadowIDs != null) { for(String name : shadowIDs.keySet()) { String id = shadowIDs.get(name); - shadowCards.put(name, CreateCard(P2, id)); + PhysicalCardImpl card = CreateCard(P2, id); + shadowCards.put(name, card); + ShadowMoveCardToDeck(card); + FreepsMoveCardToDeck(CreateCard(P1, id)); } } - - Map> deckCards = new HashMap>(); - - if(freepsdeck == null) { - deckCards.put(P1, new ArrayList()); - } - else { - deckCards.put(P1, freepsdeck); - } - - if(shadowdeck == null) { - deckCards.put(P2, new ArrayList()); - } - else { - deckCards.put(P2, shadowdeck); - } - - Setup(deckCards); } public PhysicalCardImpl CreateCard(String playerID, String cardID) throws CardNotFoundException { return new PhysicalCardImpl(LastCardID++, cardID, playerID, _library.getLotroCardBlueprint(cardID)); } - public void Setup(Map> deckCards) throws DecisionResultInvalidException { - initializeSimplestGame(deckCards); - } - public void StartGame() throws DecisionResultInvalidException { skipMulligans(); } @@ -90,6 +78,8 @@ public class GenericCardTest extends AbstractAtTest { public int ShadowGetWoundsOn(String cardName) { return GetWoundsOn(GetShadowCard(cardName)); } public int GetWoundsOn(PhysicalCardImpl card) { return _game.getGameState().getWounds(card); } + public int GetBurdens() { return _game.getGameState().getBurdens(); } + public int GetFreepsHandCount() { return GetPlayerHandCount(P1); } public int GetShadowHandCount() { return GetPlayerHandCount(P2); } public int GetPlayerHandCount(String player) @@ -110,7 +100,8 @@ public class GenericCardTest extends AbstractAtTest { public Boolean ShadowActionAvailable(String action) { return ActionAvailable(P2, action); } public Boolean ActionAvailable(String player, String action) { List actions = GetAvailableActions(player); - return actions.stream().anyMatch(x -> x.startsWith(action)); + String lowerAction = action.toLowerCase(); + return actions.stream().anyMatch(x -> x.toLowerCase().startsWith(lowerAction)); } public void FreepsMoveCardToHand(String cardName) { MoveCardToZone(P1, GetFreepsCard(cardName), Zone.HAND); } @@ -134,32 +125,35 @@ public class GenericCardTest extends AbstractAtTest { MoveCardToZone(P2, card, Zone.SHADOW_CHARACTERS); } - public void FreepsMoveCardToZone(String cardID, Zone zone) - { - MoveCardToZone(P1, GetFreepsCard(cardID), zone); - } - public void ShadowMoveCardToZone(String cardID, Zone zone) - { - MoveCardToZone(P2, GetShadowCard(cardID), zone); - } + public void FreepsMoveCardToZone(String cardID, Zone zone) { MoveCardToZone(P1, GetFreepsCard(cardID), zone); } + public void FreepsMoveCardToZone(PhysicalCardImpl card, Zone zone) { MoveCardToZone(P1, card, zone); } + public void ShadowMoveCardToZone(String cardID, Zone zone) { MoveCardToZone(P2, GetShadowCard(cardID), zone); } + public void ShadowMoveCardToZone(PhysicalCardImpl card, Zone zone) { MoveCardToZone(P2, card, zone); } public void MoveCardToZone(String player, PhysicalCardImpl card, Zone zone) { + if(card.getZone() != null) + { + _game.getGameState().removeCardsFromZone(player, new ArrayList() {{ add(card); }}); + } _game.getGameState().addCardToZone(_game, card, zone); } + + public List FreepsGetADParamAsList(String paramName) { return Arrays.asList((String[])GetAwaitingDecisionParam(P1, paramName)); } public List ShadowGetADParamAsList(String paramName) { return Arrays.asList((String[])GetAwaitingDecisionParam(P2, paramName)); } public Object FreepsGetADParam(String paramName) { return GetAwaitingDecisionParam(P1, paramName); } public Object ShadowGetADParam(String paramName) { return GetAwaitingDecisionParam(P2, paramName); } public Object GetAwaitingDecisionParam(String playerID, String paramName) { - AwaitingDecision decision = _userFeedback.getAwaitingDecision(P1); + AwaitingDecision decision = _userFeedback.getAwaitingDecision(playerID); return decision.getDecisionParameters().get(paramName); } public Map GetAwaitingDecisionParams(String playerID) { - AwaitingDecision decision = _userFeedback.getAwaitingDecision(P1); + AwaitingDecision decision = _userFeedback.getAwaitingDecision(playerID); return decision.getDecisionParameters(); } + public void FreepsPlayCharFromHand(String cardName) throws DecisionResultInvalidException { PhysicalCardImpl card = GetFreepsCard(cardName); List availableIds = FreepsGetADParamAsList("cardId"); @@ -178,7 +172,68 @@ public class GenericCardTest extends AbstractAtTest { } public void AddWoundToChar(PhysicalCardImpl card) { _game.getGameState().addWound(card); } + public int GetTwilight() { return _game.getGameState().getTwilightPool(); } public void SetTwilight(int amount) { _game.getGameState().setTwilight(amount); } + public PhysicalCardImpl GetRingBearer() + { + return (PhysicalCardImpl)_game.getGameState().getRingBearer(P1); + } + public void SkipToPhase(Phase target) throws DecisionResultInvalidException { + for(int attempts = 1; attempts <= 20; attempts++) + { + Phase current = _game.getGameState().getCurrentPhase(); + if(current == target) + break; + + SkipCurrentPhaseActions(); + + if(attempts == 20) + { + throw new DecisionResultInvalidException("Could not arrive at target '" + target + "' after 20 attempts!"); + } + } + } + + public void SkipCurrentPhaseActions() throws DecisionResultInvalidException { + Phase current = _game.getGameState().getCurrentPhase(); + + if(_userFeedback.getAwaitingDecision(P1) != null) { + playerDecided(P1, ""); + } + + if(_userFeedback.getAwaitingDecision(P2) != null) { + playerDecided(P2, ""); + } + } + + + public void FreepsAssignToMinion(String name, String target) throws DecisionResultInvalidException { FreepsAssignToMinion(GetFreepsCard(name), GetShadowCard(target)); } + public void FreepsAssignToMinion(PhysicalCardImpl comp, PhysicalCardImpl minion) throws DecisionResultInvalidException { + playerDecided(P1, comp.getCardId() + " " + minion.getCardId()); + } + + public List FreepsGetAttachedCards(String name) { return GetAttachedCards(GetFreepsCard(name)); } + public List GetAttachedCards(PhysicalCardImpl card) + { + return (List)(List)_game.getGameState().getAttachedCards(card); + } + + public void FreepsResolveSkirmish(String name) throws DecisionResultInvalidException { FreepsResolveSkirmish(GetFreepsCard(name)); } + public void FreepsResolveSkirmish(PhysicalCardImpl comp) throws DecisionResultInvalidException { + playerDecided(P1, String.valueOf(comp.getCardId())); + } + + public int FreepsGetStrength(String name) { return GetStrength(GetFreepsCard(name)); } + public int ShadowGetStrength(String name) { return GetStrength(GetShadowCard(name)); } + public int GetStrength(PhysicalCardImpl card) + { + return _game.getModifiersQuerying().getStrength(_game, card); + } + + public boolean HasKeyword(PhysicalCardImpl card, Keyword keyword) + { + return _game.getModifiersQuerying().hasKeyword(_game, card, keyword); + } } diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Elrond_LoRErrataTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Elrond_LoRErrataTest.java index bf36f73f3..342f2e0d4 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Elrond_LoRErrataTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Elrond_LoRErrataTest.java @@ -6,7 +6,7 @@ import com.gempukku.lotro.game.CardNotFoundException; import com.gempukku.lotro.game.PhysicalCardImpl; import com.gempukku.lotro.logic.decisions.AwaitingDecision; import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; -import org.junit.Assert; +import static org.junit.Assert.*; import org.junit.Test; import java.util.*; @@ -23,8 +23,6 @@ public class Elrond_LoRErrataTest put("elrond", "21_1040"); put("randomcard", "1_3"); }}, - null, - null, null ); } @@ -37,8 +35,6 @@ public class Elrond_LoRErrataTest put("gandalf", "1_72"); put("arwen", "1_30"); }}, - null, - null, null ); } @@ -48,11 +44,11 @@ public class Elrond_LoRErrataTest new HashMap() {{ put("elrond", "21_1040"); - put("ally1", "1_60"); - put("ally2", "1_27"); + put("allyHome3_1", "1_60"); + put("allyHome3_2", "1_27"); + put("allyHome6_1", "1_56"); + put("allyHome6_2", "1_57"); }}, - null, - null, null ); } @@ -60,78 +56,81 @@ public class Elrond_LoRErrataTest @Test public void FellowshipActionExertsTwiceToDrawACard() throws DecisionResultInvalidException, CardNotFoundException { //Pre-game setup - GenericCardTest scenario = GetSimpleDeckScenario(); - PhysicalCardImpl elrond = scenario.GetFreepsCard("elrond"); - scenario.FreepsMoveCharToTable(elrond); + GenericCardTest scn = GetSimpleDeckScenario(); + PhysicalCardImpl elrond = scn.GetFreepsCard("elrond"); - scenario.StartGame(); + scn.FreepsMoveCharToTable(elrond); - scenario.FreepsMoveCardToDeck("randomcard"); + scn.StartGame(); - Assert.assertEquals(Phase.FELLOWSHIP, scenario.GetCurrentPhase()); - Assert.assertTrue(scenario.FreepsActionAvailable("Use Elrond")); + assertEquals(Phase.FELLOWSHIP, scn.GetCurrentPhase()); + assertTrue(scn.FreepsActionAvailable("Use Elrond")); - Assert.assertEquals(0, scenario.GetWoundsOn(elrond)); - Assert.assertEquals(0, scenario.GetFreepsHandCount()); - Assert.assertEquals(1, scenario.GetFreepsDeckCount()); + assertEquals(0, scn.GetWoundsOn(elrond)); + assertEquals(0, scn.GetFreepsHandCount()); + assertEquals(1, scn.GetFreepsDeckCount()); - scenario.FreepsUseAction("Use Elrond"); + scn.FreepsUseAction("Use Elrond"); - Assert.assertEquals(2, scenario.GetWoundsOn(elrond)); - Assert.assertEquals(1, scenario.GetFreepsHandCount()); - Assert.assertEquals(0, scenario.GetFreepsDeckCount()); + assertEquals(2, scn.GetWoundsOn(elrond)); + assertEquals(1, scn.GetFreepsHandCount()); + assertEquals(0, scn.GetFreepsDeckCount()); } @Test public void CardCanPlayIfGandalfInPlay() throws DecisionResultInvalidException, CardNotFoundException { //Pre-game setup - GenericCardTest scenario = GetSimpleSpotScenario(); - scenario.FreepsMoveCardToHand("elrond"); - scenario.FreepsMoveCardToHand("gandalf"); + GenericCardTest scn = GetSimpleSpotScenario(); + scn.FreepsMoveCardToHand("elrond"); + scn.FreepsMoveCardToHand("gandalf"); - scenario.StartGame(); + scn.StartGame(); - Assert.assertEquals(Phase.FELLOWSHIP, scenario.GetCurrentPhase()); - Assert.assertFalse(scenario.FreepsActionAvailable("Play Elrond")); + assertEquals(Phase.FELLOWSHIP, scn.GetCurrentPhase()); + assertFalse(scn.FreepsActionAvailable("Play Elrond")); - scenario.FreepsPlayCharFromHand("gandalf"); - Assert.assertTrue(scenario.FreepsActionAvailable("Play Elrond")); + scn.FreepsPlayCharFromHand("gandalf"); + assertTrue(scn.FreepsActionAvailable("Play Elrond")); } @Test public void CardCanPlayIfElfInPlay() throws DecisionResultInvalidException, CardNotFoundException { //Pre-game setup - GenericCardTest scenario = GetSimpleSpotScenario(); - scenario.FreepsMoveCardToHand("elrond"); - scenario.FreepsMoveCardToHand("arwen"); + GenericCardTest scn = GetSimpleSpotScenario(); + scn.FreepsMoveCardToHand("elrond"); + scn.FreepsMoveCardToHand("arwen"); - scenario.StartGame(); + scn.StartGame(); - Assert.assertEquals(Phase.FELLOWSHIP, scenario.GetCurrentPhase()); - Assert.assertFalse(scenario.FreepsActionAvailable("Play Elrond")); + assertEquals(Phase.FELLOWSHIP, scn.GetCurrentPhase()); + assertFalse(scn.FreepsActionAvailable("Play Elrond")); - scenario.FreepsPlayCharFromHand("arwen"); - Assert.assertTrue(scenario.FreepsActionAvailable("Play Elrond")); + scn.FreepsPlayCharFromHand("arwen"); + assertTrue(scn.FreepsActionAvailable("Play Elrond")); } @Test public void AllyHealsCappedAt2() throws DecisionResultInvalidException, CardNotFoundException { //Pre-game setup - GenericCardTest scenario = GetHome3AllyScenario(); - scenario.FreepsMoveCharToTable("elrond"); - scenario.FreepsMoveCharToTable("ally1"); - scenario.FreepsMoveCharToTable("ally2"); + GenericCardTest scn = GetHome3AllyScenario(); + scn.FreepsMoveCharToTable("elrond"); + scn.FreepsMoveCharToTable("allyHome3_1"); + scn.FreepsMoveCharToTable("allyHome3_2"); + scn.FreepsMoveCharToTable("allyHome6_1"); + scn.FreepsMoveCharToTable("allyHome6_2"); - scenario.FreepsAddWoundsToChar("elrond", 1); - scenario.FreepsAddWoundsToChar("ally1", 1); - scenario.FreepsAddWoundsToChar("ally2", 1); + scn.FreepsAddWoundsToChar("elrond", 1); + scn.FreepsAddWoundsToChar("allyHome3_1", 1); + scn.FreepsAddWoundsToChar("allyHome3_2", 1); + scn.FreepsAddWoundsToChar("allyHome6_1", 1); + scn.FreepsAddWoundsToChar("allyHome6_2", 1); - scenario.StartGame(); + scn.StartGame(); - Assert.assertEquals(Phase.BETWEEN_TURNS, scenario.GetCurrentPhase()); + assertEquals(Phase.BETWEEN_TURNS, scn.GetCurrentPhase()); - Assert.assertEquals(3, scenario.FreepsGetADParamAsList("cardId").size()); - Assert.assertEquals("0", scenario.FreepsGetADParam("min")); - Assert.assertEquals("2", scenario.FreepsGetADParam("max")); + assertEquals(3, scn.FreepsGetADParamAsList("cardId").size()); + assertEquals("0", scn.FreepsGetADParam("min")); + assertEquals("2", scn.FreepsGetADParam("max")); } } diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/FlamingBrandErrataTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/FlamingBrandErrataTest.java new file mode 100644 index 000000000..9815a3b33 --- /dev/null +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/FlamingBrandErrataTest.java @@ -0,0 +1,134 @@ +package com.gempukku.lotro.cards.unofficial.pc.errata; + +import com.gempukku.lotro.cards.GenericCardTest; +import com.gempukku.lotro.common.Keyword; +import com.gempukku.lotro.common.Phase; +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 java.util.List; + +import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.*; + +public class FlamingBrandErrataTest +{ + protected GenericCardTest GetSimpleScenario() throws CardNotFoundException, DecisionResultInvalidException { + return new GenericCardTest( + new HashMap() + {{ + put("brand", "21_2032"); + put("brand2", "21_2032"); + put("arwen", "1_30"); + put("boromir", "1_97"); + put("aragorn", "1_89"); + }}, + new HashMap() + {{ + put("nazgul", "1_229"); + put("runner", "1_178"); + }} + ); + } + + @Test + public void CanBeBorneByRangers() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTest scn = GetSimpleScenario(); + + PhysicalCardImpl arwen = scn.GetFreepsCard("arwen"); + PhysicalCardImpl boromir = scn.GetFreepsCard("boromir"); + PhysicalCardImpl aragorn = scn.GetFreepsCard("aragorn"); + PhysicalCardImpl brand = scn.GetFreepsCard("brand"); + + scn.FreepsMoveCharToTable(arwen); + scn.FreepsMoveCharToTable(boromir); + scn.FreepsMoveCharToTable(aragorn); + scn.FreepsMoveCardToHand(brand); + + scn.StartGame(); + + + assertTrue(scn.FreepsActionAvailable("Play Flaming Brand")); + + scn.FreepsUseAction("Play Flaming Brand"); + + //There are 3 companions in play, but only 2 rangers, so we should only see 2 options + assertEquals(2, scn.FreepsGetADParamAsList("cardId").size()); + + } + + @Test + public void CanBeBorneTwice() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTest scn = GetSimpleScenario(); + + PhysicalCardImpl aragorn = scn.GetFreepsCard("aragorn"); + PhysicalCardImpl brand = scn.GetFreepsCard("brand"); + PhysicalCardImpl brand2 = scn.GetFreepsCard("brand2"); + + scn.FreepsMoveCharToTable(aragorn); + scn.FreepsMoveCardToHand(brand); + scn.FreepsMoveCardToHand(brand2); + + scn.StartGame(); + + scn.FreepsUseAction("Play Flaming Brand"); + assertTrue(scn.FreepsActionAvailable("Play Flaming Brand")); + scn.FreepsUseAction("Play Flaming Brand"); + + assertEquals(2, scn.GetAttachedCards(aragorn).size()); + } + + @Test + public void SkirmishAbilityAvailableWhenSkirmishingNazgul() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTest scn = GetSimpleScenario(); + + PhysicalCardImpl aragorn = scn.GetFreepsCard("aragorn"); + PhysicalCardImpl brand = scn.GetFreepsCard("brand"); + PhysicalCardImpl runner = scn.GetShadowCard("runner"); + PhysicalCardImpl nazgul = scn.GetShadowCard("nazgul"); + + scn.FreepsMoveCharToTable(aragorn); + scn.FreepsMoveCardToHand(brand); + + scn.ShadowMoveCharToTable(runner); + scn.ShadowMoveCharToTable(nazgul); + + scn.StartGame(); + + assertEquals(8, scn.GetStrength(aragorn)); + scn.FreepsUseAction("Play Flaming Brand"); + assertEquals(9, scn.GetStrength(aragorn)); + + scn.SkipToPhase(Phase.ASSIGNMENT); + scn.SkipCurrentPhaseActions(); + scn.FreepsAssignToMinion(aragorn, runner); + //skip assigning the nazgul + scn.SkipCurrentPhaseActions(); + + //start goblin skirmish + scn.FreepsResolveSkirmish(aragorn); + + //goblin shouldn't trigger Flaming Brand's action + assertEquals(0, scn.FreepsGetAvailableActions().size()); + scn.SkipCurrentPhaseActions(); + + //assignment for fierce skirmish + scn.SkipCurrentPhaseActions(); + scn.FreepsAssignToMinion(aragorn, nazgul); + scn.FreepsResolveSkirmish(aragorn); + + assertEquals(1, scn.FreepsGetAvailableActions().size()); + assertTrue(scn.FreepsActionAvailable("Use Flaming Brand")); + + assertFalse(scn.HasKeyword(aragorn, Keyword.DAMAGE)); + scn.FreepsUseAction("Use Flaming Brand"); + assertEquals(11, scn.GetStrength(aragorn)); + assertTrue(scn.HasKeyword(aragorn, Keyword.DAMAGE)); + } +} diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Galadriel_LoLErrataTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Galadriel_LoLErrataTest.java new file mode 100644 index 000000000..974d47b14 --- /dev/null +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Galadriel_LoLErrataTest.java @@ -0,0 +1,90 @@ +package com.gempukku.lotro.cards.unofficial.pc.errata; + +import com.gempukku.lotro.cards.GenericCardTest; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.game.CardNotFoundException; +import com.gempukku.lotro.game.PhysicalCardImpl; +import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; +import static org.junit.Assert.*; +import org.junit.Test; + +import java.util.HashMap; + +public class Galadriel_LoLErrataTest +{ + protected GenericCardTest GetSimplePlayScenario() throws CardNotFoundException, DecisionResultInvalidException { + return new GenericCardTest( + new HashMap() + {{ + put("galadriel", "21_1045"); + put("elrond", "1_40"); + }}, + null + ); + } + + protected GenericCardTest GetHome6AllyScenario() throws CardNotFoundException, DecisionResultInvalidException { + return new GenericCardTest( + new HashMap() + {{ + put("galadriel", "21_1045"); + put("allyHome3_1", "1_60"); + put("allyHome3_2", "1_27"); + put("allyHome6_1", "1_56"); + put("allyHome6_2", "1_57"); + }}, + null + ); + } + + @Test + public void FellowshipActionExertsTwiceToDiscountAnElf() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTest scn = GetSimplePlayScenario(); + + PhysicalCardImpl galadriel = scn.GetFreepsCard("galadriel"); + scn.FreepsMoveCharToTable(galadriel); + scn.FreepsMoveCardToHand("elrond"); + + scn.StartGame(); + + assertEquals(Phase.FELLOWSHIP, scn.GetCurrentPhase()); + assertTrue(scn.FreepsActionAvailable("Use Galadriel")); + + assertEquals(0, scn.GetWoundsOn(galadriel)); + assertEquals(1, scn.GetFreepsHandCount()); + assertEquals(0, scn.GetTwilight()); + + scn.FreepsUseAction("Use Galadriel"); + + assertEquals(2, scn.GetWoundsOn(galadriel)); + assertEquals(0, scn.GetFreepsHandCount()); + assertEquals(2, scn.GetTwilight()); + } + + + @Test + public void AllyHealsCappedAt2() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTest scn = GetHome6AllyScenario(); + scn.FreepsMoveCharToTable("galadriel"); + scn.FreepsMoveCharToTable("allyHome3_1"); + scn.FreepsMoveCharToTable("allyHome3_2"); + scn.FreepsMoveCharToTable("allyHome6_1"); + scn.FreepsMoveCharToTable("allyHome6_2"); + + scn.FreepsAddWoundsToChar("galadriel", 1); + scn.FreepsAddWoundsToChar("allyHome3_1", 1); + scn.FreepsAddWoundsToChar("allyHome3_2", 1); + scn.FreepsAddWoundsToChar("allyHome6_1", 1); + scn.FreepsAddWoundsToChar("allyHome6_2", 1); + + scn.StartGame(); + + assertEquals(Phase.BETWEEN_TURNS, scn.GetCurrentPhase()); + + assertEquals(3, scn.FreepsGetADParamAsList("cardId").size()); + assertEquals("0", scn.FreepsGetADParam("min")); + assertEquals("2", scn.FreepsGetADParam("max")); + } +} diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Sam_SoHErrataTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Sam_SoHErrataTest.java new file mode 100644 index 000000000..12406463d --- /dev/null +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/Sam_SoHErrataTest.java @@ -0,0 +1,71 @@ +package com.gempukku.lotro.cards.unofficial.pc.errata; + +import com.gempukku.lotro.cards.GenericCardTest; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.game.CardNotFoundException; +import com.gempukku.lotro.game.PhysicalCardImpl; +import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; +import static org.junit.Assert.*; +import org.junit.Test; + +import java.util.HashMap; + +public class Sam_SoHErrataTest +{ + protected GenericCardTest GetSimpleScenario() throws CardNotFoundException, DecisionResultInvalidException { + return new GenericCardTest( + new HashMap() + {{ + put("sam", "21_10311"); + }}, + new HashMap() + {{ + put("orc", "1_272"); + }} + ); + } + + @Test + public void FellowshipActionExertsTwiceToRemoveABurden() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTest scn = GetSimpleScenario(); + + PhysicalCardImpl frodo = scn.GetRingBearer(); + PhysicalCardImpl sam = scn.GetFreepsCard("sam"); + scn.FreepsMoveCharToTable(sam); + + scn.StartGame(); + + assertEquals(Phase.FELLOWSHIP, scn.GetCurrentPhase()); + assertTrue(scn.FreepsActionAvailable("Use Sam")); + + assertEquals(0, scn.GetWoundsOn(sam)); + assertEquals(1, scn.GetBurdens()); + + scn.FreepsUseAction("Use Sam"); + + assertEquals(2, scn.GetWoundsOn(sam)); + assertEquals(0, scn.GetBurdens()); + } + + + @Test + public void RBDeathMakesSamTheRB() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTest scn = GetSimpleScenario(); + + PhysicalCardImpl frodo = scn.GetRingBearer(); + PhysicalCardImpl sam = scn.GetFreepsCard("sam"); + PhysicalCardImpl orc = scn.GetShadowCard("orc"); + scn.FreepsMoveCharToTable(sam); + + scn.StartGame(); + + assertNotSame(scn.GetRingBearer(), sam); + scn.AddWoundsToChar(frodo, 4); + + scn.SkipCurrentPhaseActions(); + + assertTrue(scn.FreepsActionAvailable("Optional Trigger")); + } +}