"Ulaire Cantea"

This commit is contained in:
marcins78@gmail.com
2011-11-06 18:13:24 +00:00
parent 9a46ee664e
commit 1ed9593513
2 changed files with 81 additions and 6 deletions

View File

@@ -0,0 +1,64 @@
package com.gempukku.lotro.cards.set7.wraith;
import com.gempukku.lotro.cards.AbstractMinion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.cards.modifiers.evaluator.CountActiveEvaluator;
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.AddThreatsEffect;
import com.gempukku.lotro.logic.effects.RemoveThreatsEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: The Return of the King
* Side: Shadow
* Culture: Wraith
* Twilight Cost: 5
* Type: Minion • Nazgul
* Strength: 10
* Vitality: 3
* Site: 3
* Game Text: Fierce. When you play Ulaire Cantea, add a threat for each companion over 4. Maneuver: Remove 2 threats
* and spot another [WRAITH] minion to discard a possession.
*/
public class Card7_211 extends AbstractMinion {
public Card7_211() {
super(5, 10, 3, 3, Race.NAZGUL, Culture.WRAITH, "Ulaire Cantea", true);
addKeyword(Keyword.FIERCE);
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.played(game, effectResult, self)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new AddThreatsEffect(self.getOwner(), self, new CountActiveEvaluator(4, null, CardType.COMPANION)));
return Collections.singletonList(action);
}
return null;
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.MANEUVER, self, 0)
&& PlayConditions.canRemoveThreat(game, self, 2)
&& PlayConditions.canSpot(game, Filters.not(self), Culture.WRAITH, CardType.MINION)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new RemoveThreatsEffect(self, 2));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, CardType.POSSESSION));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -5,6 +5,8 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.modifiers.evaluator.ConstantEvaluator;
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.results.AddThreatResult;
@@ -15,22 +17,30 @@ public class AddThreatsEffect extends AbstractEffect {
private Action _action;
private String _performingPlayer;
private PhysicalCard _source;
private int _count;
private Evaluator _count;
public AddThreatsEffect(String performingPlayer, PhysicalCard source, int count) {
public AddThreatsEffect(String performingPlayer, PhysicalCard source, Evaluator count) {
_performingPlayer = performingPlayer;
_source = source;
_count = count;
}
public AddThreatsEffect(String performingPlayer, PhysicalCard source, int count) {
this(performingPlayer, source, new ConstantEvaluator(count));
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return _count <= getThreatsPossibleToAdd(game);
return evaluateCount(game) <= getThreatsPossibleToAdd(game);
}
private int evaluateCount(LotroGame game) {
return _count.evaluateExpression(game.getGameState(), game.getModifiersQuerying(), null);
}
@Override
public String getText(LotroGame game) {
return "Add " + _count + " threat" + ((_count > 1) ? "s" : "");
return "Add " + _count + " threat" + ((evaluateCount(game) > 1) ? "s" : "");
}
@Override
@@ -45,12 +55,13 @@ public class AddThreatsEffect extends AbstractEffect {
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
int toAdd = Math.min(_count, getThreatsPossibleToAdd(game));
int count = evaluateCount(game);
int toAdd = Math.min(count, getThreatsPossibleToAdd(game));
if (toAdd > 0) {
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " adds " + toAdd + " threat" + ((toAdd > 1) ? "s" : ""));
game.getGameState().addThreats(game.getGameState().getCurrentPlayerId(), toAdd);
return new FullEffectResult(Collections.singleton(new AddThreatResult(_source, toAdd)), toAdd == _count, toAdd == _count);
return new FullEffectResult(Collections.singleton(new AddThreatResult(_source, toAdd)), toAdd == count, toAdd == count);
}
return new FullEffectResult(null, false, false);
}