From 8296074cb506e3e85620448a2cf466eb14c822b2 Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 14 Oct 2024 21:01:02 +0100 Subject: [PATCH] Wrap inEvent logic around each eventHandler case --- public/board.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/board.js b/public/board.js index c4d90d5..7ae31bb 100644 --- a/public/board.js +++ b/public/board.js @@ -905,7 +905,9 @@ canvas.addEventListener('contextmenu', function(event) { case 'hand': // Can be played as mana (right click for now) // Play item from boardElement hand. To boardElement mana (explanitory) - board.playMana(listPosition[itemKey], 'hand', playerId); + if(!inEvent){ + board.playMana(listPosition[itemKey], 'hand', playerId); + } break; default: break; @@ -960,7 +962,9 @@ canvas.addEventListener('click', function(event) { // TODO: Change inEvent locations, and checks elsewhere? // TODO: Make existing mechanics ECSey case 'realDeck': - board.drawACard(playerId, 1); + if(!inEvent){ + board.drawACard(playerId, 1); + } break; case 'board': // player/opponentBoard not seperated, as want to have @@ -999,7 +1003,9 @@ canvas.addEventListener('click', function(event) { break; case 'hand': // TODO: Ensure it can be played - board.playCardToBoard(listPosition[itemKey], 'hand', 'board', playerId, playerId, 1); + if(!inEvent){ + board.playCardToBoard(listPosition[itemKey], 'hand', 'board', playerId, playerId, 1); + } break; case 'shield': // If you have an attack, and click opponent shield,