From 6321b49cfa7c554c48ee65c5a56d3729b5a28fc1 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Sun, 9 Oct 2011 10:18:24 +0000 Subject: [PATCH] "Banished" --- .../lotro/cards/set4/isengard/Card4_139.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_139.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_139.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_139.java new file mode 100644 index 000000000..bbcd0bdaf --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_139.java @@ -0,0 +1,68 @@ +package com.gempukku.lotro.cards.set4.isengard; + +import com.gempukku.lotro.cards.AbstractAttachable; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.actions.AttachPermanentAction; +import com.gempukku.lotro.cards.effects.ChooseAndExertCharactersEffect; +import com.gempukku.lotro.cards.effects.ExertCharactersEffect; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Culture; +import com.gempukku.lotro.common.Race; +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.timing.EffectResult; + +import java.util.Collections; +import java.util.List; + +/** + * Set: The Two Towers + * Side: Shadow + * Culture: Isengard + * Twilight Cost: 0 + * Type: Condition + * Game Text: To play, exert Saruman or an [ISENGARD] Man. Plays on a Free Peoples Man. Each time another ally + * or companion loses a skirmish, bearer must exert. + */ +public class Card4_139 extends AbstractAttachable { + public Card4_139() { + super(Side.SHADOW, CardType.CONDITION, 0, Culture.ISENGARD, null, "Banished"); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, Filter additionalAttachmentFilter, int twilightModifier) { + return super.checkPlayRequirements(playerId, game, self, additionalAttachmentFilter, twilightModifier) + && PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.or(Filters.name("Saruman"), Filters.and(Filters.culture(Culture.ISENGARD), Filters.race(Race.MAN)))); + } + + @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 ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.or(Filters.name("Saruman"), Filters.and(Filters.culture(Culture.ISENGARD), Filters.race(Race.MAN))))); + return action; + } + + @Override + protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) { + return Filters.and(Filters.side(Side.FREE_PEOPLE), Filters.race(Race.MAN)); + } + + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { + if (PlayConditions.losesSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, + Filters.and( + Filters.not(Filters.hasAttached(self)), + Filters.or(Filters.type(CardType.ALLY), Filters.type(CardType.COMPANION))))) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect( + new ExertCharactersEffect(self, Filters.hasAttached(self))); + return Collections.singletonList(action); + } + return null; + } +}