diff options
Diffstat (limited to 'backend/src/main')
-rw-r--r-- | backend/src/main/java/org/luxons/sevenwonders/actions/PrepareMoveAction.java (renamed from backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java) | 6 | ||||
-rw-r--r-- | backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java | 9 | ||||
-rw-r--r-- | backend/src/main/java/org/luxons/sevenwonders/game/Game.java | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java b/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareMoveAction.java index 629e5806..02899eab 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java +++ b/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareMoveAction.java @@ -6,10 +6,10 @@ import org.jsondoc.core.annotation.ApiObject; import org.jsondoc.core.annotation.ApiObjectField; import org.luxons.sevenwonders.game.api.PlayerMove; -@ApiObject(name = "Prepare Card Action", - description = "The action to prepare a card during a game.", +@ApiObject(name = "Prepare Move Action", + description = "The action to prepare the next move during a game.", group = "Actions") -public class PrepareCardAction { +public class PrepareMoveAction { @ApiObjectField @NotNull diff --git a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java index 0ec631f6..8680b00e 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java +++ b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java @@ -4,7 +4,7 @@ import java.security.Principal; import org.jsondoc.core.annotation.Api; import org.jsondoc.core.annotation.ApiMethod; -import org.luxons.sevenwonders.actions.PrepareCardAction; +import org.luxons.sevenwonders.actions.PrepareMoveAction; import org.luxons.sevenwonders.game.Game; import org.luxons.sevenwonders.game.api.PlayerTurnInfo; import org.luxons.sevenwonders.game.cards.CardBack; @@ -36,12 +36,13 @@ public class GameController { this.playerRepository = playerRepository; } - @ApiMethod(description = "Prepares the user's card") + @ApiMethod(description = "Prepares the user's next move. When all players have prepared their moves, all moves " + + "are executed.") @MessageMapping("/game/{gameId}/prepare") - public void prepareCard(@DestinationVariable long gameId, PrepareCardAction action, Principal principal) { + public void prepareMove(@DestinationVariable long gameId, PrepareMoveAction action, Principal principal) { Player player = playerRepository.find(principal.getName()); Game game = player.getGame(); - CardBack preparedCardBack = game.prepareCard(player.getIndex(), action.getMove()); + CardBack preparedCardBack = game.prepareMove(player.getIndex(), action.getMove()); PreparedCard preparedCard = new PreparedCard(player, preparedCardBack); logger.info("Game '{}': player {} prepared move {}", gameId, principal.getName(), action.getMove()); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/Game.java b/backend/src/main/java/org/luxons/sevenwonders/game/Game.java index 4f71d6e6..62cbab88 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/Game.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/Game.java @@ -99,7 +99,7 @@ public class Game { } } - public CardBack prepareCard(int playerIndex, PlayerMove playerMove) throws InvalidMoveException { + public CardBack prepareMove(int playerIndex, PlayerMove playerMove) throws InvalidMoveException { Card card = decks.getCard(playerMove.getCardName()); Move move = playerMove.getType().resolve(playerIndex, card, playerMove); validate(move); @@ -135,8 +135,8 @@ public class Game { } private void rotateHandsIfRelevant() { + // we don't rotate hands if some player can play his last card (with the special ability) if (!hands.maxOneCardRemains()) { - // we don't rotate hands if some player can play his last card (with the special ability) hands.rotate(table.getHandRotationDirection()); } } |