"Athelas"

This commit is contained in:
marcins78@gmail.com
2011-09-06 17:07:05 +00:00
parent 765e3d135b
commit c3b74dae71
2 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,81 @@
package com.gempukku.lotro.cards.set1.gondor;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filter;
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.DefaultCostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.DiscardCardFromPlayEffect;
import com.gempukku.lotro.logic.effects.HealCharacterEffect;
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
* Side: Free
* Culture: Gondor
* Twilight Cost: 1
* Type: Possession
* Game Text: Bearer must be a [GONDOR] Man. Fellowship: Discard this possession to heal a companion or to remove a
* Shadow condition from a companion.
*/
public class Card1_094 extends AbstractAttachableFPPossession {
public Card1_094() {
super(1, Culture.GONDOR, "Athelas");
}
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Filters.culture(Culture.GONDOR), Filters.keyword(Keyword.MAN));
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Discard this possession to heal a companion or to remove a Shadow condition from a companion.");
action.addCost(
new DiscardCardFromPlayEffect(self, self));
List<Effect> possibleEffects = new LinkedList<Effect>();
possibleEffects.add(
new ChooseActiveCardEffect(playerId, "Choose companion", Filters.type(CardType.COMPANION)) {
@Override
public String getText() {
return "Heal a companion";
}
@Override
protected void cardSelected(PhysicalCard companion) {
action.addEffect(new HealCharacterEffect(companion));
}
});
possibleEffects.add(
new ChooseActiveCardEffect(playerId, "Choose Shadow condition attached to companion", Filters.side(Side.SHADOW), Filters.type(CardType.CONDITION), Filters.attachedTo(Filters.type(CardType.COMPANION))) {
@Override
public String getText() {
return "Discard Shadow condition attached to a companion";
}
@Override
protected void cardSelected(PhysicalCard shadowCondition) {
action.addEffect(new DiscardCardFromPlayEffect(self, shadowCondition));
}
});
action.addEffect(
new ChoiceEffect(action, playerId, possibleEffects, false));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -237,7 +237,7 @@ public class Filters {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return filter.accepts(gameState, modifiersQuerying, physicalCard.getAttachedTo());
return physicalCard.getAttachedTo() != null && filter.accepts(gameState, modifiersQuerying, physicalCard.getAttachedTo());
}
};
}