diff --git a/client/src/Board.js b/client/src/Board.js index 38a9a56..8856694 100755 --- a/client/src/Board.js +++ b/client/src/Board.js @@ -1252,17 +1252,13 @@ class Board extends React.Component { let angle, radius = this.radius, - index = 1, pip; //, roll = dice[0].pips + dice[1].pips; + index = 0, pip; //, roll = dice[0].pips + dice[1].pips; /* Outer row */ angle = 0; for (let i = 0; i < 12; i++) { angle -= Math.PI * 2. / 12.; - if (this.tiles[i].type === "robber") { - pip = this.pips.pips[0] - } else { - pip = this.pips.pips[index++]; - } + pip = this.pips.pips[index++]; this.tiles[i].pip = pip; drawTile(this.tiles[i], angle, radius - (i % 2) * 0.04); drawPip(pip, angle, radius - (i % 2) * 0.04, this.tiles[i].jitter); @@ -1273,11 +1269,7 @@ class Board extends React.Component { radius = this.radius * 0.5; for (let i = 12; i < 18; i++) { angle -= Math.PI * 2. / 6.; - if (this.tiles[i].type === "robber") { - pip = this.pips.pips[0] - } else { - pip = this.pips.pips[index++]; - } + pip = this.pips.pips[index++]; this.tiles[i].pip = pip; drawTile(this.tiles[i], angle, radius); drawPip(pip, angle, radius, this.tiles[i].jitter); @@ -1285,11 +1277,7 @@ class Board extends React.Component { /* Center */ let i = 18; - if (this.tiles[i].type === "robber") { - pip = this.pips.pips[0] - } else { - pip = this.pips.pips[index++]; - } + pip = this.pips.pips[index++]; this.tiles[i].pip = pip; drawTile(this.tiles[i], 0, 0); drawPip(pip, 0, 0, this.tiles[i].jitter); diff --git a/server/routes/games.js b/server/routes/games.js index 2908db1..4a83a4c 100755 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -646,6 +646,18 @@ const shuffleBoard = (game) => { } }); + /* Walk through the board looking for the robber and + * if it isn't on the desert, swap with the desert to + * be under the robber */ + const robberIndex = game.pips.findIndex((pip) => pip.roll === 7), + desertIndex = game.tiles.findIndex((tile) => tile.type === 'robber'); + + if (robberIndex !== desertIndex) { + let tmp = game.tiles[desertIndex]; + game.tiles[desertIndex] = game.tiles[robberIndex]; + game.tiles[robberIndex] = tmp; + } + shuffle(game.developmentCards) }