Skip to content

Commit

Permalink
fix: max pieces incorrectly decreasing
Browse files Browse the repository at this point in the history
  • Loading branch information
kacperwyczawski committed Aug 21, 2024
1 parent 9580389 commit c5b3915
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ export default class Game {
cell.piece?.color === this.currentPlayer.color &&
cell.owner !== this.currentPlayer,
)) {
if (cell.owner === this.previousPlayer) {
this.previousPlayer.maxPieces--;
}
cell.owner = this.currentPlayer;
this.currentPlayer.maxPieces++;
this.previousPlayer.maxPieces--;
}

let winner: PlayerColor | null = null;
Expand Down

0 comments on commit c5b3915

Please sign in to comment.