diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/RemoveCardsFromDeckEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/RemoveCardsFromDeckEffect.java new file mode 100644 index 000000000..37127dd5a --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/RemoveCardsFromDeckEffect.java @@ -0,0 +1,59 @@ +package com.gempukku.lotro.cards.effects; + +import com.gempukku.lotro.common.Zone; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.GameUtils; +import com.gempukku.lotro.logic.timing.AbstractEffect; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class RemoveCardsFromDeckEffect extends AbstractEffect { + private String _playerPerforming; + private PhysicalCard _source; + private Collection _cardsToRemove; + + public RemoveCardsFromDeckEffect(String playerPerforming, PhysicalCard source, Collection cardsToRemove) { + _playerPerforming = playerPerforming; + _source = source; + _cardsToRemove = cardsToRemove; + } + + @Override + public String getText(LotroGame game) { + return null; + } + + @Override + public Type getType() { + return null; + } + + @Override + public boolean isPlayableInFull(LotroGame game) { + for (PhysicalCard physicalCard : _cardsToRemove) { + if (physicalCard.getZone() != Zone.DECK) + return false; + } + + return true; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + Set removedCards = new HashSet(); + for (PhysicalCard physicalCard : _cardsToRemove) + if (physicalCard.getZone() == Zone.DECK) + removedCards.add(physicalCard); + + game.getGameState().removeCardsFromZone(_playerPerforming, removedCards); + for (PhysicalCard removedCard : removedCards) + game.getGameState().addCardToZone(game, removedCard, Zone.REMOVED); + + game.getGameState().sendMessage(_playerPerforming + " removed " + GameUtils.getAppendedNames(removedCards) + " from deck using " + GameUtils.getCardLink(_source)); + + return new FullEffectResult(_cardsToRemove.size() == removedCards.size(), _cardsToRemove.size() == removedCards.size()); + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set18/orc/Card18_082.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set18/orc/Card18_082.java new file mode 100644 index 000000000..d0e57ad98 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set18/orc/Card18_082.java @@ -0,0 +1,63 @@ +package com.gempukku.lotro.cards.set18.orc; + +import com.gempukku.lotro.cards.AbstractPermanent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.TriggerConditions; +import com.gempukku.lotro.cards.effects.RemoveCardsFromTheGameEffect; +import com.gempukku.lotro.cards.effects.SelfDiscardEffect; +import com.gempukku.lotro.cards.effects.ShuffleDeckEffect; +import com.gempukku.lotro.common.*; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.actions.OptionalTriggerAction; +import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + * Set: Treachery & Deceit + * Side: Shadow + * Culture: Orc + * Twilight Cost: 3 + * Type: Possession • Support Area + * Game Text: To play, spot an [ORC] minion. Each time the fellowship moves in the regroup phase, you may discard + * this possession to search the Free Peoples player's draw deck and choose 2 Free Peoples cards found there. + * Remove those cards from the game. + */ +public class Card18_082 extends AbstractPermanent { + public Card18_082() { + super(Side.SHADOW, 3, CardType.POSSESSION, Culture.ORC, Zone.SUPPORT, "Grond", true); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) { + return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile) + && PlayConditions.canSpot(game, Culture.ORC, CardType.MINION); + } + + @Override + public List getOptionalAfterTriggers(final String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) { + if (TriggerConditions.moves(game, effectResult) + && PlayConditions.isPhase(game, Phase.REGROUP) + && PlayConditions.canSelfDiscard(self, game)) { + final OptionalTriggerAction action = new OptionalTriggerAction(self); + action.appendCost( + new SelfDiscardEffect(self)); + action.appendEffect( + new ChooseArbitraryCardsEffect(playerId, "Choose cards to remove", game.getGameState().getDeck(game.getGameState().getCurrentPlayerId()), Side.FREE_PEOPLE, 2, 2) { + @Override + protected void cardsSelected(LotroGame game, Collection selectedCards) { + action.insertEffect( + new RemoveCardsFromTheGameEffect(playerId, self, selectedCards)); + } + }); + action.appendEffect( + new ShuffleDeckEffect(game.getGameState().getCurrentPlayerId())); + return Collections.singletonList(action); + } + return null; + } +}