"Saruman's Laboratory"

This commit is contained in:
marcins78@gmail.com
2011-10-22 21:14:03 +00:00
parent 28de90133b
commit 874f90e0d9

View File

@@ -0,0 +1,57 @@
package com.gempukku.lotro.cards.set6.site;
import com.gempukku.lotro.cards.AbstractSite;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromHandEffect;
import com.gempukku.lotro.common.Block;
import com.gempukku.lotro.common.CardType;
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 com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Set: Ents of Fangorn
* Twilight Cost: 9
* Type: Site
* Site: 9T
* Game Text: Response: If your minion is about to take a wound, discard 2 cards from hand to prevent that wound.
*/
public class Card6_120 extends AbstractSite {
public Card6_120() {
super("Saruman's Laboratory", Block.TWO_TOWERS, 9, 9, Direction.LEFT);
}
@Override
public List<? extends Action> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (PlayConditions.canUseSiteDuringPhase(game.getGameState(), null, self)
&& PlayConditions.isGettingWounded(effect, game, CardType.MINION, Filters.owner(playerId))
&& PlayConditions.canDiscardFromHand(game, playerId, 2, Filters.any)) {
final WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
Collection<PhysicalCard> woundedCharacters = woundEffect.getAffectedCardsMinusPrevented(game);
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 2));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose minion", CardType.MINION, Filters.owner(playerId), Filters.in(woundedCharacters)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.insertEffect(
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);
}
return null;
}
}