1
0

Fix VP not counting on placement

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-03-16 18:47:04 -07:00
parent b66e1fb6e5
commit 80bc3642c2

View File

@ -3270,6 +3270,8 @@ const calculatePoints = (game, update) => {
if (player.status === 'Not active') { if (player.status === 'Not active') {
continue; continue;
} }
const currentPoints = player.points;
player.points = 0; player.points = 0;
if (key === game.longestRoad) { if (key === game.longestRoad) {
player.points += 2; player.points += 2;
@ -3295,9 +3297,18 @@ const calculatePoints = (game, update) => {
} }
}); });
if (player.points === currentPoints) {
return;
}
if (player.points < 10) {
update.players = getFilteredPlayers(game);
continue;
}
/* This player has 10 points! Check if they are the current /* This player has 10 points! Check if they are the current
* player and if so, declare victory! */ * player and if so, declare victory! */
if (player.points >= 10) {
console.log(`${info}: Whoa! ${player.name} has ${player.points}!`); console.log(`${info}: Whoa! ${player.name} has ${player.points}!`);
for (let key in game.sessions) { for (let key in game.sessions) {
if (game.sessions[key].color !== player.color if (game.sessions[key].color !== player.color
@ -3327,7 +3338,6 @@ const calculatePoints = (game, update) => {
}); });
} }
} }
}
/* If the game isn't in a win state, do not share development card information /* If the game isn't in a win state, do not share development card information
* with other players */ * with other players */