From 5ca90178ec580c893255c7d1caeca86979a8e02b Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Tue, 17 Jan 2012 10:49:55 +0000 Subject: [PATCH] "The One Ring" --- .../lotro/cards/set15/Card15_001.java | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/Card15_001.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/Card15_001.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/Card15_001.java new file mode 100644 index 000000000..2befe6ecb --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/Card15_001.java @@ -0,0 +1,102 @@ +package com.gempukku.lotro.cards.set15; + +import com.gempukku.lotro.cards.AbstractAttachable; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.TriggerConditions; +import com.gempukku.lotro.cards.effects.AddBurdenEffect; +import com.gempukku.lotro.cards.effects.NegateWoundEffect; +import com.gempukku.lotro.cards.effects.PutOnTheOneRingEffect; +import com.gempukku.lotro.cards.effects.TakeOffTheOneRingEffect; +import com.gempukku.lotro.cards.modifiers.VitalityModifier; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Keyword; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.filters.Filter; +import com.gempukku.lotro.filters.Filters; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.GameState; +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.WoundCharactersEffect; +import com.gempukku.lotro.logic.modifiers.*; +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.LinkedList; +import java.util.List; + +/** + * Set: The Hunters + * Type: The One Ring + * Vitality: +2 + * Game Text: While wearing The One Ring, the Ring-bearer gains hunter 3, and each time he or she is about to take + * a wound in a skirmish, add a burden instead. Skirmish: Add a burden to wear The One Ring until the regroup phase. + */ +public class Card15_001 extends AbstractAttachable { + public Card15_001() { + super(null, CardType.THE_ONE_RING, 0, null, null, "The One Ring", true); + } + + @Override + protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) { + return Filters.none; + } + + @Override + public List getAlwaysOnModifiers(LotroGame game, PhysicalCard self) { + List modifiers = new LinkedList(); + modifiers.add(new VitalityModifier(self, Filters.hasAttached(self), 2)); + modifiers.add(new KeywordModifier(self, Filters.hasAttached(self), Keyword.RING_BOUND)); + modifiers.add( + new KeywordModifier(self, Filters.hasAttached(self), + new Condition() { + @Override + public boolean isFullfilled(GameState gameState, ModifiersQuerying modifiersQuerying) { + return !modifiersQuerying.hasFlagActive(gameState, ModifierFlag.RING_TEXT_INACTIVE) && gameState.isWearingRing(); + } + }, Keyword.HUNTER, 3)); + return modifiers; + } + + @Override + public List getRequiredBeforeTriggers(LotroGame game, Effect effect, PhysicalCard self) { + if (TriggerConditions.isGettingWounded(effect, game, Filters.hasAttached(self)) + && game.getGameState().isWearingRing() + && !game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.RING_TEXT_INACTIVE)) { + WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect; + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect(new NegateWoundEffect(woundEffect, self.getAttachedTo())); + action.appendEffect(new AddBurdenEffect(self, 1)); + return Collections.singletonList(action); + } + return null; + } + + @Override + protected List getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) { + if (PlayConditions.canUseFPCardDuringPhase(game, Phase.SKIRMISH, self) + && !game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.RING_TEXT_INACTIVE)) { + ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new AddBurdenEffect(self, 1)); + action.appendEffect( + new PutOnTheOneRingEffect()); + return Collections.singletonList(action); + } + return null; + } + + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { + if ((TriggerConditions.startOfPhase(game, effectResult, Phase.REGROUP) || TriggerConditions.endOfPhase(game, effectResult, Phase.REGROUP)) + && game.getGameState().isWearingRing()) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect(new TakeOffTheOneRingEffect()); + return Collections.singletonList(action); + } + return null; + } +} \ No newline at end of file