Fixed events with a phase effect + response never getting to use the phase effect (such as Eye of Barad-dur)

This commit is contained in:
Christian 'ketura' McCarty
2024-12-07 13:20:09 -06:00
parent cd1f797f12
commit a5c22d9e12
2 changed files with 25 additions and 18 deletions

View File

@@ -93,7 +93,7 @@ public class PlayUtils {
final LotroCardBlueprint blueprint = card.getBlueprint();
// Check if card's own play requirements are met
if (!card.getBlueprint().checkPlayRequirements(game, card))
if (!blueprint.checkPlayRequirements(game, card))
return false;
twilightModifier -= game.getModifiersQuerying().getPotentialDiscount(game, card);
@@ -122,15 +122,16 @@ public class PlayUtils {
&& !(checkRuleOfNine(game, card) && checkPlayRingBearer(game, card)))
return false;
final Timeword timeword = PhaseKeywordMap.get(game.getGameState().getCurrentPhase());
if (blueprint.getCardType() == CardType.EVENT) {
if (card.getBlueprint().hasTimeword(Timeword.RESPONSE)) {
if (ignoreResponseEvents)
return false;
} else {
final Timeword timeword = PhaseKeywordMap.get(game.getGameState().getCurrentPhase());
if (timeword != null && !card.getBlueprint().hasTimeword(timeword))
return false;
//Some events are dual-timeword, such as Eye of Barad-dur, and so should not be automatically disqualified
if (ignoreResponseEvents && blueprint.hasTimeword(Timeword.RESPONSE) && !blueprint.hasTimeword(timeword)) {
return false;
}
if (!blueprint.hasTimeword(Timeword.RESPONSE) && timeword != null && !card.getBlueprint().hasTimeword(timeword))
return false;
}
return (blueprint.getSide() != Side.SHADOW || canPayForShadowCard(game, card, finalTargetFilter, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty));

View File

@@ -20,8 +20,8 @@ public class Card_05_096_Tests
return new GenericCardTestHelper(
new HashMap<>()
{{
put("card", "5_96");
// put other cards in here as needed for the test case
put("eye", "5_96");
put("orc", "1_266");
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
@@ -46,7 +46,7 @@ public class Card_05_096_Tests
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
var card = scn.GetFreepsCard("eye");
assertEquals("Eye of Barad-Dûr", card.getBlueprint().getTitle());
assertNull(card.getBlueprint().getSubtitle());
@@ -59,18 +59,24 @@ public class Card_05_096_Tests
assertEquals(0, card.getBlueprint().getTwilightCost());
}
// Uncomment any @Test markers below once this is ready to be used
//@Test
public void EyeofBaradDurTest1() throws DecisionResultInvalidException, CardNotFoundException {
@Test
public void EyeofBaradDurSkirmishAbility() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
scn.FreepsMoveCardToHand(card);
var eye = scn.GetShadowCard("eye");
var orc = scn.GetShadowCard("orc");
scn.ShadowMoveCardToHand(eye);
scn.ShadowMoveCharToTable(orc);
var frodo = scn.GetRingBearer();
scn.StartGame();
scn.FreepsPlayCard(card);
scn.SkipToAssignments();
scn.FreepsAssignToMinions(frodo, orc);
scn.FreepsResolveSkirmish(frodo);
scn.FreepsPassCurrentPhaseAction();
assertEquals(0, scn.GetTwilight());
assertTrue(scn.ShadowPlayAvailable(eye));
}
}