"Forewarned"

This commit is contained in:
marcins78@gmail.com
2011-10-20 15:14:45 +00:00
parent 4bc44aad0f
commit d1b885347f

View File

@@ -0,0 +1,62 @@
package com.gempukku.lotro.cards.set6.elven;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.DiscardCardFromDeckEffect;
import com.gempukku.lotro.common.*;
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.decisions.ArbitraryCardsSelectionDecision;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.effects.AddTwilightEffect;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: Ents of Fangorn
* Side: Free
* Culture: Elven
* Twilight Cost: 0
* Type: Condition
* Game Text: To play, spot 2 Elves. Plays to your support area. Fellowship: Add (1) to look at the top card of your
* draw deck. You may discard this condition to discard that card.
*/
public class Card6_017 extends AbstractPermanent {
public Card6_017() {
super(Side.FREE_PEOPLE, 0, CardType.CONDITION, Culture.ELVEN, Zone.SUPPORT, "Forewarned");
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& PlayConditions.canSpot(game, 2, Race.ELF);
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new AddTwilightEffect(self, 1));
if (game.getGameState().getDeck(playerId).size() > 0)
action.appendEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new ArbitraryCardsSelectionDecision(1, "Choose a card to discard from deck", Collections.singleton(game.getGameState().getDeck(playerId).get(0)), 0, 1) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
final List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
for (PhysicalCard selectedCard : selectedCards) {
action.insertEffect(
new DiscardCardFromDeckEffect(selectedCard));
}
}
}));
return Collections.singletonList(action);
}
return null;
}
}