From a6fe3cab2d6340499f92c13bd8c8b0511c9d5f3c Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Sun, 4 Sep 2011 23:42:35 +0000 Subject: [PATCH] "The Gaffer's Pipe" --- .../lotro/cards/set1/shire/Card1_292.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/shire/Card1_292.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/shire/Card1_292.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/shire/Card1_292.java new file mode 100644 index 000000000..fb4dbb76d --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/shire/Card1_292.java @@ -0,0 +1,73 @@ +package com.gempukku.lotro.cards.set1.shire; + +import com.gempukku.lotro.cards.AbstractAttachableFPPossession; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.decisions.ForEachYouSpotDecision; +import com.gempukku.lotro.cards.effects.RemoveTwilightEffect; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Culture; +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.LotroGame; +import com.gempukku.lotro.logic.actions.CostToEffectAction; +import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; +import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect; +import com.gempukku.lotro.logic.effects.DiscardCardFromPlayEffect; +import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect; +import com.gempukku.lotro.logic.timing.Action; + +import java.util.LinkedList; +import java.util.List; + +/** + * Set: The Fellowship of the Ring + * Side: Free + * Culture: Shire + * Twilight Cost: 1 + * Type: Possession • Pipe + * Game Text: Bearer must be a Hobbit. Fellowship: Discard a pipeweed possession and spot X pipes to remove (X). + */ +public class Card1_292 extends AbstractAttachableFPPossession { + public Card1_292() { + super(1, Culture.SHIRE, "The Gaffer's Pipe", true); + addKeyword(Keyword.PIPE); + } + + @Override + public List getPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) { + List actions = new LinkedList(); + + Filter validTargetFilter = Filters.and(Filters.keyword(Keyword.HOBBIT), Filters.not(Filters.hasAttached(Filters.keyword(Keyword.PIPE)))); + + appendAttachCardAction(actions, game, self, validTargetFilter); + appendTransferPossessionAction(actions, game, self, validTargetFilter); + + if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self) + && Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.PIPEWEED), Filters.type(CardType.POSSESSION))) { + final CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Discard a pipeweed possession and spot X pipes to remove (X)."); + action.addCost( + new ChooseActiveCardEffect(playerId, "Choose pipeweed", Filters.keyword(Keyword.PIPEWEED), Filters.type(CardType.POSSESSION)) { + @Override + protected void cardSelected(PhysicalCard pipeweed) { + action.addCost(new DiscardCardFromPlayEffect(pipeweed)); + } + }); + action.addEffect( + new PlayoutDecisionEffect(game.getUserFeedback(), playerId, + new ForEachYouSpotDecision(1, "Choose number of pipes you wish to spot", game, Filters.keyword(Keyword.PIPE), Integer.MAX_VALUE) { + @Override + public void decisionMade(String result) throws DecisionResultInvalidException { + int spotCount = getValidatedResult(result); + action.addEffect(new RemoveTwilightEffect(spotCount)); + } + })); + actions.add(action); + } + + return actions; + } + +}