Simplifying Side and Zone filtering.

This commit is contained in:
marcins78@gmail.com
2011-11-17 12:55:38 +00:00
parent b676156116
commit 331f738511
53 changed files with 83 additions and 72 deletions

View File

@@ -1,7 +1,7 @@
package com.gempukku.lotro.cards.effects.choose;
import com.gempukku.lotro.cards.effects.StackCardFromHandEffect;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -21,9 +21,9 @@ public class ChooseAndStackCardsFromHandEffect extends AbstractEffect {
private int _minimum;
private int _maximum;
private PhysicalCard _stackOn;
private Filter _filter;
private Filterable _filter;
public ChooseAndStackCardsFromHandEffect(Action action, String playerId, int minimum, int maximum, PhysicalCard stackOn, Filter filter) {
public ChooseAndStackCardsFromHandEffect(Action action, String playerId, int minimum, int maximum, PhysicalCard stackOn, Filterable filter) {
_action = action;
_playerId = playerId;
_minimum = minimum;

View File

@@ -1,6 +1,6 @@
package com.gempukku.lotro.cards.effects.choose;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -20,10 +20,10 @@ public abstract class ChooseStackedCardsEffect extends AbstractEffect {
private String _playerId;
private int _minimum;
private int _maximum;
private Filter _stackedOnFilter;
private Filter _stackedCardFilter;
private Filterable _stackedOnFilter;
private Filterable _stackedCardFilter;
public ChooseStackedCardsEffect(Action action, String playerId, int minimum, int maximum, Filter stackedOnFilter, Filter stackedCardFilter) {
public ChooseStackedCardsEffect(Action action, String playerId, int minimum, int maximum, Filterable stackedOnFilter, Filterable stackedCardFilter) {
_action = action;
_playerId = playerId;
_minimum = minimum;

View File

@@ -64,7 +64,7 @@ public class Card1_018 extends AbstractOldEvent {
@Override
protected void cardsRevealed(final List<PhysicalCard> topDeckCards) {
if (topDeckCards.size() > 0) {
Collection<PhysicalCard> shadowCards = Filters.filter(topDeckCards, game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.SHADOW));
Collection<PhysicalCard> shadowCards = Filters.filter(topDeckCards, game.getGameState(), game.getModifiersQuerying(), Side.SHADOW);
if (shadowCards.size() > 0) {
action.appendEffect(

View File

@@ -38,7 +38,7 @@ public class Card1_073 extends AbstractPermanent {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& (
Filters.filter(game.getGameState().getStackedCards(self), game.getGameState(), game.getModifiersQuerying(), Filters.playable(game)).size() > 0
|| Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.FREE_PEOPLE), Filters.or(CardType.ARTIFACT, CardType.POSSESSION)).size() > 0)) {
|| Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Side.FREE_PEOPLE, Filters.or(CardType.ARTIFACT, CardType.POSSESSION)).size() > 0)) {
final ActivateCardAction action = new ActivateCardAction(self);
List<Effect> possibleChoices = new LinkedList<Effect>();

View File

@@ -55,7 +55,7 @@ public class Card1_094 extends AbstractAttachableFPPossession {
});
possibleEffects.add(
new ChooseActiveCardEffect(self, playerId, "Choose Shadow condition attached to companion", Filters.side(Side.SHADOW), CardType.CONDITION, Filters.attachedTo(CardType.COMPANION)) {
new ChooseActiveCardEffect(self, playerId, "Choose Shadow condition attached to companion", Side.SHADOW, CardType.CONDITION, Filters.attachedTo(CardType.COMPANION)) {
@Override
public String getText(LotroGame game) {
return "Discard Shadow condition attached to a companion";

View File

@@ -36,7 +36,7 @@ public class Card1_193 extends AbstractPermanent {
if (effectResult.getType() == EffectResult.Type.DISCARD_FROM_PLAY) {
DiscardCardsFromPlayResult discardResult = (DiscardCardsFromPlayResult) effectResult;
Collection<PhysicalCard> discardedCards = discardResult.getDiscardedCards();
if (Filters.filter(discardedCards, game.getGameState(), game.getModifiersQuerying(), Filters.zone(Zone.DISCARD), Culture.MORIA, Filters.weapon, Filters.playable(game, -1)).size() > 0) {
if (Filters.filter(discardedCards, game.getGameState(), game.getModifiersQuerying(), Zone.DISCARD, Culture.MORIA, Filters.weapon, Filters.playable(game, -1)).size() > 0) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(
new ChooseAndPlayCardFromDiscardEffect(playerId,

View File

@@ -5,7 +5,6 @@ import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
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.effects.ChooseActiveCardEffect;
@@ -36,7 +35,7 @@ public class Card1_277 extends AbstractOldEvent {
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Culture.SAURON, Race.ORC));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a Free Peoples condition", Filters.side(Side.FREE_PEOPLE), CardType.CONDITION) {
new ChooseActiveCardEffect(self, playerId, "Choose a Free Peoples condition", Side.FREE_PEOPLE, CardType.CONDITION) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard fpCondition) {
action.appendEffect(

View File

@@ -37,7 +37,7 @@ public class Card1_345 extends AbstractSite {
action.appendEffect(
new ChooseAndPlayCardFromDiscardEffect(playerId, game.getGameState().getDiscard(playerId),
Filters.and(
Filters.side(Side.SHADOW),
Side.SHADOW,
Filters.or(
PossessionClass.HAND_WEAPON,
PossessionClass.RANGED_WEAPON)

View File

@@ -36,10 +36,10 @@ public class Card1_205 extends AbstractOldEvent {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.NAZGUL));
boolean firstEffect = Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.FREE_PEOPLE), Filters.or(CardType.POSSESSION, CardType.CONDITION));
boolean firstEffect = Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Side.FREE_PEOPLE, Filters.or(CardType.POSSESSION, CardType.CONDITION));
if (firstEffect) {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a Free Peoples possession or condition", Filters.side(Side.FREE_PEOPLE), Filters.or(CardType.POSSESSION, CardType.CONDITION)) {
new ChooseActiveCardEffect(self, playerId, "Choose a Free Peoples possession or condition", Side.FREE_PEOPLE, Filters.or(CardType.POSSESSION, CardType.CONDITION)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard fpCard) {
action.appendEffect(

View File

@@ -59,7 +59,7 @@ public class Card1_216 extends AbstractAttachable {
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
final PhysicalCard bladeTipInSupport = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.name("Blade Tip"), Filters.owner(playerId), Filters.zone(Zone.SUPPORT));
final PhysicalCard bladeTipInSupport = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.name("Blade Tip"), Filters.owner(playerId), Zone.SUPPORT);
final Collection<PhysicalCard> bladeTipsInDiscard = Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.name("Blade Tip"));
List<Effect> possibleEffects = new LinkedList<Effect>();

View File

@@ -58,7 +58,7 @@ public class Card1_221 extends AbstractAttachable {
action.appendCost(
new ExertCharactersEffect(self, self.getAttachedTo()));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a Free Peoples condition", Filters.side(Side.FREE_PEOPLE), CardType.CONDITION) {
new ChooseActiveCardEffect(self, playerId, "Choose a Free Peoples condition", Side.FREE_PEOPLE, CardType.CONDITION) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard condition) {
action.appendEffect(

View File

@@ -47,7 +47,7 @@ public class Card2_011 extends AbstractPermanent {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose condition",
Filters.or(
Filters.and(Filters.side(Side.SHADOW), CardType.CONDITION, Filters.attachedTo(Race.DWARF)),
Filters.and(Side.SHADOW, CardType.CONDITION, Filters.attachedTo(Race.DWARF)),
Filters.and(Filters.keyword(Keyword.WEATHER)), CardType.CONDITION)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {

View File

@@ -53,7 +53,7 @@ public class Card2_015 extends AbstractOldEvent {
action.insertEffect(new DrawCardEffect(opponentId, 2));
List<Effect> possibleEffects = new LinkedList<Effect>();
possibleEffects.add(
new ChooseAndDiscardCardsFromHandEffect(action, opponentId, false, 2, 2, Filters.side(Side.SHADOW)) {
new ChooseAndDiscardCardsFromHandEffect(action, opponentId, false, 2, 2, Side.SHADOW) {
@Override
public String getText(LotroGame game) {
return "Discard 2 Shadow cards";

View File

@@ -46,7 +46,7 @@ public class Card2_039 extends AbstractOldEvent {
action.appendEffect(
new DiscardCardsFromPlayEffect(self,
Filters.and(
Filters.side(Side.FREE_PEOPLE),
Side.FREE_PEOPLE,
CardType.POSSESSION,
Filters.or(
PossessionClass.ARMOR,

View File

@@ -41,6 +41,6 @@ public class Card2_071 extends AbstractAttachable {
@Override
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
return Collections.singletonList(new CantExertWithCardModifier(self, Filters.hasAttached(self), Filters.not(Filters.side(Side.SHADOW))));
return Collections.singletonList(new CantExertWithCardModifier(self, Filters.hasAttached(self), Filters.not(Side.SHADOW)));
}
}

View File

@@ -41,7 +41,7 @@ public class Card2_096 extends AbstractAlly {
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.keyword(Keyword.TALE)));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.side(Side.SHADOW), CardType.CONDITION, Filters.zone(Zone.SUPPORT)));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.SHADOW, CardType.CONDITION, Zone.SUPPORT));
return Collections.singletonList(action);
}
return null;

View File

@@ -7,7 +7,6 @@ import com.gempukku.lotro.cards.effects.PutCardFromDiscardOnBottomOfDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseCardsFromDiscardEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -48,7 +47,7 @@ public class Card2_098 extends AbstractOldEvent {
Signet signet = character.getBlueprint().getSignet();
int count = (signet == Signet.FRODO) ? 2 : 1;
action.appendEffect(
new ChooseCardsFromDiscardEffect(playerId, count, count, Filters.side(Side.FREE_PEOPLE)) {
new ChooseCardsFromDiscardEffect(playerId, count, count, Side.FREE_PEOPLE) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
for (PhysicalCard card : cards) {

View File

@@ -39,14 +39,14 @@ public class Card3_027 extends AbstractAttachableFPPossession {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.MANEUVER, self)
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), 2, Filters.hasAttached(self))
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.SHADOW), CardType.CONDITION)) {
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Side.SHADOW, CardType.CONDITION)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ExertCharactersEffect(self, self.getAttachedTo()));
action.appendCost(
new ExertCharactersEffect(self, self.getAttachedTo()));
action.appendEffect(
new ChooseAndReturnCardsToHandEffect(action, playerId, 1, 1, Filters.side(Side.SHADOW), CardType.CONDITION));
new ChooseAndReturnCardsToHandEffect(action, playerId, 1, 1, Side.SHADOW, CardType.CONDITION));
return Collections.singletonList(action);
}
return null;

View File

@@ -40,7 +40,7 @@ public class Card3_030 extends AbstractOldEvent {
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new DiscardCardsFromPlayEffect(self, Filters.and(Filters.side(Side.SHADOW), CardType.CONDITION)));
new DiscardCardsFromPlayEffect(self, Filters.and(Side.SHADOW, CardType.CONDITION)));
return action;
}
}

View File

@@ -42,7 +42,7 @@ public class Card3_060 extends AbstractMinion {
int characterSpot = Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), CardType.COMPANION);
if (characterSpot >= 5) {
action.appendEffect(
new DiscardCardsFromPlayEffect(self, Filters.and(Filters.side(Side.FREE_PEOPLE), CardType.POSSESSION)));
new DiscardCardsFromPlayEffect(self, Filters.and(Side.FREE_PEOPLE, CardType.POSSESSION)));
} else {
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.weapon));

View File

@@ -67,7 +67,7 @@ public class Card3_080 extends AbstractOldEvent {
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Filters.side(Side.FREE_PEOPLE), CardType.POSSESSION) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Side.FREE_PEOPLE, CardType.POSSESSION) {
@Override
public String getText(LotroGame game) {
return "Discard 2 Free People possessions";

View File

@@ -41,7 +41,7 @@ public class Card3_095 extends AbstractMinion {
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.owner(playerId), Culture.SAURON, CardType.CONDITION));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.side(Side.FREE_PEOPLE), CardType.CONDITION));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.FREE_PEOPLE, CardType.CONDITION));
return Collections.singletonList(action);
}
return null;

View File

@@ -55,7 +55,7 @@ public class Card3_105 extends AbstractOldEvent {
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Filters.side(Side.FREE_PEOPLE), CardType.CONDITION);
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Side.FREE_PEOPLE, CardType.CONDITION);
}
}
));

View File

@@ -41,7 +41,7 @@ public class Card3_111 extends AbstractAlly {
if (source != null && source.getBlueprint().getSide() == Side.SHADOW) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.or(CardType.MINION, Filters.and(Filters.side(Side.SHADOW), CardType.CONDITION))));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.or(CardType.MINION, Filters.and(Side.SHADOW, CardType.CONDITION))));
actions.add(action);
}
}

