diff options
Diffstat (limited to 'game-engine/src')
3 files changed, 9 insertions, 2 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; } diff --git a/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java b/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java index ff34dc27..02531cde 100644 --- a/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java +++ b/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java @@ -24,6 +24,7 @@ import org.luxons.sevenwonders.game.resources.Resources; import org.luxons.sevenwonders.game.test.TestUtils; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; @@ -119,7 +120,8 @@ public class GameTest { private static PlayerMove createPickGuildMove(PlayerTurnInfo turnInfo) { List<Card> neighbourGuilds = turnInfo.getNeighbourGuildCards(); assertNotNull(neighbourGuilds); - String cardName = neighbourGuilds.isEmpty() ? null : neighbourGuilds.get(0).getName(); + assertFalse(neighbourGuilds.isEmpty()); + String cardName = neighbourGuilds.get(0).getName(); return TestUtils.createPlayerMove(cardName, MoveType.COPY_GUILD); } } |