- Permanents will no longer highlight in had if they have Response action on them
- Fixed all the cards that were supposed to discard themselves on use, but did not (i.e. "Gondor Bowmen")
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package com.gempukku.lotro.cards;
|
||||
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Token;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprint;
|
||||
@@ -113,11 +110,11 @@ public class PlayConditions {
|
||||
return canExert(source, game.getGameState(), game.getModifiersQuerying(), times, filters);
|
||||
}
|
||||
|
||||
public static boolean canSpot(LotroGame game, Filter... filters) {
|
||||
public static boolean canSpot(LotroGame game, Filterable... filters) {
|
||||
return canSpot(game, 1, filters);
|
||||
}
|
||||
|
||||
public static boolean canSpot(LotroGame game, int count, Filter... filters) {
|
||||
public static boolean canSpot(LotroGame game, int count, Filterable... filters) {
|
||||
return Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), filters) >= count;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Card2_003 extends AbstractAttachableFPPossession {
|
||||
&& ((WoundCharactersEffect) effect).getAffectedCardsMinusPrevented(game).contains(self.getAttachedTo())) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendEffect(
|
||||
new PreventCardEffect((WoundCharactersEffect) effect, self.getAttachedTo()));
|
||||
return Collections.singletonList(action);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Card2_004 extends AbstractAttachable {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 1), Phase.SKIRMISH));
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Card2_010 extends AbstractAttachableFPPossession {
|
||||
if (PlayConditions.canPlayCardDuringPhase(game, Phase.ARCHERY, self)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new ArcheryTotalModifier(self, Side.FREE_PEOPLE, 1), Phase.ARCHERY));
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Card2_089 extends AbstractMinion {
|
||||
possibleCosts.add(
|
||||
new ExertCharactersEffect(self, self));
|
||||
possibleCosts.add(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendCost(
|
||||
new ChoiceEffect(action, playerId, possibleCosts));
|
||||
action.appendEffect(
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Card2_097 extends AbstractAttachable {
|
||||
possibleCosts.add(
|
||||
new ExertCharactersEffect(self, self.getAttachedTo()));
|
||||
possibleCosts.add(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendCost(
|
||||
new ChoiceEffect(action, playerId, possibleCosts));
|
||||
action.appendEffect(
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Card2_106 extends AbstractPermanent {
|
||||
if (Filters.filter(woundedCharacters, game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.HOBBIT)).size() > 0) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose Hobbit", Filters.in(woundedCharacters), Filters.race(Race.HOBBIT)) {
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Card2_108 extends AbstractAttachable {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Card3_005 extends AbstractPermanent {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 0, 2, Filters.culture(Culture.MORIA), Filters.type(CardType.CONDITION)));
|
||||
return Collections.singletonList(action);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Card3_041 extends AbstractPermanent {
|
||||
action.appendCost(
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.culture(Culture.GONDOR), Filters.type(CardType.COMPANION)));
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self));
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new ArcheryTotalModifier(self, Side.FREE_PEOPLE, 2), Phase.ARCHERY));
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Card4_279 extends AbstractEvent {
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
|
||||
&& PlayConditions.canSpot(game, 2, Filters.mounted, Filters.culture(Culture.ROHAN), Filters.race(Race.MAN));
|
||||
&& PlayConditions.canSpot(game, 2, Filters.mounted, Culture.ROHAN, Race.MAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Culture {
|
||||
public enum Culture implements Filterable {
|
||||
DWARVEN, ELVEN, GANDALF, GOLLUM, GONDOR, ROHAN, SHIRE,
|
||||
DUNLAND, ISENGARD, MEN, MORIA, ORC, RAIDER, SAURON, WRAITH
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Duration {
|
||||
END_OF_TURN, END_OF_PHASE
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public interface Filterable {
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Keyword {
|
||||
public enum Keyword implements Filterable {
|
||||
SUPPORT_AREA("Support Area"),
|
||||
|
||||
SKIRMISH("Skirmish"), FELLOWSHIP("Fellowship"), RESPONSE("Response"), MANEUVER("Maneuver"), ARCHERY("Archery"), SHADOW("Shadow"), ASSIGNMENT("Assignment"), REGROUP("Regroup"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum PossessionClass {
|
||||
public enum PossessionClass implements Filterable {
|
||||
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"), GAUNTLETS("Gauntlets");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Race {
|
||||
public enum Race implements Filterable {
|
||||
BALROG("Balrog"), CREATURE("Creature"),
|
||||
ELF("Elf"), HOBBIT("Hobbit"), DWARF("Dwarf"), MAN("Man"), WIZARD("Wizard"),
|
||||
URUK_HAI("Uruk-Hai"), NAZGUL("Nazgul"), ORC("Orc"), TROLL("Troll"), ENT("Ent");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Side {
|
||||
public enum Side implements Filterable {
|
||||
FREE_PEOPLE, SHADOW, RING, SITE
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Signet {
|
||||
public enum Signet implements Filterable {
|
||||
ARAGORN, FRODO, GANDALF, THÉODEN
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Zone {
|
||||
public enum Zone implements Filterable {
|
||||
FREE_CHARACTERS("play", true), SUPPORT("play", true), SHADOW_CHARACTERS("play", true),
|
||||
ADVENTURE_PATH("play", true),
|
||||
HAND("hand", false), DECK("deck", false), ATTACHED("play", true), STACKED("stacked", false),
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.gempukku.lotro.filters;
|
||||
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
|
||||
public interface Filter {
|
||||
public interface Filter extends Filterable {
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard);
|
||||
}
|
||||
|
||||
@@ -13,28 +13,28 @@ import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import java.util.*;
|
||||
|
||||
public class Filters {
|
||||
public static boolean canSpot(GameState gameState, ModifiersQuerying modifiersQuerying, Filter... filters) {
|
||||
public static boolean canSpot(GameState gameState, ModifiersQuerying modifiersQuerying, Filterable... filters) {
|
||||
Filter filter = Filters.and(filters);
|
||||
SpotFilterCardInPlayVisitor visitor = new SpotFilterCardInPlayVisitor(gameState, modifiersQuerying, filter);
|
||||
gameState.iterateActiveCards(visitor);
|
||||
return visitor.isSpotted();
|
||||
}
|
||||
|
||||
public static int countSpottable(GameState gameState, ModifiersQuerying modifiersQuerying, Filter... filters) {
|
||||
public static int countSpottable(GameState gameState, ModifiersQuerying modifiersQuerying, Filterable... filters) {
|
||||
Filter filter = Filters.and(filters);
|
||||
GetCardsMatchingFilterVisitor visitor = new GetCardsMatchingFilterVisitor(gameState, modifiersQuerying, filter);
|
||||
gameState.iterateActiveCards(visitor);
|
||||
return modifiersQuerying.getSpotCount(gameState, filter, visitor.getCounter());
|
||||
}
|
||||
|
||||
public static Collection<PhysicalCard> filterActive(GameState gameState, ModifiersQuerying modifiersQuerying, Filter... filters) {
|
||||
public static Collection<PhysicalCard> filterActive(GameState gameState, ModifiersQuerying modifiersQuerying, Filterable... filters) {
|
||||
Filter filter = Filters.and(filters);
|
||||
GetCardsMatchingFilterVisitor getCardsMatchingFilter = new GetCardsMatchingFilterVisitor(gameState, modifiersQuerying, filter);
|
||||
gameState.iterateActiveCards(getCardsMatchingFilter);
|
||||
return getCardsMatchingFilter.getPhysicalCards();
|
||||
}
|
||||
|
||||
public static Collection<PhysicalCard> filter(Collection<? extends PhysicalCard> cards, GameState gameState, ModifiersQuerying modifiersQuerying, Filter... filters) {
|
||||
public static Collection<PhysicalCard> filter(Collection<? extends PhysicalCard> cards, GameState gameState, ModifiersQuerying modifiersQuerying, Filterable... filters) {
|
||||
Filter filter = Filters.and(filters);
|
||||
List<PhysicalCard> result = new LinkedList<PhysicalCard>();
|
||||
for (PhysicalCard card : cards)
|
||||
@@ -432,7 +432,42 @@ public class Filters {
|
||||
};
|
||||
}
|
||||
|
||||
public static Filter and(final Filter... filters) {
|
||||
public static Filter and(final Filterable... filters) {
|
||||
Filter[] filtersInt = new Filter[filters.length];
|
||||
for (int i = 0; i < filtersInt.length; i++)
|
||||
filtersInt[i] = changeToFilter(filters[i]);
|
||||
return andInternal(filtersInt);
|
||||
}
|
||||
|
||||
public static Filter or(final Filterable... filters) {
|
||||
Filter[] filtersInt = new Filter[filters.length];
|
||||
for (int i = 0; i < filtersInt.length; i++)
|
||||
filtersInt[i] = changeToFilter(filters[i]);
|
||||
return orInternal(filtersInt);
|
||||
}
|
||||
|
||||
private static Filter changeToFilter(Filterable filter) {
|
||||
if (filter instanceof Filter)
|
||||
return (Filter) filter;
|
||||
else if (filter instanceof Culture)
|
||||
return Filters.culture((Culture) filter);
|
||||
else if (filter instanceof Keyword)
|
||||
return Filters.keyword((Keyword) filter);
|
||||
else if (filter instanceof PossessionClass)
|
||||
return Filters.possessionClass((PossessionClass) filter);
|
||||
else if (filter instanceof Race)
|
||||
return Filters.race((Race) filter);
|
||||
else if (filter instanceof Side)
|
||||
return Filters.side((Side) filter);
|
||||
else if (filter instanceof Signet)
|
||||
return Filters.signet((Signet) filter);
|
||||
else if (filter instanceof Zone)
|
||||
return Filters.zone((Zone) filter);
|
||||
else
|
||||
throw new IllegalArgumentException("Unknown type of filterable: " + filter);
|
||||
}
|
||||
|
||||
private static Filter andInternal(final Filter... filters) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
@@ -462,7 +497,7 @@ public class Filters {
|
||||
};
|
||||
}
|
||||
|
||||
public static Filter or(final Filter... filters) {
|
||||
private static Filter orInternal(final Filter... filters) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<pre style="font-size:80%">
|
||||
<b>15 Oct. 2011</b>
|
||||
- Permanents will no longer highlight in had if they have Response action on them
|
||||
- Fixed all the cards that were supposed to discard themselves on use, but did not (i.e. "Gondor Bowmen")
|
||||
|
||||
<b>14 Oct. 2011</b>
|
||||
- Uruviel and all other copying site allies should now correctly have modifiers off sites
|
||||
- Ulaire Nertea now actually allows to play minions from discard
|
||||
|
||||
Reference in New Issue
Block a user