-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" /> | ||
<link rel="stylesheet" href="https://araujozb.github.io/wardice/style.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<title>WarDice</title> | ||
</head> | ||
|
||
<body> | ||
<div class="limitador"> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col-md-4 offset-md-4 col-sm-6 offset-sm-3"> | ||
|
||
<div class="card my-3 shadow"> | ||
<div class="card-header"> | ||
<h2 class="m-0">WarDice</h2> | ||
</div> | ||
<div class="card-body"> | ||
<div class="form-group"> | ||
<label for="atq">Time que ataca</label> | ||
<div class="row"> | ||
<button class="btn btn-atq" style="border: none; padding: 0;" onclick="escolherTime('atq', 'azul')"> | ||
<img id="imgAtqAzul" src="https://araujozb.github.io/wardice/img/Peao-Grow-Azul.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('atq', 'vermelho')"> | ||
<img src="https://araujozb.github.io/wardice/img/Peao-Grow-Vermelho.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('atq', 'verde')"> | ||
<img src="https://araujozb.github.io/wardice/img/Peao-Grow-Verde.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('atq', 'laranja')"> | ||
<img src="https://araujozb.github.io/wardice/img/PLaranja.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('atq', 'roxo')"> | ||
<img src="https://araujozb.github.io/wardice/img/PRoxo.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('atq', 'amarelo')"> | ||
<img src="https://araujozb.github.io/wardice/img/PAmarelo.png" alt="" style="height: 52px;"> | ||
</button> | ||
|
||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="df">Time que defende</label> | ||
<div class="row"> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('df', 'azul')"> | ||
<img src="https://araujozb.github.io/wardice/img/Peao-Grow-Azul.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn active" style="border: none; padding: 0;" onclick="escolherTime('df', 'vermelho')"> | ||
<img src="https://araujozb.github.io/wardice/img/Peao-Grow-Vermelho.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('df', 'verde')"> | ||
<img src="https://araujozb.github.io/wardice/img/Peao-Grow-Verde.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('df', 'laranja')"> | ||
<img src="https://araujozb.github.io/wardice/img/PLaranja.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('df', 'roxo')"> | ||
<img src="https://araujozb.github.io/wardice/img/PRoxo.png" alt="" style="height: 52px;"> | ||
</button> | ||
<button class="btn" style="border: none; padding: 0;" onclick="escolherTime('df', 'amarelo')"> | ||
<img src="https://araujozb.github.io/wardice/img/PAmarelo.png" alt="" style="height: 52px;"> | ||
</button> | ||
|
||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="qntAtq">Quantidade de dados do ataque</label> | ||
<input type="number" id="qntAtq" min="1" max="3" value="1" class="form-control" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="qntDf">Quantidade de dados da defesa</label> | ||
<input type="number" id="qntDf" min="1" max="3" value="1" class="form-control" /> | ||
</div> | ||
<button type="button" class="btn btn-primary" onclick="jogar()">Jogar dados</button> | ||
<div id="result"></div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="https://araujozb.github.io/wardice/index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
let atqColor = ""; | ||
let dfColor = ""; | ||
|
||
function escolherTime(tipo, cor) { | ||
|
||
if (tipo === 'atq') { | ||
atqColor = cor; | ||
} else if (tipo === 'df') { | ||
dfColor = cor; | ||
} | ||
console.log(atqColor); | ||
console.log(dfColor); | ||
} | ||
function jogar(){ | ||
let atq = atqColor; | ||
let df = dfColor; | ||
let qntAtq = parseInt(document.getElementById("qntAtq").value); | ||
let qntDf = parseInt(document.getElementById("qntDf").value); | ||
|
||
|
||
let dadosAtq = GerarDado(qntAtq); | ||
let dadosDf = GerarDado(qntDf); | ||
|
||
dadosAtq.sort((a, b) => b - a); | ||
dadosDf.sort((a, b) => b - a); | ||
|
||
let pAtq = 0; | ||
let pDf = 0; | ||
|
||
const menor = dadosDf.length >= dadosAtq.length ? dadosAtq : dadosDf; | ||
|
||
for (let i = 0; i < menor.length; i++) { | ||
if (dadosAtq[i] > dadosDf[i]) { | ||
pAtq++; | ||
} else { | ||
pDf++; | ||
} | ||
} | ||
|
||
let result = document.getElementById("result"); | ||
result.innerHTML = `<p>${pAtq > pDf ? atq : df} venceu!</p> <p>Dados do ${atq}: ${dadosAtq.join(', ')}</p> <p>Dados do ${df}: ${dadosDf.join(', ')}</p>`; | ||
|
||
} | ||
function GerarDado(qnt){ | ||
let dado = []; | ||
for(let i = 0; i < qnt; i++){ | ||
dado.push(Math.floor(Math.random() * 6) + 1); | ||
} | ||
return dado; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.limitador { | ||
max-width: 1300px; | ||
margin: 0 auto; | ||
} | ||
|
||
img { | ||
max-width: 100%; | ||
} | ||
|