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,17 +602,22 @@ public class Game {
playedCards.clear(); playedCards.clear();
synchronized (blackCardLock) { BlackCard newBlackCard;
blackCard = getNextBlackCard();
if (blackCard.getDraw() > 0) { synchronized (blackCardLock) {
if (blackCard != null) {
blackDeck.discard(blackCard);
}
newBlackCard = blackCard = getNextBlackCard();
}
if (newBlackCard.getDraw() > 0) {
synchronized (players) { synchronized (players) {
for (final Player player : players) { for (final Player player : players) {
if (getJudge() == player) { if (getJudge() == player) {
continue; continue;
} }
final List<WhiteCard> cards = new ArrayList<WhiteCard>(blackCard.getDraw()); final List<WhiteCard> cards = new ArrayList<WhiteCard>(newBlackCard.getDraw());
for (int i = 0; i < blackCard.getDraw(); i++) { for (int i = 0; i < newBlackCard.getDraw(); i++) {
cards.add(getNextWhiteCard()); cards.add(getNextWhiteCard());
} }
player.getHand().addAll(cards); player.getHand().addAll(cards);
@ -620,7 +625,6 @@ public class Game {
} }
} }
} }
}
final int playTimer = PLAY_TIMEOUT_BASE + (PLAY_TIMEOUT_PER_CARD * blackCard.getPick()); final int playTimer = PLAY_TIMEOUT_BASE + (PLAY_TIMEOUT_PER_CARD * blackCard.getPick());