View File

@@ -44,7 +44,7 @@ public class Card3_086 extends AbstractMinion {
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose Blade Tip", Filters.name("Blade Tip"), Filters.zone(Zone.SUPPORT), Filters.owner(playerId)) {
new ChooseActiveCardEffect(self, playerId, "Choose Blade Tip", Filters.name("Blade Tip"), Zone.SUPPORT, Filters.owner(playerId)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.insertEffect(

View File

@@ -39,7 +39,7 @@ public class Card4_013 extends AbstractMinion {
OptionalTriggerAction action = new OptionalTriggerAction(self);
int max = (Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), CardType.COMPANION) >= 6) ? 2 : 1;
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, max, Filters.side(Side.FREE_PEOPLE), CardType.POSSESSION));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, max, Side.FREE_PEOPLE, CardType.POSSESSION));
return Collections.singletonList(action);
}
return null;

View File

@@ -45,7 +45,7 @@ public class Card4_032 extends AbstractResponseOldEvent {
final List<PhysicalCard> losers = skirmishResult.getLosers();
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new DiscardCardsFromPlayEffect(self, Filters.and(Filters.attachedTo(Filters.in(losers)), Filters.side(Side.FREE_PEOPLE))));
new DiscardCardsFromPlayEffect(self, Filters.and(Filters.attachedTo(Filters.in(losers)), Side.FREE_PEOPLE)));
return Collections.singletonList(action);
}
return null;

