"Troop Tower"

This commit is contained in:
marcins78@gmail.com
2011-11-10 13:25:40 +00:00
parent 98dd71714c
commit b2b56ec2a1

View File

@@ -0,0 +1,79 @@
package com.gempukku.lotro.cards.set7.sauron;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.TakeControlOfASiteEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
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.ActivateCardAction;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Return of the King
* Side: Shadow
* Culture: Sauron
* Twilight Cost: 1
* Type: Condition • Support Area
* Game Text: Engine. To play, spot a [SAURON] Orc. All [SAURON] Orcs are strength +1 for each besieger stacked on
* a site. Regroup: Discard a besieger to take control of a site. Discard this condition.
*/
public class Card7_316 extends AbstractPermanent {
public Card7_316() {
super(Side.SHADOW, 1, CardType.CONDITION, Culture.SAURON, Zone.SUPPORT, "Troop Tower", true);
addKeyword(Keyword.ENGINE);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier, ignoreRoamingPenalty)
&& PlayConditions.canSpot(game, Culture.SAURON, Race.ORC);
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
return Collections.singletonList(
new StrengthModifier(self, Filters.and(Culture.SAURON, Race.ORC), null,
new Evaluator() {
@Override
public int evaluateExpression(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard cardAffected) {
int counter = 0;
for (PhysicalCard site : Filters.filterActive(gameState, modifiersQuerying, CardType.SITE)) {
for (PhysicalCard physicalCard : gameState.getStackedCards(site)) {
if (modifiersQuerying.hasKeyword(gameState, physicalCard, Keyword.BESIEGER))
counter++;
}
}
return counter;
}
}));
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.REGROUP, self, 0)
&& PlayConditions.canDiscardFromPlay(self, game, Keyword.BESIEGER)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Keyword.BESIEGER));
action.appendEffect(
new TakeControlOfASiteEffect(self, playerId));
action.appendEffect(
new DiscardCardsFromPlayEffect(self, self));
return Collections.singletonList(action);
}
return null;
}
}