"Mordor Warrior"

This commit is contained in:
marcins78@gmail.com
2011-11-10 00:18:43 +00:00
parent 622f43251b
commit 3c877074be
2 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
package com.gempukku.lotro.cards.modifiers.evaluator;
import com.gempukku.lotro.common.Phase;
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.modifiers.LimitCounter;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
public class CardLimitEvaluator implements Evaluator {
private Integer _evaluated;
private Evaluator _evaluator;
private LotroGame _game;
private PhysicalCard _source;
private Phase _phase;
private int _limit;
public CardLimitEvaluator(LotroGame game, PhysicalCard source, Phase phase, int limit, Evaluator evaluator) {
_game = game;
_source = source;
_phase = phase;
_limit = limit;
_evaluator = evaluator;
}
private int evaluateOnce(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard cardAffected) {
LimitCounter limitCounter = _game.getModifiersEnvironment().getUntilEndOfPhaseLimitCounter(_source, _phase);
int internalResult = _evaluator.evaluateExpression(gameState, modifiersQuerying, cardAffected);
int availableBonusWithLimit = 0;
for (int i = 0; i < internalResult; i++) {
int limitResult = limitCounter.incrementCounter();
if (limitResult <= _limit)
availableBonusWithLimit++;
}
return availableBonusWithLimit;
}
@Override
public int evaluateExpression(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard cardAffected) {
if (_evaluated == null)
_evaluated = evaluateOnce(gameState, modifiersQuerying, cardAffected);
return _evaluated;
}
}

View File

@@ -0,0 +1,65 @@
package com.gempukku.lotro.cards.set7.sauron;
import com.gempukku.lotro.cards.AbstractMinion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromHandEffect;
import com.gempukku.lotro.cards.modifiers.evaluator.CardLimitEvaluator;
import com.gempukku.lotro.cards.modifiers.evaluator.CountSpottableEvaluator;
import com.gempukku.lotro.cards.modifiers.evaluator.NegativeEvaluator;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Race;
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.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
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: 3
* Type: Minion • Orc
* Strength: 9
* Vitality: 3
* Site: 6
* Game Text: Skirmish: Discard a card from hand to make a companion skirmishing this minion strength -1 for each other
* [SAURON] Orc you spot (limit -3).
*/
public class Card7_293 extends AbstractMinion {
public Card7_293() {
super(3, 9, 3, 6, Race.ORC, Culture.SAURON, "Mordor Warrior");
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.SKIRMISH, self, 0)
&& PlayConditions.canDiscardFromHand(game, playerId, 1, Filters.any)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 1));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Chose companion", CardType.COMPANION, Filters.inSkirmishAgainst(self)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new StrengthModifier(self, card, null,
new NegativeEvaluator(
new CardLimitEvaluator(game, self, Phase.SKIRMISH, 3,
new CountSpottableEvaluator(Filters.not(self), Culture.SAURON, Race.ORC)))), Phase.SKIRMISH));
}
});
return Collections.singletonList(action);
}
return null;
}
}