Wizerunki bonusowych kart. Wyszarzenie pustych kart kiedy nie są wybrane. Usunięcie przycisku przydziel kiedy zdejmujemy żetony i są mniej niż 2 dwa żetony złota, srebra albo diamentu.
This commit is contained in:
15
js/script.js
15
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
|
||||
|
||||
Reference in New Issue
Block a user