"Final Count"

This commit is contained in:
marcins78@gmail.com
2011-10-06 21:53:12 +00:00
parent 93b25330d8
commit 0f8acb6e44

View File

@@ -0,0 +1,61 @@
package com.gempukku.lotro.cards.set4.elven;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.AddTokenEffect;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
import com.gempukku.lotro.cards.modifiers.evaluator.Evaluator;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: The Two Towers
* Side: Free
* Culture: Elven
* Twilight Cost: 1
* Type: Condition
* Game Text: Plays to your support area.
* Each time Legolas wins a skirmish, you may place an [ELVEN] token on this card. While you can spot X [ELVEN] tokens
* on this card and the same number of [DWARVEN] tokens on My Axe Is Notched, Legolas is strength +X (limit +3).
*/
public class Card4_069 extends AbstractPermanent {
public Card4_069() {
super(Side.FREE_PEOPLE, 1, CardType.CONDITION, Culture.ELVEN, Zone.SUPPORT, "Final Count", true);
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(final PhysicalCard self) {
return Collections.singletonList(
new StrengthModifier(self, Filters.name("Legolas"), null,
new Evaluator() {
@Override
public int evaluateExpression(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
PhysicalCard myAxeIsNotched = Filters.findFirstActive(gameState, modifiersQuerying, Filters.name("My Axe Is Notched"));
if (myAxeIsNotched != null)
return Math.min(3, Math.max(gameState.getTokenCount(self, Token.ELVEN), gameState.getTokenCount(myAxeIsNotched, Token.DWARVEN)));
return 0;
}
}));
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.name("Legolas"))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new AddTokenEffect(self, self, Token.ELVEN));
return Collections.singletonList(action);
}
return null;
}
}