From a4478b4670975ee690e08587a3ae01cf890c3539 Mon Sep 17 00:00:00 2001 From: Yannis SEVRET Date: Mon, 8 Mar 2021 18:22:19 +0100 Subject: [PATCH] Ajout Malus --- SwichGIT/src/js/main.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/SwichGIT/src/js/main.js b/SwichGIT/src/js/main.js index bbbb211..f5ab210 100644 --- a/SwichGIT/src/js/main.js +++ b/SwichGIT/src/js/main.js @@ -19,6 +19,7 @@ var allModeEngl = ["Point Match", "Timer mode", "Infini", "Bac"]; // Défini tou var modelangue = false; +var offreSWISH = false; var lesPoints = 0; //Points du Joueur1 @@ -974,6 +975,8 @@ function rechargerGAME() { } function redistribuerPlateau() { + lesPoints -= 5; + document.getElementById("affPoints").textContent = 'Score : ' + lesPoints; if (selectionMode == 0) { redistribuer(); } else if (selectionMode == 1 || selectionMode == 2) { @@ -1745,6 +1748,9 @@ function chercherCombinaison() { function testPertinent() { //test(); + offreSWISH = true; + lesPoints -= 5; + document.getElementById("affPoints").textContent = 'Score : ' + lesPoints; var allComb = 0; //window.alert("Voici ce que j'ai trouvé, mais voulez vous booster mes recherches ?") console.log("===============!!!! BOOST !!!!=============") @@ -1760,7 +1766,12 @@ function testPertinent() { //console.log("J'ai tout les ensembles pour " + i + " cartes " + tabCheck.length) var tabInte = comparaisonEmpilement(tabCheck, 0); //console.log("nouveau tableau avec " + tabInte.length) - allComb += testAllEnsemble(tabInte); + var comb = 0; + comb = testAllEnsemble(tabInte); + if (comb > 0 && i >= 3) { + return; + } + allComb += comb; } console.log("nb combi : " + allComb) window.alert("Et voilà ! J'ai finis !") @@ -2281,7 +2292,11 @@ function testPourJeuInfini() { for (var i = 0; i < tab.length; i++) { if (tab[i].code == carteselect.length) { solution = false; - lesPoints += carteselect.length; + if (offreSWISH) { + offreSWISH = false; + } else { + lesPoints += carteselect.length; + } document.getElementById("affPoints").textContent = 'Score : ' + lesPoints; if (selectionDiemension == 2) { changerlesCartes3_2(); @@ -2354,7 +2369,11 @@ function testPourJeuClassique() { if (tab[i].code == carteselect.length) { solution = false; cpt = cpt + 20 * copie.length; - lesPoints += carteselect.length; + if (offreSWISH) { + offreSWISH = false; + } else { + lesPoints += carteselect.length; + } document.getElementById("affPoints").textContent = 'Score : ' + lesPoints; changerlesCartesDeTasDeJeu(); }