"Banished"

This commit is contained in:
marcins78@gmail.com
2011-10-09 10:18:24 +00:00
parent 819209e0d7
commit 6321b49cfa

View File

@@ -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<RequiredTriggerAction> 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;
}
}