1
0

Male and female robbers!

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-02-19 19:32:50 -08:00
parent 01013e4ede
commit ee3f96dc6f
3 changed files with 13 additions and 1 deletions

View File

@ -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 {

View File

@ -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);
}
}
}

View File

@ -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);