diff --git a/README.md b/README.md index 1d481ca..9689ae1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ Do zrobienia: - [x] wyświetlenie wszystkich żetonów dóbr istniejących w grze -- [ ] wyświetlenie bonusowych żetonów istniejących w grze (3, 4 i 5 kart) - [x] wyświetlenie żetonu wielbłąda - [x] przydzielenie żetonu wielbłąda przed wyświetleniem wyniku - [ ] rozwiązywanie sprawy z remisem @@ -16,4 +15,7 @@ Do zrobienia: - [x] zliczanie punków - [x] informowanie o zakończeniu rundy - [x] przydzielanie żetonu Maharadży -- [x] nie można wybrać więcej niż 7 monet na raz \ No newline at end of file +- [x] nie można wybrać więcej niż 7 monet na raz +- [x] minimum dwie karty złota, srebra i diamentu, bez limitu dla innych kart +- [ ] kończenie rozgrywki w przypadku braku kart +- [ ] pokazanie na przycisku przydziel że dodany zostanie bonus za dane zagranie lub nie \ No newline at end of file diff --git a/bonus3.svg b/bonus3.svg new file mode 100644 index 0000000..7a7fd0a --- /dev/null +++ b/bonus3.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/bonus4.svg b/bonus4.svg new file mode 100644 index 0000000..10fa3b9 --- /dev/null +++ b/bonus4.svg @@ -0,0 +1,95 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/bonus5.svg b/bonus5.svg new file mode 100644 index 0000000..bffe1ce --- /dev/null +++ b/bonus5.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/css/style.css b/css/style.css index cf07428..2d38818 100644 --- a/css/style.css +++ b/css/style.css @@ -10,6 +10,12 @@ .group .coin:first-child { margin: 5px 0vh 5px 0vh; } +.group .coin.blank { + opacity: 0.7; +} +.group .coin.blank.selected { + opacity: 1; +} .group .coin.selected:first-child { margin: 5px 0vh 5px -4vh; @@ -107,9 +113,9 @@ visibility: hidden; border: 2px solid dodgerblue; margin: 1.5vh auto; - width: 10vw; + max-width: 18vw; height: 5vh; - padding: 0.5vh 4vh; + padding: 0.5vh 2vw; font-weight: bold; font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; background-color: #bedfff; diff --git a/index.html b/index.html index e74ce23..40524ec 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,6 @@ var player1 = new player('Kicia', 1); var player2 = new player('Cysio', 2); jaipur = new game(player1, player2, board); - jaipur.init(); }; diff --git a/js/script.js b/js/script.js index aec9cee..53fc05f 100644 --- a/js/script.js +++ b/js/script.js @@ -135,10 +135,10 @@ function game(player1, player2, board) { console.info(jaipur.selectedCointType); if (!!jaipur.activePlayer && !!document.querySelector('.coin.selected') && ((document.querySelectorAll('.coin.selected').length >= 2 && - !!['silver', 'gold', 'diamond'].indexOf(jaipur.selectedCointType) + ['silver', 'gold', 'diamond'].indexOf(jaipur.selectedCointType) > -1 ) || ( document.querySelectorAll('.coin.selected').length >= 1 && - !!['fabric', 'spice', 'leather'].indexOf(jaipur.selectedCointType) + ['fabric', 'spice', 'leather'].indexOf(jaipur.selectedCointType) > -1 ) ) ) { @@ -181,7 +181,6 @@ function game(player1, player2, board) { } - if (jaipur.selectedCointType == this.dataset.group) { //ustawienie active inactive na wszystkich grupach @@ -198,6 +197,14 @@ function game(player1, player2, board) { //wyłaczenie selected na ostatniej wybranym żetonie document.querySelector('.coin.selected.' + this.dataset.group).classList.remove('selected'); + + //usunięcie przycisku przydziel jeśli zdejmujemy żetony i jest ich mniej wybranych niż dwa + //w przypadku złota, srebra czy diamentów + if ((document.querySelectorAll('.coin.selected').length < 2 && + ['silver', 'gold', 'diamond'].indexOf(jaipur.selectedCointType) > -1 )) { + jaipur.hideAcceptButton(); + } + //usunięcie blokady wybranego typu żetonu if (document.querySelectorAll('.coin.selected.' + this.dataset.group).length == 0) { jaipur.selectedCointType = false; @@ -210,7 +217,7 @@ function game(player1, player2, board) { } else { //jesli jest już wybranych 7 lub więcej monet to nie można więcej bo to max - if(document.querySelectorAll('.coin.selected.'+jaipur.selectedCointType).length >=7 ){ + if (document.querySelectorAll('.coin.selected.' + jaipur.selectedCointType).length >= 7) { return false; } //ustawienie selected na elemencie z kliniętej grupy