From e18a8b988c16d7844e74b32030566d486eac4470 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 25 Jan 2012 17:11:51 +0000 Subject: [PATCH] "Shepherd of the Trees" --- .../gempukku/lotro/cards/PlayConditions.java | 6 ++ .../lotro/cards/set15/gandalf/Card15_036.java | 74 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/gandalf/Card15_036.java 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 02335dae7..d6aadecf7 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 @@ -232,6 +232,12 @@ public class PlayConditions { return canHeal(source, game, 1, filters); } + public static boolean canPlayFromDeck(String playerId, LotroGame game, Filterable... filters) { + if (game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.CANT_PLAY_FROM_DISCARD_OR_DECK)) + return false; + return Filters.filter(game.getGameState().getDeck(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.and(filters, Filters.playable(game))).size() > 0; + } + public static boolean canPlayFromHand(String playerId, LotroGame game, Filterable... filters) { return Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.and(filters, Filters.playable(game))).size() > 0; } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/gandalf/Card15_036.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/gandalf/Card15_036.java new file mode 100644 index 000000000..2c780c4bc --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/gandalf/Card15_036.java @@ -0,0 +1,74 @@ +package com.gempukku.lotro.cards.set15.gandalf; + +import com.gempukku.lotro.cards.AbstractCompanion; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.RevealCardEffect; +import com.gempukku.lotro.cards.effects.SelfExertEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDeckEffect; +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 com.gempukku.lotro.logic.modifiers.Modifier; +import com.gempukku.lotro.logic.modifiers.SpotCondition; +import com.gempukku.lotro.logic.modifiers.StrengthModifier; +import com.gempukku.lotro.logic.timing.UnrespondableEffect; + +import java.util.Collections; +import java.util.List; + +/** + * Set: The Hunters + * Side: Free + * Culture: Gandalf + * Twilight Cost: 5 + * Type: Companion • Ent + * Strength: 7 + * Vitality: 4 + * Resistance: 6 + * Game Text: While you can spot 4 Ents, this companion is strength +3. Maneuver: Exert this companion to reveal + * the bottom card of your draw deck. If it is a [GANDALF] character, you may play it. + */ +public class Card15_036 extends AbstractCompanion { + public Card15_036() { + super(5, 7, 4, 6, Culture.GANDALF, Race.ENT, null, "Shepherd of the Trees"); + } + + @Override + public Modifier getAlwaysOnModifier(PhysicalCard self) { + return new StrengthModifier(self, self, new SpotCondition(4, Race.ENT), 3); + } + + @Override + protected List getExtraInPlayPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) { + if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self) + && PlayConditions.canSelfExert(self, game)) { + final ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new SelfExertEffect(self)); + action.appendEffect( + new UnrespondableEffect() { + @Override + public void doPlayEffect(LotroGame game) { + List deck = game.getGameState().getDeck(playerId); + if (deck.size() > 0) { + PhysicalCard bottomCard = deck.get(deck.size() - 1); + action.appendEffect( + new RevealCardEffect(self, bottomCard)); + if (Filters.and(Culture.GANDALF, Filters.character) + .accepts(game.getGameState(), game.getModifiersQuerying(), bottomCard) + && PlayConditions.canPlayFromDeck(playerId, game, bottomCard)) { + action.appendEffect( + new ChooseAndPlayCardFromDeckEffect(playerId, bottomCard)); + } + } + } + }); + return Collections.singletonList(action); + } + return null; + } +}