* Persecute - Fixed that the discard was done for the controller of Persecute instead of the target player.

This commit is contained in:
LevelX2 2015-08-06 16:52:11 +02:00
parent 49fe489c0f
commit 9d3aefe05b

View file

@ -89,7 +89,8 @@ class PersecuteEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller != null && sourceObject != null && targetPlayer != null) {
ChoiceColor choice = new ChoiceColor();
while (!choice.isChosen()) {
controller.choose(outcome, choice, game);
@ -100,12 +101,12 @@ class PersecuteEffect extends OneShotEffect {
if (choice.getColor() == null) {
return false;
}
Cards hand = controller.getHand();
controller.revealCards(sourceObject.getIdName(), hand, game);
Cards hand = targetPlayer.getHand();
targetPlayer.revealCards(sourceObject.getIdName(), hand, game);
Set<Card> cards = hand.getCards(game);
for (Card card : cards) {
if (card != null && card.getColor(game).shares(choice.getColor())) {
controller.discard(card, source, game);
targetPlayer.discard(card, source, game);
}
}
return true;