for (int roundId = startRound; roundId < endRound + 1; roundId = roundId + inc) {
dealer = (dealer + 1)% _playerCollection.size();
lead = (dealer + 1)% _playerCollection.size();
gameEventNotifier.notify(new NewRoundEvent(roundId));
_game.newRound(roundId);
Round round = _game.getCurrentRound();
Card trump = dealCards(roundId, dealer, lead);
gameEventNotifier.notify(new NewTrumpEvent(trump));
round.setTrump(trump);
if(trump != null && trump.getValue().equals(Value.WIZARD)) {
Player trumpPicker = _playerCollection.get(dealer);
//_logger.info(trumpPicker.getName() + " gets to pick trump.");
trump = new Card(null, trumpPicker.pickTrump(), -1);
gameEventNotifier.notify(new NewTrumpEvent(trump));
round.setTrump(trump);
}
int cardsDealt = roundId;
Bid bid = bid(trump, lead, cardsDealt, round);
if(go.getBidType().equals(BidType.HIDDEN)) {
for(IndividualBid individualBid :bid.getBids()) {
gameEventNotifier.notify(new PlayerBidEvent(individualBid.getPlayer().getId(), individualBid.getBid()));
round.setBid(individualBid.getPlayer().getId(), individualBid.getBid());
}
}
RoundSummary roundSummary = new RoundSummary();
for (int i = 0; i < roundId; i++) {
TrickTracker trickTracker = playTrick(trump, lead, round);
roundSummary.addTrickTracker(trickTracker);
int playerIdWhoWon = trickTracker.winningPlay().getPlayerId();
lead = findPlayerIndex(playerIdWhoWon);
}
if(go.getBidType().equals(BidType.SECRET)) {
for(IndividualBid individualBid :bid.getBids()) {
gameEventNotifier.notify(new PlayerBidEvent(individualBid.getPlayer().getId(), individualBid.getBid()));
round.setBid(individualBid.getPlayer().getId(), individualBid.getBid());
}
}
scoreRound(roundSummary, bid, _game);
this.overallScores.displayScore();
}