diff --git a/public/game.js b/public/game.js index 21056fc..42d9c42 100644 --- a/public/game.js +++ b/public/game.js @@ -491,24 +491,15 @@ class GameUI { } updateUI() { - // Update player stats - const p1Cells = this.map.getPlayerCells(1); - const p2Cells = this.map.getPlayerCells(2); + // Update current player stats + const currentCells = this.map.getPlayerCells(this.currentPlayer); + const currentStrength = currentCells.reduce((sum, c) => sum + c.getStrength(), 0); + const currentSupply = this.map.calculateSupply(this.currentPlayer); - const p1Strength = p1Cells.reduce((sum, c) => sum + c.getStrength(), 0); - const p2Strength = p2Cells.reduce((sum, c) => sum + c.getStrength(), 0); - - document.getElementById('player1-cells').textContent = p1Cells.length; - document.getElementById('player1-supply').textContent = this.map.calculateSupply(1); - document.getElementById('player1-strength').textContent = p1Strength; - - document.getElementById('player2-cells').textContent = p2Cells.length; - document.getElementById('player2-supply').textContent = this.map.calculateSupply(2); - document.getElementById('player2-strength').textContent = p2Strength; - - // Update active player - document.getElementById('player1-card').classList.toggle('active', this.currentPlayer === 1); - document.getElementById('player2-card').classList.toggle('active', this.currentPlayer === 2); + // Update player 1 card (only player for now) + document.getElementById('player1-cells').textContent = currentCells.length; + document.getElementById('player1-supply').textContent = currentSupply; + document.getElementById('player1-strength').textContent = currentStrength; // Update game info document.getElementById('current-turn').textContent = this.currentPlayer; @@ -522,6 +513,16 @@ class GameUI { instruction.textContent = 'Select a cell with dice to move'; } + // Update selected cell info + const cellInfo = document.getElementById('selected-cell-info'); + if (this.selectedCell) { + cellInfo.style.display = 'block'; + document.getElementById('cell-strength').textContent = this.selectedCell.getStrength(); + document.getElementById('cell-dice').textContent = this.selectedCell.dice.length; + } else { + cellInfo.style.display = 'none'; + } + // Update buttons const cancelBtn = document.getElementById('cancel-btn'); const endTurnBtn = document.getElementById('end-turn-btn'); diff --git a/public/index.html b/public/index.html index 2944d2a..81eafe0 100644 --- a/public/index.html +++ b/public/index.html @@ -36,24 +36,6 @@ -