Fixed Rallying Call failing to add threats if the twilight pool was at exactly 0 after playing the southron. (This should also address some other various play-from-hand effects that would encounter the same problem at exactly 0).

- Also fixed Dark Shape Sprang unit test and Cirdan-downstream unit test framework change
This commit is contained in:
Christian 'ketura' McCarty
2024-12-18 12:56:26 -06:00
parent 2d65d32e48
commit 03f8797334
4 changed files with 57 additions and 13 deletions

View File

@@ -49,7 +49,7 @@ public class PlayCardFromHand implements EffectAppenderProducer {
final Filterable onFilterable = onFilterableSource.getFilterable(actionContext);
return Filters.and(Filters.playable(game, costModifier, ignoreRoamingPenalty, ignoreInDeadPile), ExtraFilters.attachableTo(game, costModifier, onFilterable));
}
return Filters.playable(game, removedTwilight, costModifier, ignoreRoamingPenalty, ignoreInDeadPile, true);
return Filters.playable(game, 0, costModifier, ignoreRoamingPenalty, ignoreInDeadPile, true);
},
(actionContext) -> {
final LotroGame game = actionContext.getGame();

View File

@@ -1125,7 +1125,7 @@ public class GenericCardTestHelper extends AbstractAtTest {
return _game.isFinished();
}
public void FreepsResolveRuleFirst() throws DecisionResultInvalidException { FreepsResolveActionOrder(null); }
public void FreepsResolveRuleFirst() throws DecisionResultInvalidException { FreepsResolveActionOrder(GetADParamAsList(P1, "actionText").getFirst()); }
public void FreepsResolveActionOrder(String option) throws DecisionResultInvalidException { ChooseAction(P1, "actionText", option); }
public Filterable GenerateFreepsFilter(String filter) throws InvalidCardDefinitionException {

View File

@@ -45,7 +45,7 @@ public class Card_10_019_Tests
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
var card = scn.GetFreepsCard("sprang");
assertEquals("A Dark Shape Sprang", card.getBlueprint().getTitle());
assertNull(card.getBlueprint().getSubtitle());

View File

@@ -17,8 +17,8 @@ public class Card_10_047_Tests
return new GenericCardTestHelper(
new HashMap<>()
{{
put("card", "10_47");
// put other cards in here as needed for the test case
put("call", "10_47");
put("southron", "4_220");
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
@@ -38,12 +38,14 @@ public class Card_10_047_Tests
* Twilight Cost: 0
* Type: Condition
* Subtype: Support area
* Game Text: To play, spot a [raider] Man.<br>Threats cannot be removed by Free Peoples cards.<br><b>Shadow:</b> Remove (1) and play a Southron to add a threat.
* Game Text: To play, spot a [raider] Man.
* Threats cannot be removed by Free Peoples cards.
* <b>Shadow:</b> Remove (1) and play a Southron to add a threat.
*/
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
var card = scn.GetFreepsCard("call");
assertEquals("Rallying Call", card.getBlueprint().getTitle());
assertNull(card.getBlueprint().getSubtitle());
@@ -55,18 +57,60 @@ public class Card_10_047_Tests
assertEquals(0, card.getBlueprint().getTwilightCost());
}
// Uncomment any @Test markers below once this is ready to be used
//@Test
public void RallyingCallTest1() throws DecisionResultInvalidException, CardNotFoundException {
@Test
public void RallyingCallRemoves1AndPlaysASouthronToAddAThreat() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
scn.FreepsMoveCardToHand(card);
var call = scn.GetShadowCard("call");
var southron = scn.GetShadowCard("southron");
scn.ShadowMoveCardToSupportArea(call);
scn.ShadowMoveCardToHand(southron);
scn.StartGame();
scn.FreepsPlayCard(card);
scn.SetTwilight(7);
scn.FreepsPassCurrentPhaseAction();
assertEquals(10, scn.GetTwilight());
assertEquals(0, scn.getThreats());
assertTrue(scn.ShadowActionAvailable(call));
assertTrue(scn.ShadowPlayAvailable(southron));
assertEquals(Zone.HAND, southron.getZone());
scn.ShadowUseCardAction(call);
//10 twiliight -4 base -2 roaming -1 extra tax from Call
assertEquals(3, scn.GetTwilight());
assertEquals(1, scn.getThreats());
assertEquals(Zone.SHADOW_CHARACTERS, southron.getZone());
}
@Test
public void RallyingCallHasEffectEvenWhenFinalTwilightPoolIsZero() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var call = scn.GetShadowCard("call");
var southron = scn.GetShadowCard("southron");
scn.ShadowMoveCardToSupportArea(call);
scn.ShadowMoveCardToHand(southron);
scn.StartGame();
scn.SetTwilight(4);
scn.FreepsPassCurrentPhaseAction();
assertEquals(7, scn.GetTwilight());
assertEquals(0, scn.getThreats());
assertTrue(scn.ShadowActionAvailable(call));
assertTrue(scn.ShadowPlayAvailable(southron));
assertEquals(Zone.HAND, southron.getZone());
scn.ShadowUseCardAction(call);
//We must ensure that the final tally results in an empty twilight pool
// as it is here that PlayCardFromHand falters if set up incorrectly
assertEquals(0, scn.GetTwilight());
assertEquals(1, scn.getThreats());
assertEquals(Zone.SHADOW_CHARACTERS, southron.getZone());
}
}