diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/appender/PreventSpecialAbility.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/appender/PreventSpecialAbility.java index b0b99a973..b7dbc67d1 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/appender/PreventSpecialAbility.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/appender/PreventSpecialAbility.java @@ -9,6 +9,7 @@ import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer; import com.gempukku.lotro.game.state.LotroGame; import com.gempukku.lotro.logic.actions.ActivateCardAction; import com.gempukku.lotro.logic.actions.CostToEffectAction; +import com.gempukku.lotro.logic.actions.SubAction; import com.gempukku.lotro.logic.timing.Effect; import com.gempukku.lotro.logic.timing.EffectResult; import com.gempukku.lotro.logic.timing.UnrespondableEffect; @@ -30,9 +31,21 @@ public class PreventSpecialAbility implements EffectAppenderProducer { protected void doPlayEffect(LotroGame game) { EffectResult effectResult = actionContext.getEffectResult(); if (effectResult instanceof ActionSource) { - ActivateCardAction cardAction = (ActivateCardAction) ((ActionSource) effectResult).getAction(); - if (cardAction != null) - cardAction.prevent(); + var cardAction = ((ActionSource) effectResult).getAction(); + ActivateCardAction act = null; + + if(cardAction instanceof ActivateCardAction activate) { + act = activate; + } + else if(cardAction instanceof SubAction sub) { + var coreAction = sub.getAction(); + if(coreAction instanceof ActivateCardAction activate) { + act = activate; + } + } + if(act != null) { + act.prevent(); + } } } }; diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/actions/SubAction.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/actions/SubAction.java index c86b64b2d..5712f16af 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/actions/SubAction.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/actions/SubAction.java @@ -12,6 +12,7 @@ public class SubAction extends AbstractCostToEffectAction { public SubAction(Action action) { _action = action; } + public Action getAction() { return _action; } @Override public Type getType() { diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set11/Card_11_157_Tests.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set11/Card_11_157_Tests.java index 81d331109..1c082ec1e 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set11/Card_11_157_Tests.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set11/Card_11_157_Tests.java @@ -17,8 +17,8 @@ public class Card_11_157_Tests return new GenericCardTestHelper( new HashMap<>() {{ - put("card", "11_157"); - // put other cards in here as needed for the test case + put("rush", "11_157"); + put("scout", "10_78"); }}, GenericCardTestHelper.FellowshipSites, GenericCardTestHelper.FOTRFrodo, @@ -38,12 +38,14 @@ public class Card_11_157_Tests * Twilight Cost: 3 * Type: Condition * Subtype: Support area - * Game Text: To play, spot a [rohan] Man.
Each time a Shadow condition is played, you may exert a minion.
Response: If a minion exerts as a cost of its special ability, discard this condition to prevent that and return that minion to its owner's hand. + * Game Text: To play, spot a [rohan] Man. + * Each time a Shadow condition is played, you may exert a minion. + * Response: If a minion exerts as a cost of its special ability, discard this condition to prevent that and return that minion to its owner's hand. */ var scn = GetScenario(); - var card = scn.GetFreepsCard("card"); + var card = scn.GetFreepsCard("rush"); assertEquals("Rush of Steeds", card.getBlueprint().getTitle()); assertNull(card.getBlueprint().getSubtitle()); @@ -55,18 +57,31 @@ public class Card_11_157_Tests assertEquals(3, card.getBlueprint().getTwilightCost()); } - // Uncomment any @Test markers below once this is ready to be used - //@Test - public void RushofSteedsTest1() throws DecisionResultInvalidException, CardNotFoundException { + @Test + public void RushofSteedsDoesntCrashWhenUsedAgainstAdvanceScout() throws DecisionResultInvalidException, CardNotFoundException { //Pre-game setup var scn = GetScenario(); - var card = scn.GetFreepsCard("card"); - scn.FreepsMoveCardToHand(card); + var rush = scn.GetFreepsCard("rush"); + scn.FreepsMoveCardToSupportArea(rush); + + var scout = scn.GetShadowCard("scout"); + scn.ShadowMoveCharToTable(scout); scn.StartGame(); - scn.FreepsPlayCard(card); - assertEquals(3, scn.GetTwilight()); + scn.FreepsPassCurrentPhaseAction(); + + assertTrue(scn.ShadowActionAvailable(scout)); + scn.ShadowUseCardAction(scout); + scn.ShadowChooseMultipleChoiceOption("exert"); + + assertEquals(Zone.SUPPORT, rush.getZone()); + assertEquals(Zone.SHADOW_CHARACTERS, scout.getZone()); + assertTrue(scn.FreepsHasOptionalTriggerAvailable()); + scn.FreepsAcceptOptionalTrigger(); + + assertEquals(Zone.DISCARD, rush.getZone()); + assertEquals(Zone.HAND, scout.getZone()); } }