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:
kplaczek
2017-08-15 10:43:30 +02:00
parent 6c4fea36c2
commit a1d5c899f4
7 changed files with 308 additions and 9 deletions

View File

@@ -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
- [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

88
bonus3.svg Normal file
View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="97.414101mm"
height="100.70018mm"
viewBox="0 0 97.414101 100.70018"
version="1.1"
id="svg8"
inkscape:version="0.92.1 r15371"
sodipodi:docname="3cardbonus3.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="327.84053"
inkscape:cy="170.40039"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1600"
inkscape:window-height="837"
inkscape:window-x="1272"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0">
<inkscape:grid
type="xygrid"
id="grid4516"
originx="-21.034165"
originy="-129.61982" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-21.034166,-66.68)">
<rect
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4485"
width="29.10417"
height="47.624996"
x="21.166666"
y="66.8125" />
<rect
y="90.624992"
x="52.916664"
height="47.624996"
width="29.10417"
id="rect4520"
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4522"
width="29.10417"
height="47.624996"
x="84.666664"
y="114.4375" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

95
bonus4.svg Normal file
View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="97.414101mm"
height="100.70018mm"
viewBox="0 0 97.414101 100.70018"
version="1.1"
id="svg8"
inkscape:version="0.92.1 r15371"
sodipodi:docname="3cardbonus3.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="327.84053"
inkscape:cy="170.40039"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1600"
inkscape:window-height="837"
inkscape:window-x="1272"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0">
<inkscape:grid
type="xygrid"
id="grid4516"
originx="-21.034165"
originy="-129.61982" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-21.034166,-66.68)">
<rect
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4485"
width="29.10417"
height="47.624996"
x="34.395832"
y="66.812492" />
<rect
y="119.72916"
x="34.395832"
height="47.624996"
width="29.10417"
id="rect4520"
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4522"
width="29.10417"
height="47.624996"
x="76.729164"
y="66.8125" />
<rect
y="119.72916"
x="76.729164"
height="47.624996"
width="29.10417"
id="rect4524"
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

102
bonus5.svg Normal file
View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="97.414101mm"
height="100.70018mm"
viewBox="0 0 97.414101 100.70018"
version="1.1"
id="svg8"
inkscape:version="0.92.1 r15371"
sodipodi:docname="3cardbonus3.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="327.84053"
inkscape:cy="170.40039"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1600"
inkscape:window-height="837"
inkscape:window-x="1272"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0">
<inkscape:grid
type="xygrid"
id="grid4516"
originx="-21.034165"
originy="-129.61982" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-21.034166,-66.68)">
<rect
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4485"
width="29.10417"
height="47.624996"
x="21.166668"
y="66.8125" />
<rect
y="119.72916"
x="21.166668"
height="47.624996"
width="29.10417"
id="rect4520"
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4522"
width="29.10417"
height="47.624996"
x="89.958328"
y="66.812492" />
<rect
y="119.72916"
x="89.958328"
height="47.624996"
width="29.10417"
id="rect4524"
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="93.270828"
x="55.5625"
height="47.624996"
width="29.10417"
id="rect4526"
style="opacity:1;fill:#66a5e8;fill-opacity:1;fill-rule:evenodd;stroke:#f3c9b1;stroke-width:0.26499999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -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;

View File

@@ -28,7 +28,6 @@
var player1 = new player('Kicia', 1);
var player2 = new player('Cysio', 2);
jaipur = new game(player1, player2, board);
jaipur.init();
};

View File

@@ -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