Merge pull request #491 from PlayersCouncil/bug/elbereth

Fixed O Elbereth being usable against non-Nazgul to cancel a skirmish
This commit is contained in:
Christian McCarty
2025-02-09 23:00:17 -06:00
committed by GitHub
4 changed files with 156 additions and 21 deletions

View File

@@ -597,17 +597,24 @@
effect: {
type: choice
texts: [
Take off The One Ring
Cancel a skirmish involving the Ring-bearer and a Nazgul
Take off The One Ring
]
effects: [
{
type: takeOffRing
{
type: If
check: {
type: CanSpot
filter: ringBearer,InSkirmishAgainst(Nazgul)
}
true: {
type: cancelSkirmish
filter: ringBearer
involving: nazgul
}
}
{
type: cancelSkirmish
filter: ringBearer
involving: nazgul
type: takeOffRing
}
]
}

View File

@@ -76,6 +76,7 @@ public class GenericCardTestHelper extends AbstractAtTest {
public static final String ATARRing = "4_1";
public static final String GreatRing = "19_1";
public static final String Fellowship = "fotr_block";
public static final String Multipath = "multipath";
public static final String Shadows = "expanded";
@@ -96,7 +97,7 @@ public class GenericCardTestHelper extends AbstractAtTest {
this(cardIDs, siteIDs, ringBearerID, ringID, Multipath);
}
public GenericCardTestHelper(HashMap<String, String> cardIDs, HashMap<String, String> siteIDs, String ringBearerID, String ringID, String path) throws CardNotFoundException, DecisionResultInvalidException {
public GenericCardTestHelper(HashMap<String, String> cardIDs, HashMap<String, String> siteIDs, String ringBearerID, String ringID, String format) throws CardNotFoundException, DecisionResultInvalidException {
super();
if(siteIDs == null || ringBearerID == null || ringID == null) {
@@ -119,7 +120,7 @@ public class GenericCardTestHelper extends AbstractAtTest {
decks.get(P1).setRing(ringID);
decks.get(P2).setRing(ringID);
initializeGameWithDecks(decks, path);
initializeGameWithDecks(decks, format);
}
Cards.put(P1, new HashMap<>());
@@ -993,6 +994,9 @@ public class GenericCardTestHelper extends AbstractAtTest {
public boolean IsCharSkirmishing(PhysicalCardImpl card) {
var skirmish = _game.getGameState().getSkirmish();
if(skirmish == null)
return false;
return skirmish.getFellowshipCharacter() == card ||
skirmish.getShadowCharacters().stream().anyMatch(x -> x == card);
}

View File

@@ -17,12 +17,15 @@ public class Card_02_108_Tests
return new GenericCardTestHelper(
new HashMap<>()
{{
put("card", "2_108");
// put other cards in here as needed for the test case
put("elbereth", "2_108");
put("nelya", "1_233");
put("goblinarcher", "1_176");
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
GenericCardTestHelper.RulingRing
GenericCardTestHelper.IsildursBaneRing,
GenericCardTestHelper.Fellowship //We need the Ring-bearer's skirmish to be cancelable
);
}
@@ -44,7 +47,7 @@ public class Card_02_108_Tests
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
var card = scn.GetFreepsCard("elbereth");
assertEquals("O Elbereth! Gilthoniel!", card.getBlueprint().getTitle());
assertNull(card.getBlueprint().getSubtitle());
@@ -57,18 +60,107 @@ public class Card_02_108_Tests
assertEquals(1, card.getBlueprint().getStrength());
}
// Uncomment any @Test markers below once this is ready to be used
//@Test
public void OElberethGilthonielTest1() throws DecisionResultInvalidException, CardNotFoundException {
@Test
public void OElberethGilthonielGoesOnRingBearer() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
GenericCardTestHelper scn = GetScenario();
var card = scn.GetFreepsCard("card");
scn.FreepsMoveCardToHand(card);
var elbereth = scn.GetFreepsCard("elbereth");
scn.FreepsMoveCardToHand(elbereth);
scn.StartGame();
scn.FreepsPlayCard(card);
assertEquals(Zone.HAND, elbereth.getZone());
scn.FreepsPlayCard(elbereth);
assertEquals(Zone.ATTACHED, elbereth.getZone());
assertSame(scn.GetRingBearer(), elbereth.getAttachedTo());
}
assertEquals(1, scn.GetTwilight());
@Test
public void SkirmishAbilityCanDiscardToTakeOffRing() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
GenericCardTestHelper scn = GetScenario();
var frodo = scn.GetRingBearer();
var elbereth = scn.GetFreepsCard("elbereth");
scn.AttachCardsTo(frodo, elbereth);
var goblinarcher = scn.GetShadowCard("goblinarcher");
scn.ShadowMoveCharToTable(goblinarcher);
scn.StartGame();
scn.SkipToPhase(Phase.ARCHERY);
scn.PassCurrentPhaseActions();
scn.FreepsAcceptOptionalTrigger(); // IB ring turning archery wound into 2 burdens
//Assignments
scn.PassCurrentPhaseActions();
scn.FreepsAssignToMinions(frodo, goblinarcher);
scn.FreepsResolveSkirmish(frodo);
assertTrue(scn.FreepsActionAvailable(elbereth));
assertTrue(scn.RBWearingOneRing());
assertEquals(Zone.ATTACHED, elbereth.getZone());
scn.FreepsUseCardAction(elbereth);
assertFalse(scn.RBWearingOneRing());
assertEquals(Zone.DISCARD, elbereth.getZone());
}
@Test
public void SkirmishAbilityCanCancelRBSkirmishIfSkirmishingNazgul() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
GenericCardTestHelper scn = GetScenario();
var frodo = scn.GetRingBearer();
var elbereth = scn.GetFreepsCard("elbereth");
scn.AttachCardsTo(frodo, elbereth);
var nelya = scn.GetShadowCard("nelya");
scn.ShadowMoveCharToTable(nelya);
scn.StartGame();
scn.SkipToAssignments();
scn.FreepsAssignToMinions(frodo, nelya);
scn.FreepsResolveSkirmish(frodo);
assertTrue(scn.FreepsActionAvailable(elbereth));
assertTrue(scn.IsCharSkirmishing(frodo));
assertEquals(Zone.ATTACHED, elbereth.getZone());
scn.FreepsUseCardAction(elbereth);
assertFalse(scn.IsCharSkirmishing(frodo));
assertEquals(Zone.DISCARD, elbereth.getZone());
}
@Test
public void SkirmishAbilityCantCancelRBSkirmishIfNotSkirmishingNazgul() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
GenericCardTestHelper scn = GetScenario();
var frodo = scn.GetRingBearer();
var elbereth = scn.GetFreepsCard("elbereth");
scn.AttachCardsTo(frodo, elbereth);
var goblinarcher = scn.GetShadowCard("goblinarcher");
scn.ShadowMoveCharToTable(goblinarcher);
scn.StartGame();
scn.SkipToPhase(Phase.ARCHERY);
scn.PassCurrentPhaseActions();
scn.FreepsDeclineOptionalTrigger();
//Assignments
scn.PassCurrentPhaseActions();
scn.FreepsAssignToMinions(frodo, goblinarcher);
scn.FreepsResolveSkirmish(frodo);
assertTrue(scn.FreepsActionAvailable(elbereth));
assertTrue(scn.IsCharSkirmishing(frodo));
assertEquals(Zone.ATTACHED, elbereth.getZone());
scn.FreepsUseCardAction(elbereth);
scn.FreepsChooseMultipleChoiceOption("cancel");
assertTrue(scn.IsCharSkirmishing(frodo));
assertEquals(Zone.DISCARD, elbereth.getZone());
}
}

View File

@@ -24,7 +24,8 @@ public class Card_02_108_ErrataTests
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
GenericCardTestHelper.IsildursBaneRing
GenericCardTestHelper.IsildursBaneRing,
GenericCardTestHelper.Fellowship //We need the Ring-bearer's skirmish to be cancelable
);
}
@@ -129,4 +130,35 @@ public class Card_02_108_ErrataTests
assertEquals(8, scn.GetStrength(frodo));
assertEquals(Zone.DISCARD, elbereth.getZone());
}
@Test
public void SkirmishAbilityCantMakeRBStrengthPlus4IfNotSkirmishingNazgul() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
GenericCardTestHelper scn = GetScenario();
var frodo = scn.GetRingBearer();
var elbereth = scn.GetFreepsCard("elbereth");
scn.AttachCardsTo(frodo, elbereth);
var goblinarcher = scn.GetShadowCard("goblinarcher");
scn.ShadowMoveCharToTable(goblinarcher);
scn.StartGame();
scn.SkipToPhase(Phase.ARCHERY);
scn.PassCurrentPhaseActions();
scn.FreepsDeclineOptionalTrigger();
//Assignments
scn.PassCurrentPhaseActions();
scn.FreepsAssignToMinions(frodo, goblinarcher);
scn.FreepsResolveSkirmish(frodo);
assertTrue(scn.FreepsActionAvailable(elbereth));
assertEquals(5, scn.GetStrength(frodo)); // 3 + 1 from ring +1 from O Elbereth itself
assertEquals(Zone.ATTACHED, elbereth.getZone());
scn.FreepsUseCardAction(elbereth);
assertEquals(4, scn.GetStrength(frodo)); // 3 + 1 from ring, nothing from O Elbereth itself
assertEquals(Zone.DISCARD, elbereth.getZone());
}
}