"Unknown Perils"

This commit is contained in:
marcins78@gmail.com
2011-09-30 14:05:54 +00:00
parent 3db19dd9d3
commit 56f0ce4726
2 changed files with 61 additions and 1 deletions

View File

@@ -27,7 +27,7 @@ import java.util.List;
*/
public class Card3_035 extends AbstractPermanent {
public Card3_035() {
super(Side.FREE_PEOPLE, 2, CardType.CONDITION, Culture.GANDALF, Zone.FREE_SUPPORT, "Trust Me as you Once Did");
super(Side.FREE_PEOPLE, 2, CardType.CONDITION, Culture.GANDALF, Zone.FREE_SUPPORT, "Trust Me as You Once Did");
}
@Override

View File

@@ -0,0 +1,60 @@
package com.gempukku.lotro.cards.set3.gandalf;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.costs.ChooseAndExertCharactersCost;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.common.*;
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.WoundCharacterEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Gandalf
* Twilight Cost: 2
* Type: Condition
* Game Text: Plays to your support area. Response: If a companion is about to take a wound, spot 4 twilight tokens
* and exert Gandalf to prevent that wound.
*/
public class Card3_036 extends AbstractPermanent {
public Card3_036() {
super(Side.FREE_PEOPLE, 2, CardType.CONDITION, Culture.GANDALF, Zone.FREE_SUPPORT, "Unknown Perils");
}
@Override
public List<? extends Action> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (effect.getType() == EffectResult.Type.WOUND
&& game.getGameState().getTwilightPool() >= 4
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.name("Gandalf"))) {
final WoundCharacterEffect woundEffect = (WoundCharacterEffect) effect;
Collection<PhysicalCard> woundedCharacters = woundEffect.getCardsToBeAffected(game);
if (Filters.filter(woundedCharacters, game.getGameState(), game.getModifiersQuerying(), Filters.type(CardType.COMPANION)).size() > 0) {
final ActivateCardAction action = new ActivateCardAction(self, Keyword.RESPONSE);
action.appendCost(
new ChooseAndExertCharactersCost(action, playerId, 1, 1, Filters.name("Gandalf")));
action.appendEffect(
new ChooseActiveCardEffect(playerId, "Choose a companion", Filters.in(woundedCharacters), Filters.type(CardType.COMPANION)) {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(woundEffect, card));
}
});
return Collections.singletonList(action);
}
}
return null;
}
}