Browse Source

refactoring: fix remove card from bot

main^2
fdai7736 11 months ago
parent
commit
351cdb37df
  1. 1
      src/main/java/de/hsfulda/onses/controllers/GameController.java
  2. 2
      src/main/java/de/hsfulda/onses/services/PlayerService.java

1
src/main/java/de/hsfulda/onses/controllers/GameController.java

@ -43,7 +43,6 @@ public class GameController implements Controller {
playButton.setOnAction(e -> { playButton.setOnAction(e -> {
Card cardToPlay = game.getPlayerService().getPlayerList().getFirst().getCurrentCard(); Card cardToPlay = game.getPlayerService().getPlayerList().getFirst().getCurrentCard();
if(gameService.legalMove(cardToPlay)) { if(gameService.legalMove(cardToPlay)) {
System.out.println(cardToPlay.getPlayer());
if(cardToPlay.getPlayer() != null) { if(cardToPlay.getPlayer() != null) {
cardToPlay.getPlayer().removeCardFromPlayerDeck(cardToPlay); cardToPlay.getPlayer().removeCardFromPlayerDeck(cardToPlay);
gameService.playCard(cardToPlay); gameService.playCard(cardToPlay);

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

@ -57,7 +57,7 @@ public class PlayerService {
} else { } else {
player = playerList.getLast(); player = playerList.getLast();
} }
player.getPlayerDeck().remove(card);
player.removeCardFromPlayerDeck(card);
} }
public void botMove() { public void botMove() {

Loading…
Cancel
Save