- 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.
This commit is contained in:
marcins78
2013-03-08 14:43:30 +00:00
parent af5ae74d54
commit 6f464f3596
4 changed files with 31 additions and 7 deletions

View File

@@ -1,4 +1,8 @@
<pre style="font-size:80%">
<b>8 Mar. 2013</b>
- 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.
<b>7 Mar. 2013</b>
- "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

View File

@@ -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<? extends Action> 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));
}

View File

@@ -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);

View File

@@ -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);
}
};
}