From ee3f96dc6fc3edb5454ab417363c5b5288f7b3cd Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sat, 19 Feb 2022 19:32:50 -0800 Subject: [PATCH] Male and female robbers! Signed-off-by: James Ketrenos --- client/src/Board.css | 7 +++++++ client/src/Board.js | 3 +++ server/routes/games.js | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/Board.css b/client/src/Board.css index ce729ee..3b7be23 100644 --- a/client/src/Board.css +++ b/client/src/Board.css @@ -152,9 +152,16 @@ background-color:#e7c099; background-size: contain; background-position: center; +} + +.Roberta .Pip-Shape { background-image:url("./assets/woman-robber.png"); } +.Robert .Pip-Shape { + background-image:url("./assets/man-robber.png"); +} + .Tile-Shape:hover, .Corner-Shape:hover, .Road-Shape:hover { diff --git a/client/src/Board.js b/client/src/Board.js index 885c202..28bd03d 100644 --- a/client/src/Board.js +++ b/client/src/Board.js @@ -471,15 +471,18 @@ const Board = ({ table, game }) => { } if (game) { + let robberClass = game.gender === 'female' ? 'Roberta' : 'Robert'; let nodes = document.querySelectorAll(`.Pip.Robber`); for (let i = 0; i < nodes.length; i++) { nodes[i].classList.remove('Robber'); + nodes[i].classList.remove(robberClass); } if (game.robber) { const el = document.querySelector(`.Pip[data-index="${game.robber}"]`); if (el) { el.classList.add('Robber'); + el.classList.add(robberClass); } } } diff --git a/server/routes/games.js b/server/routes/games.js index a606a33..6037193 100755 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -366,7 +366,7 @@ const processRoll = (game, dice) => { addChatMessage(game, session, `${session.name} rolled ${game.dice[0]}, ${game.dice[1]}.`); game.turn.roll = game.dice[0] + game.dice[1]; if (game.turn.roll === 7) { - addChatMessage(game, null, `ROBBER! Robber Roberson!`); + addChatMessage(game, null, `ROBBER! ${game.gender === 'female' ? 'Roberta' : 'Robert'} Robber Roberson!`); game.turn.robberDone = false; delete game.turn.placedRobber; for (let id in game.sessions) { @@ -2375,6 +2375,8 @@ const shuffleBoard = (game) => { } shuffle(seq); + game.gender = Math.random() > 0.5 ? 'male' : 'female'; + game.borderOrder = seq.slice(); for (let i = 6; i < 19; i++) { seq.push(i);