"Elendil"

This commit is contained in:
marcins78@gmail.com
2011-11-20 02:09:49 +00:00
parent 0ac7c1e285
commit 57106d0583

View File

@@ -0,0 +1,82 @@
package com.gempukku.lotro.cards.set9.gondor;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.ExtraFilters;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.AttachPermanentAction;
import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnModifierEffect;
import com.gempukku.lotro.cards.effects.LiberateASiteEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.cards.modifiers.MoveLimitModifier;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Race;
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 java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Set: Reflections
* Side: Free
* Culture: Gondor
* Twilight Cost: 5
* Type: Companion • Man
* Strength: 8
* Vitality: 5
* Resistance: 6
* Game Text: To play, spot 2 [GONDOR] Men. Fellowship: Play an artifact on Elendil to make the move limit +1 for this
* turn. Regroup: Discard a [GONDOR] artifact to liberate a site.
*/
public class Card9_032 extends AbstractCompanion {
public Card9_032() {
super(5, 8, 5, Culture.GONDOR, Race.MAN, null, "Elendil", true);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier, ignoreRoamingPenalty)
&& PlayConditions.canSpot(game, 2, Culture.GONDOR, Race.MAN);
}
@Override
protected List<ActivateCardAction> getExtraInPlayPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& PlayConditions.canPlayFromHand(playerId, game, CardType.ARTIFACT, ExtraFilters.attachableTo(game, self))) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseArbitraryCardsEffect(playerId, "Choose card to play", game.getGameState().getHand(playerId), Filters.and(CardType.ARTIFACT, ExtraFilters.attachableTo(game, self)), 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
if (selectedCards.size() > 0) {
PhysicalCard selectedCard = selectedCards.iterator().next();
AttachPermanentAction attachPermanentAction = ((AbstractAttachable) selectedCard.getBlueprint()).getPlayCardAction(playerId, game, selectedCard, Filters.and(self), 0);
game.getActionsEnvironment().addActionToStack(attachPermanentAction);
}
}
});
action.appendEffect(
new AddUntilEndOfTurnModifierEffect(
new MoveLimitModifier(self, 1)));
return Collections.singletonList(action);
}
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.REGROUP, self)
&& PlayConditions.canDiscardFromPlay(self, game, Culture.GONDOR, CardType.ARTIFACT)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Culture.GONDOR, CardType.ARTIFACT));
action.appendEffect(
new LiberateASiteEffect(self));
return Collections.singletonList(action);
}
return null;
}
}