From fb44830358b72bb1a15ef20871f3313b1bdfe264 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Sun, 6 Nov 2011 12:44:13 +0000 Subject: [PATCH] "Called" --- .../gempukku/lotro/cards/PlayConditions.java | 5 ++ .../lotro/cards/set7/wraith/Card7_174.java | 69 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/wraith/Card7_174.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 68a610d73..06d69474a 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 @@ -69,6 +69,11 @@ public class PlayConditions { && twilightCost <= gameState.getTwilightPool(); } + public static boolean canUseShadowCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self, int twilightCost) { + return (phase == null || game.getGameState().getCurrentPhase() == phase) && (self.getZone() == Zone.SUPPORT || self.getZone() == Zone.SHADOW_CHARACTERS || self.getZone() == Zone.ATTACHED) + && twilightCost <= game.getGameState().getTwilightPool(); + } + public static boolean canUseStackedShadowCardDuringPhase(GameState gameState, Phase phase, PhysicalCard self, int twilightCost) { return (phase == null || gameState.getCurrentPhase() == phase) && self.getZone() == Zone.STACKED && twilightCost <= gameState.getTwilightPool(); diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/wraith/Card7_174.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/wraith/Card7_174.java new file mode 100644 index 000000000..219d57f86 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/wraith/Card7_174.java @@ -0,0 +1,69 @@ +package com.gempukku.lotro.cards.set7.wraith; + +import com.gempukku.lotro.cards.AbstractPermanent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.PreventableEffect; +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.SubAction; +import com.gempukku.lotro.logic.effects.AssignmentEffect; +import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect; +import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect; +import com.gempukku.lotro.logic.effects.RemoveThreatsEffect; +import com.gempukku.lotro.logic.timing.Action; +import com.gempukku.lotro.logic.timing.Effect; + +import java.util.Collections; +import java.util.List; + +/** + * Set: The Return of the King + * Side: Shadow + * Culture: Wraith + * Twilight Cost: 1 + * Type: Condition • Support Area + * Game Text: Assignment: Remove 5 threats to assign a Nazgul to a companion (except the Ring-bearer). The Free Peoples + * player may discard that companion. + */ +public class Card7_174 extends AbstractPermanent { + public Card7_174() { + super(Side.SHADOW, 1, CardType.CONDITION, Culture.WRAITH, Zone.SUPPORT, "Called"); + } + + @Override + protected List getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) { + if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.ASSIGNMENT, self, 0) + && PlayConditions.canRemoveThreat(game, self, 5)) { + final ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new RemoveThreatsEffect(self, 5)); + action.appendEffect( + new ChooseActiveCardEffect(self, playerId, "Choose a Nazgul", Race.NAZGUL, Filters.canBeAssignedToSkirmishByEffect(Side.SHADOW)) { + @Override + protected void cardSelected(LotroGame game, final PhysicalCard nazgul) { + action.insertEffect( + new ChooseActiveCardEffect(self, playerId, "Choose a companion", CardType.COMPANION, Filters.not(Keyword.RING_BEARER), Filters.canBeAssignedToSkirmishByEffectAgainst(Side.SHADOW, nazgul)) { + @Override + protected void cardSelected(LotroGame game, final PhysicalCard card) { + action.appendEffect( + new PreventableEffect(action, + new AssignmentEffect(playerId, card, nazgul), + game.getGameState().getCurrentPlayerId(), + new PreventableEffect.PreventionCost() { + @Override + public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) { + return new DiscardCardsFromPlayEffect(self, card); + } + })); + } + }); + } + }); + return Collections.singletonList(action); + } + return null; + } +}