From 1c69cd23e9c69cc9c84516b279112f85380fbcd7 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 24 May 2022 16:49:51 -0700 Subject: [PATCH] Display Volcano and assign Pip roll Number Signed-off-by: James Ketrenos --- client/src/Board.js | 37 +++++++++++++++++++++++++++++-------- client/src/HouseRules.js | 2 +- server/routes/games.js | 10 +++++----- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/client/src/Board.js b/client/src/Board.js index ece2c23..613b5f9 100644 --- a/client/src/Board.js +++ b/client/src/Board.js @@ -452,6 +452,13 @@ const Board = () => { left: x, order: order }; + if ('volcano' in rules + && rules[`volcano`].enabled + && pip.roll === 7) { + pip.order = pips.findIndex( + pip => pip.roll === rules[`volcano`].number); + pip.roll = rules[`volcano`].number; + } const div = { }; const Tile = ({tile}) => { + const style = { + top: `${tile.top}px`, + left: `${tile.left}px`, + width: `${tileImageWidth}px`, + height: `${tileImageHeight}px`, + backgroundImage: `url(${assetsPath}/gfx/tiles-${tile.type}.png)`, + backgroundPositionY: `-${tile.card * tileHeight}px` + }; + + if (tile.type === 'volcano') { + style.transform = `rotate(-90deg)`; + style.top = `${tile.top + 6}px`; + style.transformOrigin = '0% 50%'; + } + return
; }; @@ -493,6 +508,12 @@ const Board = () => { const tile = Object.assign({}, tiles[order], { index: index++, left: x, top: y}); + if ('volcano' in rules + && rules[`volcano`].enabled + && tile.type === 'desert') { + tile.type = 'volcano'; + tile.card = 0; + } if ('tiles-start-facing-down' in rules && rules[`tiles-start-facing-down`].enabled && state !== 'normal' diff --git a/client/src/HouseRules.js b/client/src/HouseRules.js index 5eabf4e..566b60b 100644 --- a/client/src/HouseRules.js +++ b/client/src/HouseRules.js @@ -300,7 +300,7 @@ const HouseRules = ({ houseRulesActive, setHouseRulesActive }) => { disabled: state !== 'lobby' } } />, - implemented: false, + implemented: true, }, { title: `Don't keep paying those soldiers!`, key: `mercenaries`, diff --git a/server/routes/games.js b/server/routes/games.js index 961492a..cb144f2 100755 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -4414,11 +4414,11 @@ const setBeginnerGame = (game) => { game.robber = 9; game.pipOrder = [ - 5, 1, 6, - 7, 2, 9, 11, - 12, 8, 18, 3, 4, - 10, 16, 13, 0, - 14, 15, 17 + 5, 1, 6, + 7, 2, 9, 11, + 12, 8, 18, 3, 4, + 10, 16, 13, 0, + 14, 15, 17 ]; game.signature = gameSignature(game); }