|
|
@ -19,7 +19,8 @@ function init() { |
|
|
|
//FUNKCE
|
|
|
|
function heal() { |
|
|
|
heroHp = parseInt(heroHp) + parseInt(hodkostkou(10)); |
|
|
|
battlelog("Výlečil ses <br>"); |
|
|
|
battlelog(`<div class="alert alert-success">
|
|
|
|
Vyléčil ses </div>`); |
|
|
|
document.getElementById("heroHp").innerText = heroHp; |
|
|
|
|
|
|
|
enemyAttack(); |
|
|
@ -28,7 +29,7 @@ function heal() { |
|
|
|
|
|
|
|
function attack() { |
|
|
|
enemyHp = parseInt(enemyHp) - parseInt(heroDamage); |
|
|
|
battlelog("Zautočil jsi<br>"); |
|
|
|
battlelog('<div class="alert alert-danger">Zaútočil jsi </div>'); |
|
|
|
document.getElementById("enemyHp").innerText = enemyHp; |
|
|
|
|
|
|
|
enemyAttack(); |
|
|
@ -37,7 +38,7 @@ function attack() { |
|
|
|
|
|
|
|
function defend() { |
|
|
|
heroDefend = true; |
|
|
|
battlelog("Použil jsi obranu <br>"); |
|
|
|
battlelog('<div class="alert alert-warning">Použil jsi obranu! </div>'); |
|
|
|
gameover(); |
|
|
|
} |
|
|
|
|
|
|
@ -53,12 +54,12 @@ function luck() { |
|
|
|
|
|
|
|
function enemyAttack() { |
|
|
|
if (!heroDefend) { |
|
|
|
battlelog("nepřítel zaútočil <br>"); |
|
|
|
battlelog('<div class="alert alert-secondary">Nepřítel zaútočil </div>'); |
|
|
|
heroHp = parseInt(heroHp) - parseInt(enemyDamage); |
|
|
|
document.getElementById("heroHp").innerText = heroHp; |
|
|
|
heroDefend = false; |
|
|
|
} else { |
|
|
|
battlelog("vykryl jsi protiútok <br>"); |
|
|
|
battlelog('<div class="alert alert-primary">Vykril jsi útok </div>'); |
|
|
|
heroDefend = false; |
|
|
|
} |
|
|
|
|
|
|
|