From 3758fd459d590f08fa24d3da2b485d9a91985337 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Sat, 22 Oct 2011 20:27:00 +0000 Subject: [PATCH] "Held" --- .../gempukku/lotro/cards/PlayConditions.java | 8 ++ .../lotro/cards/set6/shire/Card6_109.java | 78 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/shire/Card6_109.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 8a5d6795b..48c81c1da 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 @@ -388,6 +388,14 @@ public class PlayConditions { return played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.and(filters)); } + public static boolean movesTo(LotroGame game, EffectResult effectResult, Filterable... filters) { + if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_TO + && Filters.and(filters).accepts(game.getGameState(), game.getModifiersQuerying(), game.getGameState().getCurrentSite())) { + return true; + } + return false; + } + public static boolean canRemoveTokens(LotroGame game, Token token, int count, Filterable... fromFilters) { return Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.and(fromFilters, Filters.hasToken(token, count))).size() > 0; } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/shire/Card6_109.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/shire/Card6_109.java new file mode 100644 index 000000000..c7e4989e5 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/shire/Card6_109.java @@ -0,0 +1,78 @@ +package com.gempukku.lotro.cards.set6.shire; + +import com.gempukku.lotro.cards.AbstractAttachable; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.AddBurdenEffect; +import com.gempukku.lotro.cards.effects.PreventCardEffect; +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.RequiredTriggerAction; +import com.gempukku.lotro.logic.effects.CorruptRingBearerEffect; +import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect; +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.Collections; +import java.util.List; + +/** + * Set: Ents of Fangorn + * Side: Free + * Culture: Shire + * Twilight Cost: 1 + * Type: Condition + * Game Text: Bearer must be Frodo. Each time Frodo is about to be killed by a wound, add a burden instead. When + * the fellowship moves to site 9, Frodo is corrupted. Regroup: If you can spot no minions, discard this condition. + */ +public class Card6_109 extends AbstractAttachable { + public Card6_109() { + super(Side.FREE_PEOPLE, CardType.CONDITION, 1, Culture.SHIRE, null, "Held"); + } + + @Override + protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) { + return Filters.name("Frodo"); + } + + @Override + public List getRequiredBeforeTriggers(LotroGame game, Effect effect, PhysicalCard self) { + if (PlayConditions.isGettingWounded(effect, game, Filters.hasAttached(self)) + && Filters.exhausted.accepts(game.getGameState(), game.getModifiersQuerying(), self.getAttachedTo())) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect( + new PreventCardEffect((WoundCharactersEffect) effect, self.getAttachedTo())); + action.appendEffect( + new AddBurdenEffect(self, 1)); + return Collections.singletonList(action); + } + return null; + } + + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { + if (PlayConditions.movesTo(game, effectResult, Filters.siteNumber(9))) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect( + new CorruptRingBearerEffect()); + return Collections.singletonList(action); + } + return null; + } + + @Override + protected List getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) { + if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.REGROUP, self) + && Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), CardType.MINION) == 0) { + ActivateCardAction action = new ActivateCardAction(self); + action.appendEffect( + new DiscardCardsFromPlayEffect(self, self)); + return Collections.singletonList(action); + } + return null; + } +}