From a1928ce95a2839d09ec8832b738d0a6f080eee5a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 24 Oct 2013 10:11:26 +0200 Subject: [PATCH] Some clean up to discard handling. --- Mage/src/mage/players/PlayerImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 65e0e37022..33c5d1aef0 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -560,7 +560,6 @@ public abstract class PlayerImpl> implements Player, Ser @Override public void discard(int amount, Ability source, Game game) { if (amount >= hand.size()) { - int discardAmount = hand.size(); while (hand.size() > 0) { discard(hand.get(hand.iterator().next(), game), source, game); } @@ -574,7 +573,7 @@ public abstract class PlayerImpl> implements Player, Ser TargetDiscard target = new TargetDiscard(playerId); choose(Outcome.Discard, target, source.getSourceId(), game); Card card = hand.get(target.getFirstTarget(), game); - if (card != null && discard(card, source, game)) { + if (discard(card, source, game)) { numDiscarded++; } } @@ -583,9 +582,8 @@ public abstract class PlayerImpl> implements Player, Ser @Override public boolean discard(Card card, Ability source, Game game) { //20100716 - 701.7 - if (card != null) { - removeFromHand(card, game); - card.moveToZone(Zone.GRAVEYARD, source==null?null:source.getId(), game, false); + if (card != null + && card.moveToZone(Zone.GRAVEYARD, source==null?null:source.getSourceId(), game, false)) { game.informPlayers(new StringBuilder(name).append(" discards ").append(card.getName()).toString()); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, card.getId(), source==null?null:source.getId(), playerId)); return true;