")
}
function iceHit() {
var hit = alert( "You hit the enemy with ice!");
var Win = alert( "The enemy falls!");
var End = document.write( "
")
}
function elecHit() {
var hit = alert( "You hit the enemy with electricity!");
var damageDone = (e - 10);
if(enemyHP() == 0 ) {
var Win = alert( "The enemy falls!");
var End = document.write( "
")
}
}
//***Heal***
function healHero() {
var Hit = alert( "You tried healing yourself!");
if(m < 5) {
var noMP = alert( "Not enough MP!");
}
else {
m -= 5;
var healHP = Math.round(Math.random() * 50);
var tellHPHealed = alert( "You healed " + healHP + " HP!");
h += healHP;
var attackHero = alert( "The enemy attacks you!");
var hpLoseAlert = alert( "You lose " + healHP + " hp!");
h -= healHP;
}
if(h <= 0) {
var endBattle = document.write( "
GAME OVER
");
}
}
//***THE FOLLOWING IS TO SHOW ENEMY HP***
var timerIDe = null;
var timerRunninge = false;
function stopeHP(){
if(timerRunninge)
clearTimeout(timerIDe);
timerRunninge = false;
}
function showeHP() {
var eValue = e;
document.ehpf.ehp.value = eValue;
timerID = setTimeout("showeHP()",0);
timerRunninge = true;
}
//***THE FOLLOWING IS TO SHOW HERO HP***
var timerIDh = null;
var timerRunningh = false;
function stophHP(){
if(timerRunningh)
clearTimeout(timerIDh);
timerRunningh = false;
}
function showhHP() {
var hValue = h;
document.hero.hhp.value = hValue;
timerID = setTimeout("showhHP()",0);
timerRunningh = true;
}
//***THE FOLLOWING IS TO SHOW HERO MP***
var timerIDhm = null;
var timerRunninghm = false;
function stophMP(){
if(timerRunninghm)
clearTimeout(timerIDhm);
timerRunninghm = false;
}
function showhMP() {
var hmValue = m;
document.hero.hmp.value = hmValue;
timerID = setTimeout("showhMP()",0);
timerRunninghm = true;
}
//***The following displays and updates all hp and mp meters***
function showStuff() {
stophMP();
showhMP();
stophHP();
showhHP();
stopeHP();
showeHP();
}