From 57106d05835cc5f4dab116c8589fb342402f6209 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Sun, 20 Nov 2011 02:09:49 +0000 Subject: [PATCH] "Elendil" --- .../lotro/cards/set9/gondor/Card9_032.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set9/gondor/Card9_032.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set9/gondor/Card9_032.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set9/gondor/Card9_032.java new file mode 100644 index 000000000..da6787cb9 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set9/gondor/Card9_032.java @@ -0,0 +1,82 @@ +package com.gempukku.lotro.cards.set9.gondor; + +import com.gempukku.lotro.cards.AbstractAttachable; +import com.gempukku.lotro.cards.AbstractCompanion; +import com.gempukku.lotro.cards.ExtraFilters; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.actions.AttachPermanentAction; +import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnModifierEffect; +import com.gempukku.lotro.cards.effects.LiberateASiteEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseArbitraryCardsEffect; +import com.gempukku.lotro.cards.modifiers.MoveLimitModifier; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Culture; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.common.Race; +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.ActivateCardAction; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + * Set: Reflections + * Side: Free + * Culture: Gondor + * Twilight Cost: 5 + * Type: Companion • Man + * Strength: 8 + * Vitality: 5 + * Resistance: 6 + * Game Text: To play, spot 2 [GONDOR] Men. Fellowship: Play an artifact on Elendil to make the move limit +1 for this + * turn. Regroup: Discard a [GONDOR] artifact to liberate a site. + */ +public class Card9_032 extends AbstractCompanion { + public Card9_032() { + super(5, 8, 5, Culture.GONDOR, Race.MAN, null, "Elendil", true); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) { + return super.checkPlayRequirements(playerId, game, self, twilightModifier, ignoreRoamingPenalty) + && PlayConditions.canSpot(game, 2, Culture.GONDOR, Race.MAN); + } + + @Override + protected List getExtraInPlayPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) { + if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self) + && PlayConditions.canPlayFromHand(playerId, game, CardType.ARTIFACT, ExtraFilters.attachableTo(game, self))) { + ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new ChooseArbitraryCardsEffect(playerId, "Choose card to play", game.getGameState().getHand(playerId), Filters.and(CardType.ARTIFACT, ExtraFilters.attachableTo(game, self)), 1, 1) { + @Override + protected void cardsSelected(LotroGame game, Collection selectedCards) { + if (selectedCards.size() > 0) { + PhysicalCard selectedCard = selectedCards.iterator().next(); + AttachPermanentAction attachPermanentAction = ((AbstractAttachable) selectedCard.getBlueprint()).getPlayCardAction(playerId, game, selectedCard, Filters.and(self), 0); + game.getActionsEnvironment().addActionToStack(attachPermanentAction); + } + } + }); + action.appendEffect( + new AddUntilEndOfTurnModifierEffect( + new MoveLimitModifier(self, 1))); + return Collections.singletonList(action); + } + if (PlayConditions.canUseFPCardDuringPhase(game, Phase.REGROUP, self) + && PlayConditions.canDiscardFromPlay(self, game, Culture.GONDOR, CardType.ARTIFACT)) { + ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Culture.GONDOR, CardType.ARTIFACT)); + action.appendEffect( + new LiberateASiteEffect(self)); + return Collections.singletonList(action); + } + return null; + } + +}