summaryrefslogtreecommitdiff
path: root/game-engine/src/main/java/org/luxons
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@amadeus.com>2018-07-06 13:59:33 +0200
committerJoffrey Bion <joffrey.bion@amadeus.com>2018-07-06 14:16:57 +0200
commit5615172249c3e1a95f6e03333fd7e456bd5db5ca (patch)
treeba1c20dc199c89da4ac2791f0369bde7c07fbfc1 /game-engine/src/main/java/org/luxons
parentUpdate yarn.lock (diff)
downloadseven-wonders-5615172249c3e1a95f6e03333fd7e456bd5db5ca.tar.gz
seven-wonders-5615172249c3e1a95f6e03333fd7e456bd5db5ca.tar.bz2
seven-wonders-5615172249c3e1a95f6e03333fd7e456bd5db5ca.zip
Prevent PICK_NEIGHBOUR_GUILD action if no guild to pick
Diffstat (limited to 'game-engine/src/main/java/org/luxons')
-rw-r--r--game-engine/src/main/java/org/luxons/sevenwonders/game/Game.java3
-rw-r--r--game-engine/src/main/java/org/luxons/sevenwonders/game/boards/Board.java4
2 files changed, 6 insertions, 1 deletions
diff --git a/game-engine/src/main/java/org/luxons/sevenwonders/game/Game.java b/game-engine/src/main/java/org/luxons/sevenwonders/game/Game.java
index ed11913b..853d7490 100644
--- a/game-engine/src/main/java/org/luxons/sevenwonders/game/Game.java
+++ b/game-engine/src/main/java/org/luxons/sevenwonders/game/Game.java
@@ -95,7 +95,8 @@ public class Game {
private Action determineAction(List<HandCard> hand, Board board) {
if (endOfGameReached() && board.hasSpecial(SpecialAbility.COPY_GUILD)) {
- return Action.PICK_NEIGHBOR_GUILD;
+ List<Card> neighbourGuildCards = table.getNeighbourGuildCards(board.getPlayerIndex());
+ return neighbourGuildCards.isEmpty() ? Action.WAIT : Action.PICK_NEIGHBOR_GUILD;
} else if (hand.size() == 1 && board.hasSpecial(SpecialAbility.PLAY_LAST_CARD)) {
return Action.PLAY_LAST;
} else if (hand.size() == 2 && board.hasSpecial(SpecialAbility.PLAY_LAST_CARD)) {
diff --git a/game-engine/src/main/java/org/luxons/sevenwonders/game/boards/Board.java b/game-engine/src/main/java/org/luxons/sevenwonders/game/boards/Board.java
index a59bbfae..23ce5da5 100644
--- a/game-engine/src/main/java/org/luxons/sevenwonders/game/boards/Board.java
+++ b/game-engine/src/main/java/org/luxons/sevenwonders/game/boards/Board.java
@@ -57,6 +57,10 @@ public class Board {
this.publicProduction.addFixedResource(wonder.getInitialResource(), 1);
}
+ public int getPlayerIndex() {
+ return playerIndex;
+ }
+
public Wonder getWonder() {
return wonder;
}
bgstack15