Skip to content

Commit

Permalink
Commit sistemato database semi-pronta fase attacco
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto-Negro committed Feb 21, 2024
1 parent 7201c5e commit 0825ec7
Showing 1 changed file with 5 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,37 +74,15 @@ public void setUpGame() throws GameException, DatabaseConnectionException, UserE
private void assignObjective(IDeck deckObjective) throws GameException, DatabaseConnectionException, UserException {
deckObjective.shuffle();
ObjectiveCard card = null;

card = (ObjectiveCard) deckObjective.drawCard();
Player player = game.getPlayers().get(0);
player.setObjective(card);
LOGGER.info("Player {} has objective -------------- {}", player.getUserName(), card.getObjective());
GameRepository.getInstance().updateObjective(player.getUserName(), card.getObjective());

card = (ObjectiveCard) deckObjective.drawCard();
player = game.getPlayers().get(1);
player.setObjective(card);
LOGGER.info("Player {} has objective -------------- {}", player.getUserName(), card.getObjective());
GameRepository.getInstance().updateObjective(player.getUserName(), card.getObjective());

card = (ObjectiveCard) deckObjective.drawCard();
player = game.getPlayers().get(2);
player.setObjective(card);
LOGGER.info("Player {} has objective -------------- {}", player.getUserName(), card.getObjective());
GameRepository.getInstance().updateObjective(player.getUserName(), card.getObjective());

/*

for (Player player : game.getPlayers()) {
try {
card = (ObjectiveCard) deckObjective.drawCard();
player.setObjective(card);
GameRepository.getInstance().updateObjective(player.getUserName(), card.getObjective());
} catch (Exception e) {
LOGGER.error("--------------Errore nell'assegnamento degli obiettivi-------------", e);
}*/

if(game.getConfiguration().getMode().name().equals("EASY"))
deckObjective.insertCard(card);
if(game.getConfiguration().getMode().name().equals("EASY"))
deckObjective.insertCard(card);

}

}

Expand Down

0 comments on commit 0825ec7

Please sign in to comment.