mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-07-09 05:17:45 +00:00
fix: devWeb - add a bonus point when the player answers fastest
This commit is contained in:
@@ -118,10 +118,10 @@ public class GameWS {
|
|||||||
// Compteur de clics
|
// Compteur de clics
|
||||||
player.incrementClickCount();
|
player.incrementClickCount();
|
||||||
|
|
||||||
|
boolean isRapid = false;
|
||||||
// Compteur de clics rapides
|
// Compteur de clics rapides
|
||||||
if (gameClickCount == 1 && choice != ClickChoice.TIMER_END) {
|
if (gameClickCount == 1 && choice != ClickChoice.TIMER_END) {
|
||||||
player.incrementRapidClickCount();
|
isRapid = true;
|
||||||
player.addToScore(1);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Vérifier le choix du joueur et attribuer les points
|
// Vérifier le choix du joueur et attribuer les points
|
||||||
@@ -129,17 +129,30 @@ public class GameWS {
|
|||||||
switch (choice) {
|
switch (choice) {
|
||||||
case COLOR_VALUE -> {
|
case COLOR_VALUE -> {
|
||||||
if (gameCard.equals(playerCard)) {
|
if (gameCard.equals(playerCard)) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
} else {
|
} else {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.setScore(playerScore - 1);
|
player.setScore(playerScore - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case COLOR -> {
|
case COLOR -> {
|
||||||
if (gameCard.getColor().equals(playerCard.getColor())) {
|
if (gameCard.getColor().equals(playerCard.getColor())) {
|
||||||
if (gameCard.getValue() != playerCard.getValue()) {
|
if (gameCard.getValue() != playerCard.getValue()) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
player.incrementPartialRightClickCount();
|
player.incrementPartialRightClickCount();
|
||||||
player.setScore(playerScore + 1);
|
player.setScore(playerScore + 1);
|
||||||
@@ -151,6 +164,10 @@ public class GameWS {
|
|||||||
case VALUE -> {
|
case VALUE -> {
|
||||||
if (gameCard.getValue() == playerCard.getValue()) {
|
if (gameCard.getValue() == playerCard.getValue()) {
|
||||||
if (!gameCard.getColor().equals(playerCard.getColor())) {
|
if (!gameCard.getColor().equals(playerCard.getColor())) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
} else {
|
} else {
|
||||||
@@ -163,6 +180,10 @@ public class GameWS {
|
|||||||
}
|
}
|
||||||
case NONE -> {
|
case NONE -> {
|
||||||
if (!gameCard.getColor().equals(playerCard.getColor()) && gameCard.getValue() != playerCard.getValue()) {
|
if (!gameCard.getColor().equals(playerCard.getColor()) && gameCard.getValue() != playerCard.getValue()) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
} else {
|
} else {
|
||||||
@@ -179,6 +200,10 @@ public class GameWS {
|
|||||||
switch (choice) {
|
switch (choice) {
|
||||||
case COLOR_VALUE -> {
|
case COLOR_VALUE -> {
|
||||||
if ((nbSameCard >= nbSameColor) && (nbSameCard >= nbSameValue) && (nbSameCard >= nbNone)) {
|
if ((nbSameCard >= nbSameColor) && (nbSameCard >= nbSameValue) && (nbSameCard >= nbNone)) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
} else {
|
} else {
|
||||||
@@ -191,6 +216,10 @@ public class GameWS {
|
|||||||
player.incrementPartialRightClickCount();
|
player.incrementPartialRightClickCount();
|
||||||
player.setScore(playerScore + 1);
|
player.setScore(playerScore + 1);
|
||||||
} else if ((nbSameColor > nbSameCard) && (nbSameColor >= nbSameValue) && (nbSameColor >= nbNone)) {
|
} else if ((nbSameColor > nbSameCard) && (nbSameColor >= nbSameValue) && (nbSameColor >= nbNone)) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
} else {
|
} else {
|
||||||
@@ -202,6 +231,10 @@ public class GameWS {
|
|||||||
player.incrementPartialRightClickCount();
|
player.incrementPartialRightClickCount();
|
||||||
player.setScore(playerScore + 1);
|
player.setScore(playerScore + 1);
|
||||||
} else if ((nbSameValue > nbSameCard) && (nbSameValue > nbSameColor) && (nbSameValue >= nbNone)) {
|
} else if ((nbSameValue > nbSameCard) && (nbSameValue > nbSameColor) && (nbSameValue >= nbNone)) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
} else {
|
} else {
|
||||||
@@ -210,6 +243,10 @@ public class GameWS {
|
|||||||
}
|
}
|
||||||
case NONE -> {
|
case NONE -> {
|
||||||
if ((nbNone > nbSameCard) && (nbNone >= nbSameColor) && (nbNone > nbSameValue)) {
|
if ((nbNone > nbSameCard) && (nbNone >= nbSameColor) && (nbNone > nbSameValue)) {
|
||||||
|
if (isRapid) {
|
||||||
|
player.incrementRapidClickCount();
|
||||||
|
playerScore++;
|
||||||
|
}
|
||||||
player.incrementRightClickCount();
|
player.incrementRightClickCount();
|
||||||
player.setScore(playerScore + 2);
|
player.setScore(playerScore + 2);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user