diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/isengard/Card2_048.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/isengard/Card2_048.java new file mode 100644 index 000000000..9a0b58b4c --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/isengard/Card2_048.java @@ -0,0 +1,76 @@ +package com.gempukku.lotro.cards.set2.isengard; + +import com.gempukku.lotro.cards.AbstractAttachable; +import com.gempukku.lotro.cards.actions.AttachPermanentAction; +import com.gempukku.lotro.cards.costs.ChooseAndExertCharactersCost; +import com.gempukku.lotro.cards.effects.ExertCharacterEffect; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Culture; +import com.gempukku.lotro.common.Keyword; +import com.gempukku.lotro.common.Side; +import com.gempukku.lotro.filters.Filter; +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.RequiredTriggerAction; +import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.Collections; +import java.util.List; + +/** + * Set: Mines of Moria + * Side: Shadow + * Culture: Isengard + * Twilight Cost: 2 + * Type: Condition + * Game Text: Spell. Weather. To play, exert an [ISENGARD] minion. Plays on a site. Limit 1 per site. When + * the fellowship moves from this site, every companion must exert. Discard this condition at the end of the turn. + */ +public class Card2_048 extends AbstractAttachable { + public Card2_048() { + super(Side.SHADOW, CardType.CONDITION, 2, Culture.ISENGARD, null, "Wizard Storm"); + addKeyword(Keyword.SPELL); + addKeyword(Keyword.WEATHER); + } + + @Override + protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) { + return Filters.and(Filters.type(CardType.SITE), Filters.not(Filters.hasAttached(Filters.name("Wizard Storm")))); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, Filter additionalAttachmentFilter, int twilightModifier) { + return super.checkPlayRequirements(playerId, game, self, additionalAttachmentFilter, twilightModifier) + && Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.ISENGARD), Filters.type(CardType.MINION), Filters.canExert()); + } + + @Override + public AttachPermanentAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, Filter additionalAttachmentFilter, int twilightModifier) { + AttachPermanentAction action = super.getPlayCardAction(playerId, game, self, additionalAttachmentFilter, twilightModifier); + action.appendCost( + new ChooseAndExertCharactersCost(action, playerId, 1, 1, Filters.culture(Culture.ISENGARD), Filters.type(CardType.MINION))); + return action; + } + + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { + if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM + && game.getGameState().getCurrentSite() == self) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect( + new ExertCharacterEffect(game.getGameState().getCurrentPlayerId(), Filters.type(CardType.COMPANION))); + return Collections.singletonList(action); + } + + if (effectResult.getType() == EffectResult.Type.END_OF_TURN) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect(new DiscardCardsFromPlayEffect(self, self)); + + return Collections.singletonList(action); + } + + return null; + } +}