Removing abuse of "canSpot".

This commit is contained in:
marcins78@gmail.com
2013-01-10 19:51:16 +00:00
parent 2611ccfc35
commit 475096b761
3 changed files with 7 additions and 7 deletions

View File

@@ -83,7 +83,7 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, Filter additionalAttachmentFilter, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, false, false)
&& (skipUniquenessCheck() || PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self, false))
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), getFullAttachValidTargetFilter(playerId, game, self), additionalAttachmentFilter);
&& Filters.countActive(game.getGameState(), game.getModifiersQuerying(), getFullAttachValidTargetFilter(playerId, game, self), additionalAttachmentFilter)>0;
}
@Override

View File

@@ -37,7 +37,7 @@ public abstract class AbstractAttachableFPPossession extends AbstractAttachable
private void appendTransferPossessionAction(List<Action> actions, LotroGame game, final PhysicalCard self, Filter validTargetFilter) {
GameState gameState = game.getGameState();
if (Filters.canSpot(gameState, game.getModifiersQuerying(), validTargetFilter)
if (Filters.countActive(gameState, game.getModifiersQuerying(), validTargetFilter)>0
&& gameState.getCurrentPhase() == Phase.FELLOWSHIP
&& self.getZone() == Zone.ATTACHED) {
@@ -69,7 +69,7 @@ public abstract class AbstractAttachableFPPossession extends AbstractAttachable
}
});
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), validTransferFilter))
if (Filters.countActive(game.getGameState(), game.getModifiersQuerying(), validTransferFilter)>0)
actions.add(new TransferPermanentAction(self, validTransferFilter));
}
}

View File

@@ -39,11 +39,11 @@ public class PlayConditions {
}
public static boolean canLiberateASite(LotroGame game) {
return PlayConditions.canSpot(game, Filters.siteControlledByShadowPlayer(game.getGameState().getCurrentPlayerId()));
return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.siteControlledByShadowPlayer(game.getGameState().getCurrentPlayerId())) > 0;
}
public static boolean canLiberateASite(LotroGame game, String playerId) {
return PlayConditions.canSpot(game, Filters.siteControlled(playerId));
return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.siteControlled(playerId)) > 0;
}
public static boolean canDiscardFromHand(LotroGame game, String playerId, int count, Filterable... cardFilter) {
@@ -69,13 +69,13 @@ public class PlayConditions {
public static boolean canPlayCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) {
return (phase == null || game.getGameState().getCurrentPhase() == phase)
&& self.getZone() == Zone.HAND
&& (!self.getBlueprint().isUnique() || !Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName())));
&& (!self.getBlueprint().isUnique() || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()))==0);
}
public static boolean canPlayCardDuringPhase(LotroGame game, Phase[] phases, PhysicalCard self) {
return (phases == null || containsPhase(phases, game.getGameState().getCurrentPhase()))
&& self.getZone() == Zone.HAND
&& (!self.getBlueprint().isUnique() || !Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName())));
&& (!self.getBlueprint().isUnique() || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()))==0);
}
public static boolean canUseFPCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) {