Browse Source

botCanDrawCards

main
fdai7793 11 months ago
parent
commit
bf2dd25470
  1. 4
      src/main/java/de/hsfulda/onses/services/PlayerService.java

4
src/main/java/de/hsfulda/onses/services/PlayerService.java

@ -61,6 +61,7 @@ public class PlayerService {
} }
public void botMove() { public void botMove() {
Card lastPlayedCard = game.getLastPlayedCard();
for (int i = 0; i < this.playerList.getLast().getPlayerDeck().size(); i++) { for (int i = 0; i < this.playerList.getLast().getPlayerDeck().size(); i++) {
if (getGame().getGameService().legalMove(this.playerList.getLast().getPlayerDeck().get(i))) { if (getGame().getGameService().legalMove(this.playerList.getLast().getPlayerDeck().get(i))) {
Card playCard = this.playerList.getLast().getPlayerDeck().get(i); Card playCard = this.playerList.getLast().getPlayerDeck().get(i);
@ -69,5 +70,8 @@ public class PlayerService {
break; break;
} }
} }
if (lastPlayedCard == game.getLastPlayedCard()) {
game.getGameService().drawCard(1);
}
} }
} }
Loading…
Cancel
Save