From d26900163bba73377c779eeb6d6517f1f3b3ab15 Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Mon, 22 May 2023 22:57:37 -0500 Subject: [PATCH] Vilya errata + tests --- .../pc/errata/set03/set03-Elven-errata.hjson | 84 ++++++++++++ .../errata/set03/Card_03_027_ErrataTests.java | 123 ++++++++++++++++++ 2 files changed, 207 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/set03/Card_03_027_ErrataTests.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/errata/set03/set03-Elven-errata.hjson b/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/errata/set03/set03-Elven-errata.hjson index 59b0a3033..df8012e58 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/errata/set03/set03-Elven-errata.hjson +++ b/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/unofficial/pc/errata/set03/set03-Elven-errata.hjson @@ -174,4 +174,88 @@ } } } + + 73_27: { + cardInfo: { + //Either a full URL, or a subpath for the PC image server + imagePath: errata/LOTR-EN03E027.1_card.jpg + //If this is true, then all gameplay-related info outside this cardInfo definition + // will be ignored and the java class loaded instead. + javaClass: false + //This instructs the blueprint generator to insert this card as an alt of the listed + // parent blueprint. Can of course be ommitted if not an errata or promo. + parent: 3_27 + //This is the tree path to use within the alts structure on the parent. + // Can of course be ommitted if parent is null. + parentPath: errata/pc + //Versioning differentiates releases within a particular alt path, such as PC errata + // version 1 vs version 2. PC version 2 will not conflict with, say, Decipher version 2. + //Top-level cards should always be version 0. + version: 1? + collInfo: 3R27 + rarity: R + setNum: "3" + cardNum: 27 + // Standard, Masterwork, Tengwar, FullArt, etc. Top-level cards are always Standard. + style: Standard + } + title: Vilya + unique: true + side: Free Peoples + culture: Elven + twilight: 0 + vitality: 1 + type: Artifact + itemclass: Ring + target: name(Elrond) + effects: [ + { + type: Activated + phase: Maneuver + requires: { + type: CanSpot + filter: condition,side(shadow) + } + effect: [ + { + type: ChooseActiveCards + filter: choose(condition,side(shadow)) + memorize: chosenShadowCondition + text: Choose a Shadow condition to return to its owner's hand. + } + { + type: ReturnToHand + filter: memory(chosenShadowCondition) + } + { + type: optional + player: shadow + text: Would you like to discard a card from hand? + effect: { + type: DiscardFromHand + forced: false + player: OwnerFromMemory(chosenShadowCondition) + hand: OwnerFromMemory(chosenShadowCondition) + count: 1 + } + } + { + type: ReturnToHand + filter: self + } + ] + } + ] + gametext: Bearer must be Elrond.
Maneuver: Spot a Shadow condition to return that condition to its owner's hand. That player may discard a card from hand. Return Vilya to your hand. + lore: “Upon his finger was a ring of gold with a great blue stone, Vilya, mightiest of the Three." + promotext: "" + alts: { + //These are just CardInfo objects + promos: { + } + //These are full card definitions, with redundant info that is the same as the original card ommitted + errata: { + } + } + } } diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/set03/Card_03_027_ErrataTests.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/set03/Card_03_027_ErrataTests.java new file mode 100644 index 000000000..4ed0471c2 --- /dev/null +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/unofficial/pc/errata/set03/Card_03_027_ErrataTests.java @@ -0,0 +1,123 @@ +package com.gempukku.lotro.cards.unofficial.pc.errata.set03; + +import com.gempukku.lotro.cards.GenericCardTestHelper; +import com.gempukku.lotro.common.*; +import com.gempukku.lotro.game.CardNotFoundException; +import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; +import org.junit.Test; + +import java.util.HashMap; + +import static org.junit.Assert.*; + +public class Card_03_027_ErrataTests +{ + + protected GenericCardTestHelper GetScenario() throws CardNotFoundException, DecisionResultInvalidException { + return new GenericCardTestHelper( + new HashMap<>() + {{ + put("vilya", "73_27"); + put("elrond", "3_13"); + put("rumil", "1_57"); + put("thrarin", "1_27"); + + put("runner", "1_178"); + put("armory", "1_173"); + put("bladetip", "1_209"); + }}, + GenericCardTestHelper.FellowshipSites, + GenericCardTestHelper.FOTRFrodo, + GenericCardTestHelper.FOTRRing + ); + } + + @Test + public void VilyaStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException { + + /** + * Set: 3 + * Title: Vilya + * Unique: True + * Side: FREE_PEOPLE + * Culture: Elven + * Twilight Cost: 0 + * Type: artifact + * Subtype: Ring + * Vitality: 1 + * Game Text: Bearer must be Elrond. + * Maneuver: Exert Elrond and spot a Shadow condition to return that condition to its owner's hand. That player may discard a vilya from hand. Return Vilya to your hand. + */ + + //Pre-game setup + var scn = GetScenario(); + + var vilya = scn.GetFreepsCard("vilya"); + + assertTrue(vilya.getBlueprint().isUnique()); + assertEquals(Side.FREE_PEOPLE, vilya.getBlueprint().getSide()); + assertEquals(Culture.ELVEN, vilya.getBlueprint().getCulture()); + assertEquals(CardType.ARTIFACT, vilya.getBlueprint().getCardType()); + assertTrue(vilya.getBlueprint().getPossessionClasses().contains(PossessionClass.RING)); + assertEquals(0, vilya.getBlueprint().getTwilightCost()); + assertEquals(1, vilya.getBlueprint().getVitality()); + } + + @Test + public void VilyaBorneByElrond() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + var scn = GetScenario(); + + var vilya = scn.GetFreepsCard("vilya"); + var elrond = scn.GetFreepsCard("elrond"); + var rumil = scn.GetFreepsCard("rumil"); + var thrarin = scn.GetFreepsCard("thrarin"); + scn.FreepsMoveCardToHand(vilya, elrond); + scn.FreepsMoveCharToTable(rumil, thrarin); + + scn.StartGame(); + + assertFalse(scn.FreepsPlayAvailable(vilya)); + scn.FreepsPlayCard(elrond); + assertTrue(scn.FreepsPlayAvailable(vilya)); + assertEquals(Zone.HAND, vilya.getZone()); + scn.FreepsPlayCard(vilya); + assertEquals(Zone.ATTACHED, vilya.getZone()); + assertSame(elrond, vilya.getAttachedTo()); + } + + @Test + public void ManeuverActionReturnsShadowConditionToHandAndSelfReturnsToHand() throws DecisionResultInvalidException, CardNotFoundException { + //Pre-game setup + var scn = GetScenario(); + + var frodo = scn.GetRingBearer(); + var vilya = scn.GetFreepsCard("vilya"); + var elrond = scn.GetFreepsCard("elrond"); + scn.FreepsMoveCharToTable(elrond); + scn.FreepsAttachCardsTo(elrond, vilya); + + var runner = scn.GetShadowCard("runner"); + var armory = scn.GetShadowCard("armory"); + var bladetip = scn.GetShadowCard("bladetip"); + scn.ShadowMoveCharToTable(runner); + scn.ShadowMoveCardToSupportArea(armory); + scn.AttachCardsTo(frodo, bladetip); + + scn.StartGame(); + + scn.SkipToPhase(Phase.MANEUVER); + assertTrue(scn.FreepsActionAvailable(vilya)); + scn.FreepsUseCardAction(vilya); + assertEquals(2, scn.GetFreepsCardChoiceCount()); + assertEquals(Zone.ATTACHED, bladetip.getZone()); + assertEquals(Zone.ATTACHED, vilya.getZone()); + scn.FreepsChooseCard(bladetip); + assertEquals(Zone.HAND, bladetip.getZone()); + + assertTrue(scn.ShadowDecisionAvailable("Discard")); + scn.ShadowChooseYes(); + assertEquals(Zone.DISCARD, bladetip.getZone()); + assertEquals(Zone.HAND, vilya.getZone()); + } +}