"The Bridge of Khazad-dum"

This commit is contained in:
marcins78@gmail.com
2011-09-01 00:15:26 +00:00
parent ae25555ae4
commit aef3ac35d0

View File

@@ -1,6 +1,27 @@
package com.gempukku.lotro.cards.set1.site;
import com.gempukku.lotro.cards.AbstractSite;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.effects.ChooseCardsFromHandEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: The Fellowship of the Ring
@@ -12,5 +33,58 @@ import com.gempukku.lotro.cards.AbstractSite;
public class Card1_349 extends AbstractSite {
public Card1_349() {
super("The Bridge of Khazad-dum", 5, 6, Direction.LEFT);
addKeyword(Keyword.UNDERGROUND);
}
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseSiteDuringPhase(game.getGameState(), Phase.SHADOW, self)) {
CostToEffectAction action = new CostToEffectAction(self, Keyword.SHADOW, "Play The Balrog from your draw deck or hand; The Balrog's twilight cost is -6.");
List<Effect> possibleEffects = new LinkedList<Effect>();
// Play from hand
possibleEffects.add(
new ChooseCardsFromHandEffect(playerId, "Choose Balrog to play", 1, 1, Filters.name("Balrog"),
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return
!Filters.canSpot(gameState, modifiersQuerying, Filters.name("Balrog"))
&& gameState.getTwilightPool() >= (modifiersQuerying.getTwilightCost(gameState, physicalCard) - 6);
}
}) {
@Override
protected void cardsSelected(List<PhysicalCard> selectedCards) {
PhysicalCard balrog = selectedCards.get(0);
game.getActionsEnvironment().addActionToStack(
new PlayPermanentAction(balrog, Zone.SHADOW_CHARACTERS, -6));
}
});
possibleEffects.add(
new ChooseArbitraryCardsEffect(playerId, "Choose Balrog to play",
Filters.filter(game.getGameState().getDeck(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.name("Balrog"),
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return
!Filters.canSpot(gameState, modifiersQuerying, Filters.name("Balrog"))
&& gameState.getTwilightPool() >= (modifiersQuerying.getTwilightCost(gameState, physicalCard) - 6);
}
}), 1, 1) {
@Override
protected void cardsSelected(List<PhysicalCard> selectedCards) {
PhysicalCard balrog = selectedCards.get(0);
game.getActionsEnvironment().addActionToStack(
new PlayPermanentAction(balrog, Zone.SHADOW_CHARACTERS, -6));
}
});
action.addEffect(
new ChoiceEffect(action, playerId, possibleEffects, false));
return Collections.singletonList(action);
}
return null;
}
}