From 05d29b67d58fc540681e22fafb253954e05a1efe Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 5 Oct 2011 19:57:44 +0000 Subject: [PATCH] "Hides" --- .../lotro/cards/set4/dunland/Card4_019.java | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/dunland/Card4_019.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/dunland/Card4_019.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/dunland/Card4_019.java new file mode 100644 index 000000000..0270d939a --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/dunland/Card4_019.java @@ -0,0 +1,81 @@ +package com.gempukku.lotro.cards.set4.dunland; + +import com.gempukku.lotro.cards.AbstractPermanent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.ChoiceEffect; +import com.gempukku.lotro.cards.effects.PreventEffect; +import com.gempukku.lotro.cards.effects.RemoveTwilightEffect; +import com.gempukku.lotro.common.*; +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.actions.OptionalTriggerAction; +import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect; +import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect; +import com.gempukku.lotro.logic.effects.DrawCardEffect; +import com.gempukku.lotro.logic.effects.WoundCharactersEffect; +import com.gempukku.lotro.logic.timing.Action; +import com.gempukku.lotro.logic.timing.Effect; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +/** + * Set: The Two Towers + * Side: Shadow + * Culture: Dunland + * Twilight Cost: 1 + * Type: Possession + * Game Text: Plays to your support area. When you play this possession, you may draw a card. Response: If a [DUNLAND] + * Man is about to take a wound, remove (2) or discard this possession to prevent that wound. + */ +public class Card4_019 extends AbstractPermanent { + public Card4_019() { + super(Side.SHADOW, 1, CardType.POSSESSION, Culture.DUNLAND, Zone.SUPPORT, "Hides"); + } + + @Override + public List getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) { + if (PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.sameCard(self))) { + OptionalTriggerAction action = new OptionalTriggerAction(self); + action.appendEffect( + new DrawCardEffect(playerId, 1)); + return Collections.singletonList(action); + } + return null; + } + + @Override + public List getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) { + if (effect.getType() == EffectResult.Type.WOUND) { + final WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect; + Collection woundedCharacters = woundEffect.getAffectedCardsMinusPrevented(game); + if (Filters.filter(woundedCharacters, game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN)).size() > 0) { + final ActivateCardAction action = new ActivateCardAction(self, Keyword.RESPONSE); + + List possibleCosts = new LinkedList(); + possibleCosts.add( + new RemoveTwilightEffect(2)); + possibleCosts.add( + new DiscardCardsFromPlayEffect(self, self)); + + action.appendCost( + new ChoiceEffect(action, playerId, possibleCosts)); + action.appendEffect( + new ChooseActiveCardEffect(self, playerId, "Choose DUNLAND Man", Filters.in(woundedCharacters), Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN)) { + @Override + protected void cardSelected(PhysicalCard card) { + action.insertEffect( + new PreventEffect(woundEffect, card)); + } + }); + return Collections.singletonList(action); + } + } + return null; + } +}