Skip to content

Commit

Permalink
fix: Remove longest road status if two players have equal road length
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed May 18, 2022
1 parent af0c981 commit 9161bd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/settlers/move/game-logic/build.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export class BuildService {
if (!bestPlayer || longestRoad > bestPlayer.longestRoad) {
update.$inc.victoryPoints = +2;
update.$set = {longestRoad};
bestPlayer && await this.playerService.update(gameId, bestPlayer.userId, {
}
if (bestPlayer && longestRoad >= bestPlayer.longestRoad) {
await this.playerService.update(gameId, bestPlayer.userId, {
$inc: { victoryPoints: -2 },
$unset: { longestRoad: 1 },
});
Expand Down

0 comments on commit 9161bd1

Please sign in to comment.