Merge pull request #2523 from Sertion/master

Issue #2521: Thought Hemorrhage issue
This commit is contained in:
LevelX2 2016-10-29 23:31:57 +02:00 committed by GitHub
commit e0ad116791

View file

@ -27,6 +27,7 @@
*/ */
package mage.cards.t; package mage.cards.t;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -76,7 +77,7 @@ class ThoughtHemorrhageEffect extends OneShotEffect {
final String rule = "Target player reveals his or her hand. {this} deals 3 damage to that player for each card with that name revealed this way. Search that player's graveyard, hand, and library for all cards with that name and exile them. Then that player shuffles his or her library"; final String rule = "Target player reveals his or her hand. {this} deals 3 damage to that player for each card with that name revealed this way. Search that player's graveyard, hand, and library for all cards with that name and exile them. Then that player shuffles his or her library";
public ThoughtHemorrhageEffect() { public ThoughtHemorrhageEffect() {
super(Outcome.Detriment); super(Outcome.Exile);
staticText = rule; staticText = rule;
} }
@ -116,13 +117,15 @@ class ThoughtHemorrhageEffect extends OneShotEffect {
} }
} }
// search cards in hand // search cards in Hand
TargetCardInHand targetCardsHand = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCards); TargetCardInHand targetCardInHand = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCards);
controller.chooseTarget(outcome, targetPlayer.getGraveyard(), targetCardsHand, source, game); if (controller.chooseTarget(Outcome.Exile, targetPlayer.getHand(), targetCardInHand, source, game)) {
for (UUID cardId : targetCardsHand.getTargets()) { List<UUID> targets = targetCardInHand.getTargets();
Card card = game.getCard(cardId); for (UUID targetId : targets) {
if (card != null) { Card targetCard = targetPlayer.getHand().get(targetId, game);
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true); if (targetCard != null) {
controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.HAND, true);
}
} }
} }