|
@ -31,8 +31,8 @@ public class GameService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void drawCard(int amount) { |
|
|
public void drawCard(int amount) { |
|
|
Player player = null; |
|
|
|
|
|
if (!game.getDrawCardDeck().isEmpty()) { |
|
|
if (!game.getDrawCardDeck().isEmpty()) { |
|
|
|
|
|
Player player = null; |
|
|
if (game.getPlayerService().getCurrentTurn()) { |
|
|
if (game.getPlayerService().getCurrentTurn()) { |
|
|
player = game.getPlayerService().getPlayerList().getFirst(); |
|
|
player = game.getPlayerService().getPlayerList().getFirst(); |
|
|
} else { |
|
|
} else { |
|
@ -42,6 +42,13 @@ public class GameService { |
|
|
player.getPlayerDeck().add(game.getDrawCardDeck().getFirst()); |
|
|
player.getPlayerDeck().add(game.getDrawCardDeck().getFirst()); |
|
|
game.getDrawCardDeck().removeFirst(); |
|
|
game.getDrawCardDeck().removeFirst(); |
|
|
} |
|
|
} |
|
|
|
|
|
if (amount == 1 && !player.getPlayerDeck().isEmpty()) { //refactoring DrawnCard |
|
|
|
|
|
Card card = player.getPlayerDeck().getLast(); |
|
|
|
|
|
if (legalMove(card)) { |
|
|
|
|
|
player.getPlayerService().removeCardFromPlayerDeck(card); |
|
|
|
|
|
playCard(card);} |
|
|
|
|
|
else nextPlayer(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (amount != 1) { |
|
|
if (amount != 1) { |
|
|
nextPlayer(); |
|
|
nextPlayer(); |
|
|