* Wrench Mind - Fixed a bug that locked the UI while discarding.

This commit is contained in:
LevelX2 2014-04-12 23:27:16 +02:00
parent bc0bd754dd
commit 1155cf2049
3 changed files with 16 additions and 16 deletions

View file

@ -532,16 +532,14 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
@Override
public void discardToMax(Game game) {
int cardsStart = hand.size();
if (cardsStart > this.maxHandSize) {
if (hand.size() > this.maxHandSize) {
game.informPlayers(new StringBuilder(getName()).append(" discards down to ").append(this.maxHandSize).append(this.maxHandSize == 1?" hand card":" hand cards").toString());
while (hand.size() > this.maxHandSize) {
TargetDiscard target = new TargetDiscard(playerId);
target.setTargetName(new StringBuilder(" card to discard (").append(hand.size() - this.maxHandSize).append(" in total)").toString());
choose(Outcome.Discard, target, null, game);
discard(hand.get(target.getFirstTarget(), game), null, game);
}
int discarded =cardsStart - hand.size();
game.informPlayers(new StringBuilder(getName()).append(" discards ").append(discarded).append(discarded == 1?" card":" cards").append(" (cleanup)").toString());
}
}