View File

@@ -49,7 +49,7 @@ public class Card4_034 extends AbstractPermanent {
ActivateCardAction action = new ActivateCardAction(self);
int possesions = Math.min(3, game.getGameState().getTokenCount(self, Token.DUNLAND));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, possesions, possesions, CardType.POSSESSION, Filters.side(Side.FREE_PEOPLE)));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, possesions, possesions, CardType.POSSESSION, Side.FREE_PEOPLE));
action.appendEffect(
new DiscardCardsFromPlayEffect(self, self));
return Collections.singletonList(action);

View File

@@ -47,7 +47,7 @@ public class Card4_036 extends AbstractAttachable {
if (PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.hasAttached(self))) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 2, 2, CardType.POSSESSION, Filters.side(Side.FREE_PEOPLE)));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 2, 2, CardType.POSSESSION, Side.FREE_PEOPLE));
return Collections.singletonList(action);
}
return null;

View File

@@ -31,7 +31,7 @@ public class Card4_039 extends AbstractOldEvent {
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.side(Side.FREE_PEOPLE), Filters.or(CardType.POSSESSION, CardType.CONDITION)));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.FREE_PEOPLE, Filters.or(CardType.POSSESSION, CardType.CONDITION)));
return action;
}

View File

@@ -55,10 +55,10 @@ public class Card4_044 extends AbstractPermanent {
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& Filters.filter(game.getGameState().getAttachedCards(self), game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.FREE_PEOPLE)).size() > 0) {
&& Filters.filter(game.getGameState().getAttachedCards(self), game.getGameState(), game.getModifiersQuerying(), Side.FREE_PEOPLE).size() > 0) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardStackedCardsEffect(action, playerId, 1, 1, Filters.sameCard(self), Filters.side(Side.FREE_PEOPLE)));
new ChooseAndDiscardStackedCardsEffect(action, playerId, 1, 1, Filters.sameCard(self), Side.FREE_PEOPLE));
action.appendEffect(
new ChooseAndHealCharactersEffect(action, playerId, 1, 1, Race.DWARF));
return Collections.singletonList(action);

