This commit is contained in:
marcins78@gmail.com
2011-10-22 20:27:00 +00:00
parent 1a5e321112
commit 3758fd459d
2 changed files with 86 additions and 0 deletions

View File

@@ -388,6 +388,14 @@ public class PlayConditions {
return played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.and(filters));
}
public static boolean movesTo(LotroGame game, EffectResult effectResult, Filterable... filters) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_TO
&& Filters.and(filters).accepts(game.getGameState(), game.getModifiersQuerying(), game.getGameState().getCurrentSite())) {
return true;
}
return false;
}
public static boolean canRemoveTokens(LotroGame game, Token token, int count, Filterable... fromFilters) {
return Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.and(fromFilters, Filters.hasToken(token, count))).size() > 0;
}

View File

@@ -0,0 +1,78 @@
package com.gempukku.lotro.cards.set6.shire;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
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.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.effects.CorruptRingBearerEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Ents of Fangorn
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Condition
* Game Text: Bearer must be Frodo. Each time Frodo is about to be killed by a wound, add a burden instead. When
* the fellowship moves to site 9, Frodo is corrupted. Regroup: If you can spot no minions, discard this condition.
*/
public class Card6_109 extends AbstractAttachable {
public Card6_109() {
super(Side.FREE_PEOPLE, CardType.CONDITION, 1, Culture.SHIRE, null, "Held");
}
@Override
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.name("Frodo");
}
@Override
public List<RequiredTriggerAction> getRequiredBeforeTriggers(LotroGame game, Effect effect, PhysicalCard self) {
if (PlayConditions.isGettingWounded(effect, game, Filters.hasAttached(self))
&& Filters.exhausted.accepts(game.getGameState(), game.getModifiersQuerying(), self.getAttachedTo())) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new PreventCardEffect((WoundCharactersEffect) effect, self.getAttachedTo()));
action.appendEffect(
new AddBurdenEffect(self, 1));
return Collections.singletonList(action);
}
return null;
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.movesTo(game, effectResult, Filters.siteNumber(9))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new CorruptRingBearerEffect());
return Collections.singletonList(action);
}
return null;
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.REGROUP, self)
&& Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), CardType.MINION) == 0) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(
new DiscardCardsFromPlayEffect(self, self));
return Collections.singletonList(action);
}
return null;
}
}