From c6e4a309fe9d827ec12f555a21fcb5a6ad9707a3 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 11 Sep 2020 22:34:16 -0400 Subject: [PATCH] updated discard effect to prevent unnecessary choosing from an empty hand (fixes #7064) --- .../common/discard/DiscardEachPlayerEffect.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java index 7fee7da644..13b86e89ee 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java @@ -89,9 +89,14 @@ public class DiscardEachPlayerEffect extends OneShotEffect { } int numberOfCardsToDiscard = Math.min(toDiscard, player.getHand().size()); Cards cards = new CardsImpl(); - Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, StaticFilters.FILTER_CARD, playerId); - player.chooseTarget(outcome, target, source, game); - cards.addAll(target.getTargets()); + if (numberOfCardsToDiscard > 0) { + Target target = new TargetDiscard( + numberOfCardsToDiscard, numberOfCardsToDiscard, + StaticFilters.FILTER_CARD, playerId + ); + player.chooseTarget(outcome, target, source, game); + cards.addAll(target.getTargets()); + } cardsToDiscard.put(playerId, cards); } if (randomDiscard) {