View File

@@ -34,7 +34,7 @@ public class Card4_045 extends AbstractOldEvent {
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseStackedCardsEffect(action, playerId, 1, 1, Filters.and(Culture.DWARVEN, CardType.CONDITION), Filters.side(Side.FREE_PEOPLE)) {
new ChooseStackedCardsEffect(action, playerId, 1, 1, Filters.and(Culture.DWARVEN, CardType.CONDITION), Side.FREE_PEOPLE) {
@Override
protected void cardsChosen(Collection<PhysicalCard> stackedCards) {
for (PhysicalCard card : stackedCards)

View File

@@ -56,7 +56,7 @@ public class Card4_046 extends AbstractPermanent {
action.appendCost(
new DiscardTopCardFromDeckEffect(self, playerId, false));
action.appendEffect(
new ChooseStackedCardsEffect(action, playerId, 1, 1, Filters.sameCard(self), Filters.side(Side.FREE_PEOPLE)) {
new ChooseStackedCardsEffect(action, playerId, 1, 1, Filters.sameCard(self), Side.FREE_PEOPLE) {
@Override
protected void cardsChosen(Collection<PhysicalCard> stackedCards) {
for (PhysicalCard stackedCard : stackedCards) {

View File

@@ -37,14 +37,14 @@ public class Card4_047 extends AbstractPermanent {
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Race.DWARF)
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.FREE_PEOPLE)).size() > 0) {
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Side.FREE_PEOPLE).size() > 0) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.DWARF) {
@Override
protected void forEachCardExertedCallback(PhysicalCard character) {
action.appendCost(
new ChooseCardsFromHandEffect(playerId, 1, 1, Filters.side(Side.FREE_PEOPLE)) {
new ChooseCardsFromHandEffect(playerId, 1, 1, Side.FREE_PEOPLE) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
SubAction subAction = new SubAction(action);

View File

@@ -34,10 +34,10 @@ public class Card4_050 extends AbstractPermanent {
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.FREE_PEOPLE)).size() > 0) {
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Side.FREE_PEOPLE).size() > 0) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndStackCardsFromHandEffect(action, playerId, 1, 1, self, Filters.side(Side.FREE_PEOPLE)));
new ChooseAndStackCardsFromHandEffect(action, playerId, 1, 1, self, Side.FREE_PEOPLE));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a Dwarf", Race.DWARF) {
@Override

View File

@@ -36,7 +36,7 @@ public class Card4_073 extends AbstractCompanion {
return Collections.singletonList(
new TwilightCostModifier(self,
Filters.and(
Filters.side(Side.SHADOW),
Side.SHADOW,
Filters.or(
CardType.EVENT,
CardType.CONDITION

View File

@@ -54,7 +54,7 @@ public class Card4_094 extends AbstractAttachable {
modifiers.add(
new VitalityModifier(self, Filters.hasAttached(self), 1));
modifiers.add(
new MayNotBePlayedOnModifier(self, Filters.hasAttached(self), Filters.and(Filters.side(Side.SHADOW), CardType.CONDITION)));
new MayNotBePlayedOnModifier(self, Filters.hasAttached(self), Filters.and(Side.SHADOW, CardType.CONDITION)));
return modifiers;
}
@@ -69,7 +69,7 @@ public class Card4_094 extends AbstractAttachable {
if (PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.sameCard(self))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new DiscardCardsFromPlayEffect(self, Filters.and(Filters.side(Side.SHADOW), CardType.CONDITION, Filters.attachedTo(Filters.hasAttached(self)))));
new DiscardCardsFromPlayEffect(self, Filters.and(Side.SHADOW, CardType.CONDITION, Filters.attachedTo(Filters.hasAttached(self)))));
return Collections.singletonList(action);
}
return null;

View File

@@ -34,7 +34,7 @@ public class Card4_099 extends AbstractOldEvent {
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.side(Side.SHADOW), Filters.or(CardType.POSSESSION, CardType.ARTIFACT)));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.SHADOW, Filters.or(CardType.POSSESSION, CardType.ARTIFACT)));
return action;
}

View File

@@ -69,7 +69,7 @@ public class Card4_107 extends AbstractAttachable {
@Override
protected void cardsRevealed(final List<PhysicalCard> cards) {
action.appendEffect(
new ChooseArbitraryCardsEffect(playerId, "Choose shadow card", cards, Filters.side(Side.SHADOW), 1, 1) {
new ChooseArbitraryCardsEffect(playerId, "Choose shadow card", cards, Side.SHADOW, 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
for (PhysicalCard selectedCard : selectedCards) {
@@ -79,7 +79,7 @@ public class Card4_107 extends AbstractAttachable {
}
});
action.appendEffect(
new ChooseArbitraryCardsEffect(playerId, "Choose free people card", cards, Filters.side(Side.FREE_PEOPLE), 1, 1) {
new ChooseArbitraryCardsEffect(playerId, "Choose free people card", cards, Side.FREE_PEOPLE, 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
for (PhysicalCard selectedCard : selectedCards) {

View File

@@ -49,7 +49,7 @@ public class Card4_139 extends AbstractAttachable {
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Filters.side(Side.FREE_PEOPLE), Race.MAN);
return Filters.and(Side.FREE_PEOPLE, Race.MAN);
}
@Override

View File

@@ -37,7 +37,7 @@ public class Card4_144 extends AbstractPermanent {
action.appendCost(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Race.URUK_HAI));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.side(Side.FREE_PEOPLE), CardType.CONDITION));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.FREE_PEOPLE, CardType.CONDITION));
return Collections.singletonList(action);
}
return null;

View File

@@ -35,7 +35,7 @@ public class Card4_153 extends AbstractMinion {
return Collections.singletonList(
new StrengthModifier(self,
Filters.and(
Filters.hasAttached(Filters.and(Filters.side(Side.SHADOW), CardType.CONDITION)),
Filters.hasAttached(Filters.and(Side.SHADOW, CardType.CONDITION)),
Filters.or(
Filters.unboundCompanion,
CardType.ALLY

View File

@@ -62,7 +62,7 @@ public class Card4_154 extends AbstractMinion {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.insertEffect(
new ReturnCardsToHandEffect(self, Filters.and(Filters.attachedTo(Filters.sameCard(card)), Filters.side(Side.FREE_PEOPLE))));
new ReturnCardsToHandEffect(self, Filters.and(Filters.attachedTo(Filters.sameCard(card)), Side.FREE_PEOPLE)));
}
});
return Collections.singletonList(action);

View File

@@ -48,7 +48,7 @@ public class Card4_157 extends AbstractAttachable {
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Filters.side(Side.FREE_PEOPLE), Race.MAN);
return Filters.and(Side.FREE_PEOPLE, Race.MAN);
}
@Override

View File

@@ -43,7 +43,7 @@ public class Card4_162 extends AbstractOldEvent {
action.appendCost(
new RevealCardEffect(self, Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.not(self))));
action.appendCost(
new DiscardCardsFromHandEffect(self, playerId, Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.side(Side.FREE_PEOPLE)), false));
new DiscardCardsFromHandEffect(self, playerId, Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Side.FREE_PEOPLE), false));
action.appendEffect(
new ChooseCardsFromDiscardEffect(playerId, 1, 1, Culture.ISENGARD) {
@Override

View File

@@ -60,7 +60,7 @@ public class Card4_171 extends AbstractAttachable {
@Override
protected void cardsRevealed(final List<PhysicalCard> cards) {
action.appendEffect(
new ChooseArbitraryCardsEffect(self.getOwner(), "Choose shadow card", cards, Filters.side(Side.SHADOW), 1, 1) {
new ChooseArbitraryCardsEffect(self.getOwner(), "Choose shadow card", cards, Side.SHADOW, 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
for (PhysicalCard selectedCard : selectedCards) {
@@ -70,7 +70,7 @@ public class Card4_171 extends AbstractAttachable {
}
});
action.appendEffect(
new ChooseArbitraryCardsEffect(self.getOwner(), "Choose free people card", cards, Filters.side(Side.FREE_PEOPLE), 1, 1) {
new ChooseArbitraryCardsEffect(self.getOwner(), "Choose free people card", cards, Side.FREE_PEOPLE, 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
for (PhysicalCard selectedCard : selectedCards) {

View File

@@ -40,7 +40,7 @@ public class Card4_172 extends AbstractAttachable {
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Filters.side(Side.FREE_PEOPLE), Race.MAN);
return Filters.and(Side.FREE_PEOPLE, Race.MAN);
}
@Override

View File

@@ -49,7 +49,7 @@ public class Card4_196 extends AbstractAttachable {
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.hasAttached(self)));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.side(Side.FREE_PEOPLE), PossessionClass.MOUNT));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.FREE_PEOPLE, PossessionClass.MOUNT));
return Collections.singletonList(action);
}
return null;

View File

@@ -43,7 +43,7 @@ public class Card4_215 extends AbstractAttachable {
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Filters.side(Side.FREE_PEOPLE), Race.MAN);
return Filters.and(Side.FREE_PEOPLE, Race.MAN);
}
@Override

View File

@@ -6,7 +6,6 @@ import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -37,7 +36,7 @@ public class Card4_223 extends AbstractOldEvent {
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Culture.RAIDER, Race.MAN));
int maxDiscard = (game.getGameState().getBurdens() >= 3) ? 2 : 1;
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, maxDiscard, Filters.side(Side.FREE_PEOPLE), CardType.CONDITION));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, maxDiscard, Side.FREE_PEOPLE, CardType.CONDITION));
return action;
}

