"Boromir's Gauntlets"

This commit is contained in:
marcins78@gmail.com
2011-10-08 14:21:38 +00:00
parent 0d854419a0
commit 41b48a94e4
4 changed files with 104 additions and 6 deletions

View File

@@ -1,12 +1,43 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
public class CancelSkirmishEffect extends AbstractEffect {
private Filter _involvementFilter;
public CancelSkirmishEffect() {
}
public CancelSkirmishEffect(Filter involvementFilter) {
_involvementFilter = involvementFilter;
}
public class CancelSkirmishEffect extends UnrespondableEffect {
@Override
public void doPlayEffect(LotroGame game) {
game.getGameState().sendMessage("Skirmish is cancelled");
game.getGameState().getSkirmish().cancel();
public String getText(LotroGame game) {
return "Cancel skirmish";
}
@Override
public EffectResult.Type getType() {
return null;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return (_involvementFilter == null || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.inSkirmish(), _involvementFilter) > 0);
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (_involvementFilter == null || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.inSkirmish(), _involvementFilter) > 0) {
game.getGameState().sendMessage("Skirmish is cancelled");
game.getGameState().getSkirmish().cancel();
return new FullEffectResult(null, true, true);
}
return new FullEffectResult(null, false, false);
}
}

View File

@@ -7,6 +7,8 @@ import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -16,6 +18,14 @@ public class PreventableEffect extends AbstractEffect {
private Iterator<String> _choicePlayers;
private Effect _preventionCost;
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, String[] choicePlayers, Effect preventionCost) {
this(action, effectToExecute, Arrays.asList(choicePlayers), preventionCost);
}
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, String choicePlayer, Effect preventionCost) {
this(action, effectToExecute, Collections.singletonList(choicePlayer), preventionCost);
}
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, List<String> choicePlayers, Effect preventionCost) {
_action = action;
_effectToExecute = effectToExecute;

View File

@@ -0,0 +1,57 @@
package com.gempukku.lotro.cards.set4.gondor;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.CancelSkirmishEffect;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.PreventableEffect;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Race;
import com.gempukku.lotro.filters.Filter;
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.actions.ActivateCardAction;
import com.gempukku.lotro.logic.timing.Action;
import java.util.List;
/**
* Set: The Two Towers
* Side: Free
* Culture: Gondor
* Twilight Cost: 1
* Type: Possession • Gauntlets
* Game Text: Bearer must be a [GONDOR] Man. Skirmish: Exert bearer to cancel a skirmish involving bearer. Any Shadow
* player may remove (1) to prevent this.
*/
public class Card4_112 extends AbstractAttachableFPPossession {
public Card4_112() {
super(1, 0, 0, Culture.GONDOR, Keyword.GAUNTLETS, "Boromir's Gauntlets", true);
}
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Filters.culture(Culture.GONDOR), Filters.race(Race.MAN));
}
@Override
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self.getAttachedTo())) {
ActivateCardAction action = new ActivateCardAction(self, Keyword.SKIRMISH);
action.appendCost(
new ExertCharactersEffect(self, self.getAttachedTo()));
action.appendEffect(
new PreventableEffect(action,
new CancelSkirmishEffect(Filters.hasAttached(self)),
GameUtils.getOpponents(game, playerId),
new RemoveTwilightEffect(1)));
}
return null;
}
}

View File

@@ -19,7 +19,7 @@ public enum Keyword {
HAND_WEAPON("Hand Weapon"), ARMOR("Armor"), HELM("Helm"), MOUNT("Mount"), RANGED_WEAPON("Ranged Weapon"),
CLOAK("Cloak"), PIPE("Pipe"), PIPEWEED("Pipeweed"), SHIELD("Shield"), BRACERS("Bracers"), STAFF("Staff"), RING("Ring"),
BROOCH("Brooch");
BROOCH("Brooch"), GAUNTLETS("Gauntlets");
private String _humanReadable;
private boolean _infoDisplayable;