"The Art of Gandalf"

This commit is contained in:
marcins78@gmail.com
2011-12-04 18:03:30 +00:00
parent 12bde23064
commit 61fd4cfb1e

View File

@@ -0,0 +1,67 @@
package com.gempukku.lotro.cards.set11.gandalf;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.choose.ChooseAndStackCardsFromHandEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseStackedCardsEffect;
import com.gempukku.lotro.cards.effects.PutCardFromStackedIntoHandEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.effects.ChooseAndDiscardCardsFromHandEffect;
import com.gempukku.lotro.filters.Filters;
import java.util.List;
import java.util.Collections;
import java.util.Collection;
/**
* Set: Shadows
* Side: Free
* Culture: Gandalf
* Twilight Cost: 1
* Type: Possession • Support Area
* Game Text: To play, spot a [GANDALF] Wizard. Regroup: Stack a spell from hand here. Fellowship: Discard a [GANDALF]
* card from hand to take a card stacked here into hand.
*/
public class Card11_028 extends AbstractPermanent {
public Card11_028() {
super(Side.FREE_PEOPLE, 1, CardType.POSSESSION, Culture.GANDALF, Zone.SUPPORT, "The Art of Gandalf");
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile)
&& PlayConditions.canSpot(game, Culture.GANDALF, Race.WIZARD);
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.REGROUP, self)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(
new ChooseAndStackCardsFromHandEffect(action, playerId, 1, 1, self, Keyword.SPELL));
return Collections.singletonList(action);
}
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& PlayConditions.canDiscardFromHand(game, playerId, 1, Culture.GANDALF)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 1, Culture.GANDALF));
action.appendEffect(
new ChooseStackedCardsEffect(action, playerId, 1, 1, self, Filters.any) {
@Override
protected void cardsChosen(Collection<PhysicalCard> stackedCards) {
for (PhysicalCard stackedCard : stackedCards) {
action.appendEffect(
new PutCardFromStackedIntoHandEffect(stackedCard));
}
}
});
return Collections.singletonList(action);
}
return null;
}
}