updated discard effect to prevent unnecessary choosing from an empty hand (fixes #7064)

This commit is contained in:
Evan Kranzler 2020-09-11 22:34:16 -04:00
parent 91b9e123ab
commit c6e4a309fe

View file

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