diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java index 87c5e9662..4d603a731 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java @@ -18,13 +18,19 @@ import com.gempukku.lotro.logic.timing.results.WoundResult; import java.util.List; public class PlayConditions { + private static boolean nonPlayZone(Zone zone) { + return zone != Zone.SHADOW_CHARACTERS && zone != Zone.SHADOW_SUPPORT + && zone != Zone.FREE_SUPPORT && zone != Zone.FREE_CHARACTERS + && zone != Zone.ATTACHED && zone != Zone.ADVENTURE_PATH; + } + public static boolean canPlayFPCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) { - return (phase == null || game.getGameState().getCurrentPhase() == phase) && (self.getZone() == Zone.HAND || self.getZone() == Zone.DECK) + return (phase == null || game.getGameState().getCurrentPhase() == phase) && nonPlayZone(self.getZone()) && (!self.getBlueprint().isUnique() || !Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()))); } public static boolean canPlayShadowCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) { - return (phase == null || game.getGameState().getCurrentPhase() == phase) && (self.getZone() == Zone.HAND || self.getZone() == Zone.DECK) + return (phase == null || game.getGameState().getCurrentPhase() == phase) && nonPlayZone(self.getZone()) && game.getModifiersQuerying().getTwilightCost(game.getGameState(), self) <= game.getGameState().getTwilightPool() && (!self.getBlueprint().isUnique() || !Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()))); } @@ -44,7 +50,7 @@ public class PlayConditions { public static boolean canPlayCompanionDuringSetup(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) { LotroCardBlueprint blueprint = self.getBlueprint(); - return (self.getZone() == Zone.DECK + return (nonPlayZone(self.getZone()) && self.getBlueprint().getCardType() == CardType.COMPANION && gameState.getCurrentPhase() == Phase.GAME_SETUP && (!blueprint.isUnique() || !Filters.canSpot(gameState, modifiersQuerying, Filters.name(blueprint.getName()))) @@ -53,7 +59,7 @@ public class PlayConditions { public static boolean canPlayCharacterDuringFellowship(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) { LotroCardBlueprint blueprint = self.getBlueprint(); - return (self.getZone() == Zone.HAND + return (nonPlayZone(self.getZone()) && (self.getBlueprint().getCardType() == CardType.COMPANION || self.getBlueprint().getCardType() == CardType.ALLY) && gameState.getCurrentPhase() == Phase.FELLOWSHIP && (!blueprint.isUnique() || !Filters.canSpot(gameState, modifiersQuerying, Filters.name(blueprint.getName())))); @@ -61,7 +67,7 @@ public class PlayConditions { public static boolean canPlayMinionDuringShadow(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) { LotroCardBlueprint blueprint = self.getBlueprint(); - return (self.getZone() == Zone.HAND + return (nonPlayZone(self.getZone()) && gameState.getCurrentPhase() == Phase.SHADOW && gameState.getTwilightPool() >= modifiersQuerying.getTwilightCost(gameState, self) && (!blueprint.isUnique() || !Filters.canSpot(gameState, modifiersQuerying, Filters.name(blueprint.getName())))); diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/site/Card1_345.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/site/Card1_345.java new file mode 100644 index 000000000..28c53213c --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/site/Card1_345.java @@ -0,0 +1,62 @@ +package com.gempukku.lotro.cards.set1.site; + +import com.gempukku.lotro.cards.AbstractSite; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.RemoveTwilightEffect; +import com.gempukku.lotro.common.Keyword; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.filters.Filter; +import com.gempukku.lotro.filters.Filters; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.GameState; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.actions.CostToEffectAction; +import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect; +import com.gempukku.lotro.logic.modifiers.ModifiersQuerying; +import com.gempukku.lotro.logic.timing.Action; + +import java.util.Collections; +import java.util.List; + +/** + * Set: The Fellowship of the Ring + * Twilight Cost: 3 + * Type: Site + * Site: 4 + * Game Text: Underground. Shadow: Remove (1) to play a Shadow weapon from your discard pile. + */ +public class Card1_345 extends AbstractSite { + public Card1_345() { + super("Mithril Mine", 4, 3, Direction.RIGHT); + addKeyword(Keyword.UNDERGROUND); + } + + @Override + public List getPlayablePhaseActions(final String playerId, final LotroGame game, PhysicalCard self) { + if (PlayConditions.canUseSiteDuringPhase(game.getGameState(), Phase.SHADOW, self) + && game.getGameState().getTwilightPool() >= 1) { + CostToEffectAction action = new CostToEffectAction(self, Keyword.SHADOW, "Remove (1) to play a Shadow weapon from your discard pile."); + action.addCost(new RemoveTwilightEffect(1)); + action.addEffect( + new ChooseArbitraryCardsEffect(playerId, "Choose Shadow weapon to play", Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), + Filters.or( + Filters.keyword(Keyword.HAND_WEAPON), + Filters.keyword(Keyword.RANGED_WEAPON)), + new Filter() { + @Override + public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) { + List playableActions = physicalCard.getBlueprint().getPlayablePhaseActions(playerId, game, physicalCard); + return (playableActions != null && playableActions.size() > 0); + } + }), 1, 1) { + @Override + protected void cardsSelected(List selectedCards) { + PhysicalCard selectedCard = selectedCards.get(0); + game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayablePhaseActions(playerId, game, selectedCard).get(0)); + } + }); + return Collections.singletonList(action); + } + return null; + } +}