From d93ea5abafa0749cbdd1e9192f4c32b64505f897 Mon Sep 17 00:00:00 2001 From: "marcin.sciesinski" Date: Sat, 20 Jul 2019 07:33:19 -0700 Subject: [PATCH] Elrond --- .../lotro/cards/set40/elven/Card40_041.java | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/elven/Card40_041.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/elven/Card40_041.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/elven/Card40_041.java new file mode 100644 index 000000000..6f14a3c3a --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/elven/Card40_041.java @@ -0,0 +1,126 @@ +package com.gempukku.lotro.cards.set40.elven; + +import com.gempukku.lotro.cards.AbstractAlly; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.TriggerConditions; +import com.gempukku.lotro.cards.effects.ChoiceEffect; +import com.gempukku.lotro.cards.effects.OptionalEffect; +import com.gempukku.lotro.cards.effects.RevealTopCardsOfDrawDeckEffect; +import com.gempukku.lotro.cards.effects.SelfExertEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect; +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.decisions.MultipleChoiceAwaitingDecision; +import com.gempukku.lotro.logic.effects.ChooseAndHealCharactersEffect; +import com.gempukku.lotro.logic.effects.HealCharactersEffect; +import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect; +import com.gempukku.lotro.logic.timing.Action; +import com.gempukku.lotro.logic.timing.Effect; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Title: *Elrond, Peredhil + * Set: Second Edition + * Side: Free + * Culture: Elven + * Twilight Cost: 4 + * Type: Ally - Elf - Rivendell + * Strength: 8 + * Vitality: 4 + * Card Number: 1R41 + * Game Text: At the start of each of your turns, heal each Rivendell ally or heal Elrond twice. + * Regroup: Exert Elrond twice to reveal the top card of any draw deck. If it is a Free Peoples card, you may heal + * a companion. If it is a Shadow card, you may discard a condition. + */ +public class Card40_041 extends AbstractAlly{ + public Card40_041() { + super(4, Block.SECOND_ED, 0, 8, 4, Race.ELF, Culture.ELVEN, "Elrond", "Peredhil", true); + addKeyword(Keyword.RIVENDELL); + } + + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { + if (TriggerConditions.startOfTurn(game, effectResult)) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + List possibleEffects = new ArrayList(2); + possibleEffects.add( + new HealCharactersEffect(self, CardType.ALLY, Keyword.RIVENDELL) { + @Override + public String getText(LotroGame game) { + return "Heal each Rivendell ally"; + } + }); + possibleEffects.add( + new ChooseAndHealCharactersEffect(action, self.getOwner(), 1, 1, 2, self) { + @Override + public String getText(LotroGame game) { + return "Heal Elrond twice"; + } + }); + action.appendEffect( + new ChoiceEffect(action, self.getOwner(), possibleEffects)); + return Collections.singletonList(action); + } + return null; + } + + @Override + protected List getExtraInPlayPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) { + if (PlayConditions.canUseFPCardDuringPhase(game, Phase.REGROUP, self) + && PlayConditions.canSelfExert(self, 2, game)) { + String[] allPlayers = game.getGameState().getPlayerOrder().getAllPlayers().toArray(new String[0]); + + final ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new SelfExertEffect(action, self)); + action.appendCost( + new SelfExertEffect(action, self)); + action.appendEffect( + new PlayoutDecisionEffect(playerId, + new MultipleChoiceAwaitingDecision(1, "Choose a player to reveal top card of deck of", allPlayers) { + @Override + protected void validDecisionMade(int index, String player) { + action.appendEffect( + new RevealTopCardsOfDrawDeckEffect(self, player, 1) { + @Override + protected void cardsRevealed(List revealedCards) { + if (revealedCards.size()>0) { + PhysicalCard firstCard = revealedCards.get(0); + if (Filters.and(Side.FREE_PEOPLE).accepts(game.getGameState(), game.getModifiersQuerying(), + firstCard)) { + action.appendEffect( + new OptionalEffect(action, playerId, + new ChooseAndHealCharactersEffect(action, playerId, 1, 1, CardType.COMPANION)) { + @Override + public String getText(LotroGame game) { + return "Heal a companion"; + } + }); + } else { + action.appendEffect( + new OptionalEffect(action, playerId, + new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1,1, CardType.CONDITION) { + @Override + public String getText(LotroGame game) { + return "Discard a condition"; + } + })); + } + } + } + }); + } + })); + return Collections.singletonList(action); + } + return null; + } +}