diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java index 4d4ba0a3b3..d4565bdcfa 100644 --- a/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java @@ -55,6 +55,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect 0) { + int numberToReveal = this.numberCardsToReveal.calculate(game, source); + if (numberToReveal > 0) { Cards revealedCards = new CardsImpl(Zone.HAND); - number = Math.min(player.getHand().size(), number); - if (player.getHand().size() > number) { - TargetCardInHand chosenCards = new TargetCardInHand(number, number, new FilterCard("card in target player's hand")); + numberToReveal = Math.min(player.getHand().size(), numberToReveal); + if (player.getHand().size() > numberToReveal) { + TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in target player's hand")); chosenCards.setRequired(true); chosenCards.setNotTarget(true); if (chosenCards.canChoose(player.getId(), game) && player.choose(Outcome.Discard, player.getHand(), chosenCards, game)) { @@ -141,17 +153,25 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect 0) { - TargetCard target = new TargetCard(Zone.HAND, filter); + + boolean result = true; + int filteredCardsCount = revealedCards.count(filter, source.getSourceId(), source.getControllerId(), game); + int numberToDiscard = Math.min(this.numberCardsToDiscard.calculate(game, source), filteredCardsCount); + if (numberToDiscard > 0) { + TargetCard target = new TargetCard(numberToDiscard, Zone.HAND, filter); target.setRequired(true); if (controller.choose(Outcome.Benefit, revealedCards, target, game)) { - Card card = revealedCards.get(target.getFirstTarget(), game); - if (card != null) { - return player.discard(card, source, game); + for (Object targetId : target.getTargets()) { + Card card = revealedCards.get((UUID) targetId, game); + if (card != null) { + if (!player.discard(card, source, game)) { + result = false; + } + } } } } - + return result; } return true; } @@ -167,10 +187,10 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect