From 6c3abd5f8ce241324f6cf7ce06990df5cc0efc91 Mon Sep 17 00:00:00 2001 From: marcins78 Date: Fri, 25 Jan 2013 11:38:57 +0000 Subject: [PATCH] "You Shall Not Pass!" --- .../lotro/cards/set20/gandalf/Card20_174.java | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set20/gandalf/Card20_174.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set20/gandalf/Card20_174.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set20/gandalf/Card20_174.java new file mode 100644 index 000000000..267776d7f --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set20/gandalf/Card20_174.java @@ -0,0 +1,81 @@ +package com.gempukku.lotro.cards.set20.gandalf; + +import com.gempukku.lotro.cards.AbstractEvent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.TriggerConditions; +import com.gempukku.lotro.cards.actions.PlayEventAction; +import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnActionProxyEffect; +import com.gempukku.lotro.common.*; +import com.gempukku.lotro.filters.Filters; +import com.gempukku.lotro.game.AbstractActionProxy; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.actions.RequiredTriggerAction; +import com.gempukku.lotro.logic.effects.ChooseAndDiscardCardsFromHandEffect; +import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect; +import com.gempukku.lotro.logic.effects.KillEffect; +import com.gempukku.lotro.logic.timing.Action; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.Collections; +import java.util.List; + +/** + * 2 + * You Shall Not Pass! + * Gandalf Event • Skirmish + * Spell. + * If you have initiative, you may play this event from your discard pile. If you do, place Gandalf in the dead pile at + * the end of turn. Discard four cards from hand to discard all minions skirmishing Gandalf. + */ +public class Card20_174 extends AbstractEvent { + public Card20_174() { + super(Side.FREE_PEOPLE, 2, Culture.GANDALF, "You Shall Not Pass!", Phase.SKIRMISH); + addKeyword(Keyword.SPELL); + } + + @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.canDiscardCardsFromHandToPlay(self, game, playerId, 4, Filters.any); + } + + @Override + public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) { + PlayEventAction action = new PlayEventAction(self); + action.appendCost( + new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 4, Filters.any)); + action.appendEffect( + new DiscardCardsFromPlayEffect(self, CardType.MINION, Filters.inSkirmishAgainst(Filters.gandalf))); + return action; + } + + @Override + public List getPhaseActionsFromDiscard(String playerId, LotroGame game, final PhysicalCard self) { + if (PlayConditions.isPhase(game, Phase.SKIRMISH) + && PlayConditions.hasInitiative(game, Side.FREE_PEOPLE) + && checkPlayRequirements(playerId, game, self, 0, 0, false, false)) { + final PlayEventAction playCardAction = getPlayCardAction(playerId, game, self, 0, false); + playCardAction.appendEffect( + new AddUntilEndOfTurnActionProxyEffect( + new AbstractActionProxy() { + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult) { + if (TriggerConditions.endOfTurn(game, effectResult)) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + PhysicalCard gandalf = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.gandalf); + if (gandalf != null) + action.appendEffect( + new KillEffect(gandalf, KillEffect.Cause.CARD_EFFECT)); + return Collections.singletonList(action); + } + return null; + } + } + )); + return Collections.singletonList(playCardAction); + } + return null; + } + +}