From ce73807662c3d6094c3a1d1d63caa3b7594407a1 Mon Sep 17 00:00:00 2001 From: kmitresse Date: Wed, 12 Jun 2024 13:52:29 +0200 Subject: [PATCH] fix: devweb - Correction of comparison between gameCard and playerCard. --- .../main/java/uppa/project/web/websocket/GameWS.java | 12 +++--------- .../Projet/src/main/webapp/static/js/PlayerHand.js | 4 +--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/S2/DevWeb/Projet/src/main/java/uppa/project/web/websocket/GameWS.java b/S2/DevWeb/Projet/src/main/java/uppa/project/web/websocket/GameWS.java index 10ea533..c4f100d 100644 --- a/S2/DevWeb/Projet/src/main/java/uppa/project/web/websocket/GameWS.java +++ b/S2/DevWeb/Projet/src/main/java/uppa/project/web/websocket/GameWS.java @@ -105,7 +105,7 @@ public class GameWS { int playerScore = player.getScore(); Card gameCard = game.getDeck().getCards().get(game.getCurrentRound()); - Card playerCard = player.getDeck().getCards().get(game.getCurrentRound()); + Card playerCard = player.getDeck().getCards().get((player.getPartialRightClickCount()+player.getRightClickCount()) % player.getDeck().getCards().size()); player.setCurrentClick(choice); @@ -136,23 +136,18 @@ public class GameWS { player.incrementRightClickCount(); player.setScore(playerScore + 2); } else { - if (isRapid) { - player.incrementRapidClickCount(); - playerScore++; - } player.setScore(playerScore - 1); } } case COLOR -> { if (gameCard.getColor().equals(playerCard.getColor())) { - if (gameCard.getValue() != playerCard.getValue()) { + if (!gameCard.equals(playerCard)) { if (isRapid) { player.incrementRapidClickCount(); playerScore++; } player.incrementRightClickCount(); player.setScore(playerScore + 2); - } else { player.incrementPartialRightClickCount(); player.setScore(playerScore + 1); @@ -163,7 +158,7 @@ public class GameWS { } case VALUE -> { if (gameCard.getValue() == playerCard.getValue()) { - if (!gameCard.getColor().equals(playerCard.getColor())) { + if (!gameCard.equals(playerCard)) { if (isRapid) { player.incrementRapidClickCount(); playerScore++; @@ -207,7 +202,6 @@ public class GameWS { player.incrementRightClickCount(); player.setScore(playerScore + 2); } else { - player.setScore(playerScore - 1); } } diff --git a/S2/DevWeb/Projet/src/main/webapp/static/js/PlayerHand.js b/S2/DevWeb/Projet/src/main/webapp/static/js/PlayerHand.js index 867592b..ff71f7b 100644 --- a/S2/DevWeb/Projet/src/main/webapp/static/js/PlayerHand.js +++ b/S2/DevWeb/Projet/src/main/webapp/static/js/PlayerHand.js @@ -18,7 +18,6 @@ export default class PlayerHand {

${this.player.user.username}

${this.player.score}

-
`; @@ -29,6 +28,5 @@ export default class PlayerHand { ${textPosition === PlayerHand.TextPosition.BOTTOM ? text : ""} `; - } -} \ No newline at end of file +}