View File

@@ -48,7 +48,7 @@ public class Card4_276 extends AbstractPermanent {
int tokenCount = game.getGameState().getTokenCount(self, Token.ROHAN);
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, tokenCount, tokenCount, Filters.side(Side.SHADOW), CardType.CONDITION));
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, tokenCount, tokenCount, Side.SHADOW, CardType.CONDITION));
action.appendEffect(
new DiscardCardsFromPlayEffect(self, self));
return Collections.singletonList(action);

View File

@@ -52,7 +52,7 @@ public class Card5_009 extends AbstractPermanent {
action.appendCost(
new ChooseAndDiscardStackedCardsEffect(action, playerId, 1, 1, Filters.and(Culture.DWARVEN, CardType.CONDITION), Filters.any));
action.appendEffect(
new ChooseStackedCardsEffect(action, playerId, 1, 1, Filters.sameCard(self), Filters.side(Side.FREE_PEOPLE)) {
new ChooseStackedCardsEffect(action, playerId, 1, 1, Filters.sameCard(self), Side.FREE_PEOPLE) {
@Override
protected void cardsChosen(Collection<PhysicalCard> stackedCards) {
for (PhysicalCard stackedCard : stackedCards)

View File

@@ -396,7 +396,14 @@ public class Filters {
};
}
public static Filter side(final Side side) {
private static final Map<Side, Filter> _sideFilterMap = new HashMap<Side, Filter>();
static {
for (Side side : Side.values())
_sideFilterMap.put(side, side(side));
}
private static Filter side(final Side side) {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
@@ -494,7 +501,14 @@ public class Filters {
};
}
public static Filter zone(final Zone zone) {
private static final Map<Zone, Filter> _zoneFilterMap = new HashMap<Zone, Filter>();
static {
for (Zone zone : Zone.values())
_zoneFilterMap.put(zone, zone(zone));
}
private static Filter zone(final Zone zone) {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
@@ -640,11 +654,11 @@ public class Filters {
else if (filter instanceof Race)
return _raceFilterMap.get((Race) filter);
else if (filter instanceof Side)
return Filters.side((Side) filter);
return _sideFilterMap.get((Side) filter);
else if (filter instanceof Signet)
return _signetFilterMap.get((Signet) filter);
else if (filter instanceof Zone)
return Filters.zone((Zone) filter);
return _zoneFilterMap.get((Zone) filter);
else
throw new IllegalArgumentException("Unknown type of filterable: " + filter);
}