Fixing playing from discard and not allowing to play from discard.

This commit is contained in:
marcins78@gmail.com
2011-12-15 18:20:42 +00:00
parent 078236ad25
commit c591f19aa3
9 changed files with 19 additions and 13 deletions

View File

@@ -48,7 +48,7 @@ public class ChooseAndPlayCardFromDeadPileEffect implements Effect {
}
private Collection<PhysicalCard> getPlayableInDeadPile(LotroGame game) {
return Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier, false, true));
return Filters.filter(game.getGameState().getDeadPile(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier, false, true));
}
@Override

View File

@@ -9,6 +9,7 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.modifiers.ModifierFlag;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
@@ -54,6 +55,8 @@ public class ChooseAndPlayCardFromDiscardEffect implements Effect {
@Override
public void playEffect(final LotroGame game) {
if (game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.CANT_PLAY_FROM_DISCARD_OR_DECK))
return;
Collection<PhysicalCard> discard = getPlayableInDiscard(game);
if (discard.size() > 0) {
game.getUserFeedback().sendAwaitingDecision(_playerId,

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set1.moria;
import com.gempukku.lotro.cards.AbstractOldEvent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.common.Culture;
@@ -28,7 +29,7 @@ public class Card1_187 extends AbstractOldEvent {
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile)
// There has to be playable MORIA Orc in discard pile to be able to use "Host of Thousands"
&& Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), Culture.MORIA, Race.ORC, Filters.playable(game)).size() > 0;
&& PlayConditions.canPlayFromDiscard(playerId, game, Culture.MORIA, Race.ORC);
}
@Override

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set1.moria;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.common.CardType;
@@ -34,7 +35,8 @@ public class Card1_193 extends AbstractPermanent {
@Override
public List<? extends ActivateCardAction> getOptionalInPlayAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.forEachDiscardedFromPlay(game, effectResult, Culture.MORIA, Filters.weapon, Zone.DISCARD, Filters.playable(game, -1))) {
if (TriggerConditions.forEachDiscardedFromPlay(game, effectResult, Culture.MORIA, Filters.weapon, Zone.DISCARD, Filters.playable(game, -1))
&& PlayConditions.canPlayFromDiscard(playerId, game, -1, ((DiscardCardsFromPlayResult) effectResult).getDiscardedCard())) {
DiscardCardsFromPlayResult discardResult = (DiscardCardsFromPlayResult) effectResult;
final PhysicalCard discardedCard = discardResult.getDiscardedCard();
ActivateCardAction action = new ActivateCardAction(self);
@@ -43,9 +45,9 @@ public class Card1_193 extends AbstractPermanent {
new ChooseAndPlayCardFromDiscardEffect(playerId,
game,
-1, Filters.and(
Culture.MORIA,
Filters.weapon,
discardedCard)));
Culture.MORIA,
Filters.weapon,
discardedCard)));
return Collections.singletonList(action);
}
return null;

View File

@@ -33,7 +33,7 @@ public class Card1_196 extends AbstractPermanent {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.SHADOW, self, 0)
&& game.getGameState().getHand(playerId).size() >= 3
// You have to be able to play a MORIA Orc from discard to use it
&& Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), Culture.MORIA, Race.ORC, Filters.playable(game)).size() > 0) {
&& PlayConditions.canPlayFromDiscard(playerId, game, Culture.MORIA, Race.ORC)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 3));
action.appendEffect(

View File

@@ -38,7 +38,7 @@ public class Card2_001 extends AbstractPermanent {
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), Culture.DWARVEN, Filters.weapon, Filters.playable(game)).size() > 0) {
&& PlayConditions.canPlayFromDiscard(playerId, game, Culture.DWARVEN, Filters.weapon)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new DiscardTopCardFromDeckEffect(self, playerId, 3, false));

View File

@@ -1,13 +1,13 @@
package com.gempukku.lotro.cards.set2.moria;
import com.gempukku.lotro.cards.AbstractOldEvent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -33,7 +33,7 @@ public class Card2_059 extends AbstractOldEvent {
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile)
// There has to be playable MORIA Orc in discard pile to be able to use "Foul Things"
&& Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), Culture.MORIA, CardType.MINION, Filters.playable(game)).size() > 0;
&& PlayConditions.canPlayFromDiscard(playerId, game, Culture.MORIA, CardType.MINION);
}
@Override

View File

@@ -32,7 +32,7 @@ public class Card3_052 extends AbstractPermanent {
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.SHADOW, self, 0)
&& PlayConditions.canExert(self, game, Filters.saruman)
&& Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, Keyword.WEATHER, CardType.CONDITION, Filters.playable(game, -2)).size() > 0) {
&& PlayConditions.canPlayFromDiscard(playerId, game, -2, Culture.ISENGARD, Keyword.WEATHER, CardType.CONDITION)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.saruman));

View File

@@ -35,12 +35,12 @@ public class Card4_089 extends AbstractCompanion {
protected List<ActivateCardAction> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& game.getGameState().getTwilightPool() < 2
&& Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(), CardType.COMPANION, Filters.playable(game)).size() > 0) {
&& PlayConditions.canPlayFromDiscard(playerId, game, Side.FREE_PEOPLE, Filters.character)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new AddTwilightEffect(self, 2));
action.appendEffect(
new ChooseAndPlayCardFromDiscardEffect(playerId, game, CardType.COMPANION));
new ChooseAndPlayCardFromDiscardEffect(playerId, game, Side.FREE_PEOPLE, Filters.character));
return Collections.singletonList(action);
}
return null;