Browse Source

add allowedMove

main
fdai7920 11 months ago
parent
commit
d7dfa4a2e3
  1. 9
      src/main/java/de/hsfulda/onses/services/GameService.java

9
src/main/java/de/hsfulda/onses/services/GameService.java

@ -22,7 +22,16 @@ public class GameService {
// add lastPlayedCard back to drawCardDeck
game.setLastPlayedCard(card);
// check for special rules (draw, colorchoose, skip,...)
}
public boolean allowedMove(Player player, Card card)
{
boolean isAllowed = false;
Card lastCard = game.getLastPlayedCard();
// rules:
if (card.getColor() == lastCard.getColor()) isAllowed = true; // same color
return isAllowed;
}
}
Loading…
Cancel
Save