From 3ed1be6bc87cdbc8aaa4ce243245d8bc4e2a8bb1 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 13 Oct 2024 13:28:54 +0100 Subject: [PATCH] Fix gameWin --- public/board.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/board.js b/public/board.js index 33afb46..72534cd 100644 --- a/public/board.js +++ b/public/board.js @@ -76,14 +76,14 @@ class Board{ this.drawCardsECS(); // Atop most everything atm for testing - if(this.checkGameWin == true){ + if(this.checkGameWin() == true){ this.drawWin(); } } checkGameWin(){ - // TODO: Change logic to ECSey, and move into main loop (for other win-cons besides direct attack) - //if(opponentShield.length <= 0){return true; + // If opponent shield is 0 then you win TODO: Otherwincons, check w/l for each player + if(this.remainingShieldCount(1) <= 0){return true;} return false; } @@ -758,6 +758,9 @@ class Board{ cardStatus[itemKey] = 'tapped'; // Do any other 'on tap' effects, etc. in the future } + remainingShieldCount(playerId){ + return getCurrentPositionAndLength('shield', playerId)[1]; + } } // TODO: TEMP!! Replace soon