"Strength in Numbers"

This commit is contained in:
marcins78@gmail.com
2011-10-18 22:06:39 +00:00
parent dd506b7447
commit cea142c6b2
3 changed files with 103 additions and 0 deletions

View File

@@ -160,6 +160,10 @@ public class PlayConditions {
return game.getModifiersQuerying().canBeDiscardedFromPlay(game.getGameState(), card, source);
}
public static boolean canSelfDiscard(PhysicalCard source, LotroGame game) {
return canBeDiscarded(source, game, source);
}
public static boolean canBeDiscarded(final PhysicalCard source, LotroGame game, final Filterable... filters) {
return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.and(filters,
new Filter() {

View File

@@ -0,0 +1,43 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.cards.decisions.ForEachYouSpotDecision;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
public abstract class ForEachYouSpotEffect extends AbstractSuccessfulEffect {
private String _playerId;
private Filterable[] _filters;
public ForEachYouSpotEffect(String playerId, Filterable... filters) {
_playerId = playerId;
_filters = filters;
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public EffectResult.Type getType() {
return null;
}
@Override
public EffectResult[] playEffect(LotroGame game) {
game.getUserFeedback().sendAwaitingDecision(_playerId,
new ForEachYouSpotDecision(1, "Choose how many you wish to spot", game, Filters.and(_filters), Integer.MAX_VALUE) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
spottedCards(getValidatedResult(result));
}
});
return null;
}
protected abstract void spottedCards(int spotCount);
}

View File

@@ -0,0 +1,56 @@
package com.gempukku.lotro.cards.set5.raider;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ForEachYouSpotEffect;
import com.gempukku.lotro.common.*;
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.AddTwilightEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: Battle of Helm's Deep
* Side: Shadow
* Culture: Raider
* Twilight Cost: 0
* Type: Condition
* Game Text: To play, spot a Southron. Plays to your support area. Maneuver: Discard this condition to add (1) for
* each Man with ambush you spot.
*/
public class Card5_077 extends AbstractPermanent {
public Card5_077() {
super(Side.SHADOW, 0, CardType.CONDITION, Culture.RAIDER, Zone.SUPPORT, "Strength in Numbers");
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& PlayConditions.canSpot(game, Keyword.SOUTHRON);
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.MANEUVER, self, 0)
&& PlayConditions.canSelfDiscard(self, game)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(
new ForEachYouSpotEffect(playerId, Keyword.AMBUSH) {
@Override
protected void spottedCards(int spotCount) {
action.insertEffect(
new AddTwilightEffect(self, spotCount));
}
});
return Collections.singletonList(action);
}
return null;
}
}