"O Elbereth! Gilthoniel!"

This commit is contained in:
marcins78@gmail.com
2011-09-30 02:36:00 +00:00
parent 504489094f
commit 5606fd1758
2 changed files with 100 additions and 3 deletions

View File

@@ -1,13 +1,13 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.ChooseableEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
public class TakeOffTheOneRingEffect implements Effect {
public class TakeOffTheOneRingEffect implements ChooseableEffect {
@Override
public String getText(LotroGame game) {
return null;
return "Take off The One Ring";
}
@Override
@@ -15,6 +15,11 @@ public class TakeOffTheOneRingEffect implements Effect {
return null;
}
@Override
public boolean canPlayEffect(LotroGame game) {
return game.getGameState().isWearingRing();
}
@Override
public EffectResult[] playEffect(LotroGame game) {
boolean canTakeOffRing = game.getGameState().isWearingRing();

View File

@@ -0,0 +1,92 @@
package com.gempukku.lotro.cards.set2.shire;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.costs.DiscardCardsFromPlayCost;
import com.gempukku.lotro.cards.effects.CancelSkirmishEffect;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.TakeOffTheOneRingEffect;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
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.game.state.Skirmish;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.ChooseableEffect;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: Mines of Moria
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Condition
* Strength: +1
* Game Text: Tale. Bearer must be the Ring-bearer. Skirmish: Discard this condition to take off The One Ring or
* to cancel a skirmish involving the Ring-bearer and a Nazgul.
*/
public class Card2_108 extends AbstractAttachable {
public Card2_108() {
super(Side.FREE_PEOPLE, CardType.CONDITION, 1, Culture.SHIRE, null, "O Elbereth! Gilthoniel!", true);
addKeyword(Keyword.TALE);
}
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.keyword(Keyword.RING_BEARER);
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(PhysicalCard self) {
return Collections.singletonList(
new StrengthModifier(self, Filters.hasAttached(self), 1));
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)) {
ActivateCardAction action = new ActivateCardAction(self, Keyword.SKIRMISH);
action.appendCost(
new DiscardCardsFromPlayCost(self));
List<ChooseableEffect> possibleEffects = new LinkedList<ChooseableEffect>();
possibleEffects.add(
new TakeOffTheOneRingEffect());
possibleEffects.add(
new CancelRingBearerAndNazgulSkirmish(self));
action.appendEffect(
new ChoiceEffect(action, playerId, possibleEffects));
return Collections.singletonList(action);
}
return null;
}
private class CancelRingBearerAndNazgulSkirmish extends CancelSkirmishEffect implements ChooseableEffect {
private PhysicalCard _attachedCondition;
private CancelRingBearerAndNazgulSkirmish(PhysicalCard attachedCondition) {
_attachedCondition = attachedCondition;
}
@Override
public String getText(LotroGame game) {
return "Cancel a skirmish involving the Ring-bearer and a Nazgul";
}
@Override
public boolean canPlayEffect(LotroGame game) {
Skirmish skirmish = game.getGameState().getSkirmish();
return (skirmish != null && skirmish.getFellowshipCharacter() == _attachedCondition.getAttachedTo()
&& Filters.filter(skirmish.getShadowCharacters(), game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.NAZGUL)).size() > 0);
}
}
}