From 7dd2c31c01aad0777001da44211186bfd601fe6e Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Sun, 11 Sep 2011 08:51:54 +0000 Subject: [PATCH] Short-circuit the discard. --- .../ChooseAndDiscardCardsFromHandEffect.java | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndDiscardCardsFromHandEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndDiscardCardsFromHandEffect.java index e15d5e5fb..5f1cae4fe 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndDiscardCardsFromHandEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndDiscardCardsFromHandEffect.java @@ -39,18 +39,28 @@ public class ChooseAndDiscardCardsFromHandEffect extends UnrespondableEffect { @Override public void playEffect(LotroGame game) { - game.getUserFeedback().sendAwaitingDecision(_playerId, - new CardsSelectionDecision(1, "Choose card(s) to discard", game.getGameState().getHand(_playerId), _count, _count) { - @Override - public void decisionMade(String result) throws DecisionResultInvalidException { - List cards = getSelectedCardsByResponse(result); - for (PhysicalCard card : cards) { - if (_cost) - _action.addCost(new DiscardCardFromHandEffect(card)); - else - _action.addEffect(new DiscardCardFromHandEffect(card)); + List hand = game.getGameState().getHand(_playerId); + if (hand.size() == _count) { + for (PhysicalCard card : hand) { + if (_cost) + _action.addCost(new DiscardCardFromHandEffect(card)); + else + _action.addEffect(new DiscardCardFromHandEffect(card)); + } + } else { + game.getUserFeedback().sendAwaitingDecision(_playerId, + new CardsSelectionDecision(1, "Choose card(s) to discard", hand, _count, _count) { + @Override + public void decisionMade(String result) throws DecisionResultInvalidException { + List cards = getSelectedCardsByResponse(result); + for (PhysicalCard card : cards) { + if (_cost) + _action.addCost(new DiscardCardFromHandEffect(card)); + else + _action.addEffect(new DiscardCardFromHandEffect(card)); + } } - } - }); + }); + } } }