From a8ccd67a511944ee7bbe7e80800460afca647c34 Mon Sep 17 00:00:00 2001 From: Devon Henegar Date: Thu, 2 May 2024 19:02:35 -0400 Subject: [PATCH] Add mostly working V2 card 17 json and tests --- .../pc/setV02/setv02-Gondor-playtest.hjson | 32 +++- .../pc/vsets/set_v02/Card_V2_017_Tests.java | 166 ++++++++++++++++-- 2 files changed, 179 insertions(+), 19 deletions(-) diff --git a/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/setV02/setv02-Gondor-playtest.hjson b/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/setV02/setv02-Gondor-playtest.hjson index 202ee7d70..5b22c85c9 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/setV02/setv02-Gondor-playtest.hjson +++ b/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/setV02/setv02-Gondor-playtest.hjson @@ -103,20 +103,34 @@ twilight: 1 type: Event keywords: Maneuver - /*requires: { - - } - */ effects: { type: event cost: { - type: SendMessage - text: Placeholder effect for development. - }, + type: exert + filter: choose(name(Aragorn)) + memorize: exertedCompanion + times: 3 + } effect: [ { - type: SendMessage - text: Placeholder effect for development. + type: modifyStrength + filter: all(valiant,companion) + until: start(regroup) + amount: 2 + } + { + type: addTrigger + until: endOfTurn + trigger: { + type: killed + filter: name(Aragorn) + } + effect: { + type: modifyStrength + filter: all(valiant,companion) + until: endOfTurn + amount: 1 + } } ] } diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v02/Card_V2_017_Tests.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v02/Card_V2_017_Tests.java index 0aacbe0c7..ab5876d6c 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v02/Card_V2_017_Tests.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/vsets/set_v02/Card_V2_017_Tests.java @@ -2,12 +2,21 @@ package com.gempukku.lotro.cards.unofficial.pc.vsets.set_v02; import com.gempukku.lotro.cards.GenericCardTestHelper; import com.gempukku.lotro.common.*; +import com.gempukku.lotro.game.AbstractActionProxy; import com.gempukku.lotro.game.CardNotFoundException; +import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.PhysicalCardImpl; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.actions.ActivateCardAction; import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; +import com.gempukku.lotro.logic.effects.KillEffect; +import com.gempukku.lotro.logic.timing.Action; + import org.junit.Test; +import java.util.Collections; import java.util.HashMap; +import java.util.List; import static org.junit.Assert.*; @@ -19,6 +28,10 @@ public class Card_V2_017_Tests new HashMap<>() {{ put("card", "102_17"); + put("aragorn", "101_19"); + put("veowyn", "4_270"); + put("vgamling", "5_82"); + put("twk", "1_237"); // put other cards in here as needed for the test case }}, GenericCardTestHelper.FellowshipSites, @@ -28,7 +41,7 @@ public class Card_V2_017_Tests } @Test - public void IWillDieasOneofThemStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException { + public void IWillDieAsOneofThemStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException { /** * Set: V2 @@ -43,9 +56,9 @@ public class Card_V2_017_Tests * If Aragorn dies during this turn, make each valiant companion strength +1 for the rest of the turn. */ - var scn = GetScenario(); + GenericCardTestHelper scn = GetScenario(); - var card = scn.GetFreepsCard("card"); + PhysicalCardImpl card = scn.GetFreepsCard("card"); assertEquals("I Will Die as One of Them", card.getBlueprint().getTitle()); assertNull(card.getBlueprint().getSubtitle()); @@ -57,18 +70,151 @@ public class Card_V2_017_Tests assertEquals(1, card.getBlueprint().getTwilightCost()); } - // Uncomment any @Test markers below once this is ready to be used - //@Test - public void IWillDieasOneofThemTest1() throws DecisionResultInvalidException, CardNotFoundException { + @Test + public void IWillDieAsOneofThemBoostsValiantCompanions() throws DecisionResultInvalidException, CardNotFoundException { //Pre-game setup - var scn = GetScenario(); + GenericCardTestHelper scn = GetScenario(); - var card = scn.GetFreepsCard("card"); - scn.FreepsMoveCardToHand(card); + PhysicalCardImpl card = scn.GetFreepsCard("card"); + PhysicalCardImpl aragorn = scn.GetFreepsCard("aragorn"); + PhysicalCardImpl veowyn = scn.GetFreepsCard("veowyn"); + PhysicalCardImpl vgamling = scn.GetFreepsCard("vgamling"); + scn.FreepsMoveCardToHand(card, aragorn, veowyn, vgamling); + + PhysicalCardImpl twk = scn.GetShadowCard("twk"); + scn.ShadowMoveCardToHand(twk); scn.StartGame(); + + scn.FreepsMoveCharToTable(aragorn); + scn.FreepsPlayCard(veowyn); + scn.FreepsPlayCard(vgamling); + + + assertEquals(6, scn.GetStrength(veowyn)); + assertEquals(6, scn.GetStrength(vgamling)); + + scn.SkipToPhase(Phase.SHADOW); + + scn.ShadowPlayCard(twk); + + scn.SkipToPhase(Phase.MANEUVER); + + + var twilightInPoolBeforeCardPlay = scn.GetTwilight(); + + assertTrue(scn.FreepsPlayAvailable(card)); scn.FreepsPlayCard(card); - assertEquals(1, scn.GetTwilight()); + + assertEquals(twilightInPoolBeforeCardPlay + 1, scn.GetTwilight()); + + // Valiant companion's strengths are boosted after card is played + assertEquals(8, scn.GetStrength(veowyn)); + assertEquals(8, scn.GetStrength(vgamling)); + + scn.SkipToPhase(Phase.ASSIGNMENT); + assertEquals(8, scn.GetStrength(veowyn)); + assertEquals(8, scn.GetStrength(vgamling)); + + scn.PassCurrentPhaseActions(); + scn.FreepsAssignToMinions(veowyn, twk); + scn.FreepsResolveSkirmish(veowyn); + + + // Valiant companions continue to have boosted strength during the skirmish phase + scn.SkipToPhase(Phase.SKIRMISH); + assertEquals(8, scn.GetStrength(veowyn)); + assertEquals(8, scn.GetStrength(vgamling)); + + + + // Valiant companions have had their strength reduced to normal after the beginning of the regroup phase + scn.SkipToPhase(Phase.REGROUP); + assertEquals(6, scn.GetStrength(veowyn)); + assertEquals(6, scn.GetStrength(vgamling)); + } + + @Test + public void IWillDieAsOneofThemBoostsValiantCompanionsOnDeath() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + GenericCardTestHelper scn = GetScenario(); + + PhysicalCardImpl card = scn.GetFreepsCard("card"); + PhysicalCardImpl aragorn = scn.GetFreepsCard("aragorn"); + PhysicalCardImpl veowyn = scn.GetFreepsCard("veowyn"); + PhysicalCardImpl vgamling = scn.GetFreepsCard("vgamling"); + scn.FreepsMoveCardToHand(card, aragorn, veowyn, vgamling); + + PhysicalCardImpl twk = scn.GetShadowCard("twk"); + scn.ShadowMoveCardToHand(twk); + + scn.StartGame(); + + scn.FreepsMoveCharToTable(aragorn); + scn.FreepsPlayCard(veowyn); + scn.FreepsPlayCard(vgamling); + + + assertEquals(6, scn.GetStrength(veowyn)); + assertEquals(6, scn.GetStrength(vgamling)); + + scn.SkipToPhase(Phase.SHADOW); + + scn.ShadowPlayCard(twk); + + scn.SkipToPhase(Phase.MANEUVER); + + + var twilightInPoolBeforeCardPlay = scn.GetTwilight(); + + assertEquals(0, scn.GetWoundsOn(aragorn)); + assertTrue(scn.FreepsPlayAvailable(card)); + scn.FreepsPlayCard(card); + assertEquals(3, scn.GetWoundsOn(aragorn)); + + + assertEquals(twilightInPoolBeforeCardPlay + 1, scn.GetTwilight()); + + // Valiant companion's strengths are boosted after card is played + assertEquals(8, scn.GetStrength(veowyn)); + assertEquals(8, scn.GetStrength(vgamling)); + + scn.SkipToPhase(Phase.ASSIGNMENT); + assertEquals(8, scn.GetStrength(veowyn)); + assertEquals(8, scn.GetStrength(vgamling)); + + scn.PassCurrentPhaseActions(); + scn.FreepsAssignToMinions(veowyn, twk); + scn.FreepsResolveSkirmish(veowyn); + + scn.ApplyAdHocAction(new AbstractActionProxy() { + @Override + public List getPhaseActions(String playerId, LotroGame game) { + ActivateCardAction action = new ActivateCardAction(twk); + action.appendEffect(new KillEffect(aragorn, (PhysicalCard) null, KillEffect.Cause.WOUNDS)); + return Collections.singletonList(action); + } + }); + + assertEquals(Zone.FREE_CHARACTERS, aragorn.getZone()); + scn.FreepsPassCurrentPhaseAction(); + scn.ShadowUseCardAction(twk); + assertEquals(Zone.DEAD, aragorn.getZone()); + + assertEquals(9, scn.GetStrength(veowyn)); + assertEquals(9, scn.GetStrength(vgamling)); + + // Valiant companions continue to have boosted strength during the skirmish phase + scn.SkipToPhase(Phase.SKIRMISH); + assertEquals(9, scn.GetStrength(veowyn)); + assertEquals(9, scn.GetStrength(vgamling)); + + + + // Valiant companions have had their strength reduced to normal after the beginning of the regroup phase + scn.SkipToPhase(Phase.REGROUP); + assertEquals(7, scn.GetStrength(veowyn)); + assertEquals(7, scn.GetStrength(vgamling)); } }