need to discard black cards so reshuffling actually works

This commit is contained in:
Andy Janata 2012-11-10 20:00:52 -08:00
parent 482361fa46
commit 891d2a36a1
1 changed files with 18 additions and 14 deletions

View File

@ -602,22 +602,26 @@ public class Game {
playedCards.clear(); playedCards.clear();
synchronized (blackCardLock) { BlackCard newBlackCard;
blackCard = getNextBlackCard();
if (blackCard.getDraw() > 0) { synchronized (blackCardLock) {
synchronized (players) { if (blackCard != null) {
for (final Player player : players) { blackDeck.discard(blackCard);
if (getJudge() == player) { }
continue; newBlackCard = blackCard = getNextBlackCard();
} }
final List<WhiteCard> cards = new ArrayList<WhiteCard>(blackCard.getDraw()); if (newBlackCard.getDraw() > 0) {
for (int i = 0; i < blackCard.getDraw(); i++) { synchronized (players) {
cards.add(getNextWhiteCard()); for (final Player player : players) {
} if (getJudge() == player) {
player.getHand().addAll(cards); continue;
sendCardsToPlayer(player, cards);
} }
final List<WhiteCard> cards = new ArrayList<WhiteCard>(newBlackCard.getDraw());
for (int i = 0; i < newBlackCard.getDraw(); i++) {
cards.add(getNextWhiteCard());
}
player.getHand().addAll(cards);
sendCardsToPlayer(player, cards);
} }
} }
} }