From 6f464f35965bf160dd33de08f2d6300ff8eebb00 Mon Sep 17 00:00:00 2001 From: marcins78 Date: Fri, 8 Mar 2013 14:43:30 +0000 Subject: [PATCH] - You can't play events outside of their phase now, using other cards like Dammed Gate-Stream. Response events can't be played at all using other cards. --- .../src/main/web/includes/changeLog.html | 4 ++++ .../lotro/cards/AbstractOldEvent.java | 24 +++++++++++++++---- .../gempukku/lotro/cards/PlayConditions.java | 2 +- .../com/gempukku/lotro/filters/Filters.java | 8 +++++-- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/includes/changeLog.html b/gemp-lotr/gemp-lotr-async/src/main/web/includes/changeLog.html index 038fd6d60..f9fbb01d2 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/includes/changeLog.html +++ b/gemp-lotr/gemp-lotr-async/src/main/web/includes/changeLog.html @@ -1,4 +1,8 @@
+8 Mar. 2013
+- You can't play events outside of their phase now, using other cards like Dammed Gate-Stream. Response events can't be
+played at all using other cards.
+
 7 Mar. 2013
 - "Arwen", "Echo of Luthien" now applies its -3 penalty only if the card was actually ELVEN.
 - Actions that have playing a card as an effect (except playing from hand or discard), no longer check if there is
diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractOldEvent.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractOldEvent.java
index 9f2d7b9cd..5634ec93e 100644
--- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractOldEvent.java
+++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractOldEvent.java
@@ -18,9 +18,11 @@ public abstract class AbstractOldEvent extends AbstractLotroCardBlueprint {
 
     public AbstractOldEvent(Side side, Culture culture, String name, Phase playableInPhase, Phase... additionalPlayableInPhases) {
         super(side, CardType.EVENT, culture, name);
-        _playableInPhases = mergeArray(playableInPhase, additionalPlayableInPhases);
-        for (Phase playablePhase : _playableInPhases)
-            processPhase(playablePhase);
+        if (playableInPhase != null) {
+            _playableInPhases = mergeArray(playableInPhase, additionalPlayableInPhases);
+            for (Phase playablePhase : _playableInPhases)
+                processPhase(playablePhase);
+        }
     }
 
     private static final Phase[] mergeArray(Phase playableInPhase, Phase... additionalPlayableInPhases) {
@@ -49,10 +51,24 @@ public abstract class AbstractOldEvent extends AbstractLotroCardBlueprint {
             addKeyword(Keyword.RESPONSE);
     }
 
+    @Override
+    public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
+        if (_playableInPhases != null) {
+            Phase currentPhase = game.getGameState().getCurrentPhase();
+            for (Phase playableInPhase : _playableInPhases) {
+                if (playableInPhase == currentPhase)
+                    return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile);
+            }
+
+            return false;
+        }
+        return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile);
+    }
+
     @Override
     public final List getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
         if (_playableInPhases != null) {
-            if (PlayConditions.canPlayCardDuringPhase(game, _playableInPhases, self)) {
+            if (PlayConditions.canPlayCardFromHandDuringPhase(game, _playableInPhases, self)) {
                 if (checkPlayRequirements(playerId, game, self, 0, 0, false, false))
                     return Collections.singletonList(getPlayCardAction(playerId, game, self, 0, false));
             }
diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java
index c1b6baf77..1d6474602 100644
--- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java
+++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java
@@ -96,7 +96,7 @@ public class PlayConditions {
                 && (!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) {
+    public static boolean canPlayCardFromHandDuringPhase(LotroGame game, Phase[] phases, PhysicalCard self) {
         return (phases == null || containsPhase(phases, game.getGameState().getCurrentPhase()))
                 && self.getZone() == Zone.HAND
                 && (!self.getBlueprint().isUnique() || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()))==0);
diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/filters/Filters.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/filters/Filters.java
index 036c35065..6a7e47680 100644
--- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/filters/Filters.java
+++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/filters/Filters.java
@@ -554,10 +554,14 @@ public class Filters {
             @Override
             public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
                 Side expectedSide = (physicalCard.getOwner().equals(gameState.getCurrentPlayerId()) ? Side.FREE_PEOPLE : Side.SHADOW);
-                if (physicalCard.getBlueprint().getSide() != expectedSide)
+                final LotroCardBlueprint blueprint = physicalCard.getBlueprint();
+                if (blueprint.getSide() != expectedSide)
                     return false;
 
-                return physicalCard.getBlueprint().checkPlayRequirements(physicalCard.getOwner(), game, physicalCard, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile);
+                if (blueprint.getPlayCardAction(physicalCard.getOwner(), game, physicalCard, 0, false)== null)
+                    return false;
+
+                return blueprint.checkPlayRequirements(physicalCard.getOwner(), game, physicalCard, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile);
             }
         };
     }