|
|
@@ -83,6 +83,7 @@ function updateEaten() { |
|
|
button.innerHTML = currentFoe.struggles[i].name; |
|
|
button.innerHTML = currentFoe.struggles[i].name; |
|
|
button.addEventListener("click", function() { struggleClicked(i); } ); |
|
|
button.addEventListener("click", function() { struggleClicked(i); } ); |
|
|
button.addEventListener("mouseover", function() { struggleHovered(i); } ); |
|
|
button.addEventListener("mouseover", function() { struggleHovered(i); } ); |
|
|
|
|
|
button.addEventListener("mouseout", function() { document.getElementById("eaten-desc").innerHTML = ""; } ); |
|
|
li.appendChild(button); |
|
|
li.appendChild(button); |
|
|
list.appendChild(li); |
|
|
list.appendChild(li); |
|
|
} |
|
|
} |
|
|
@@ -102,6 +103,7 @@ function updateCombat() { |
|
|
button.innerHTML = player.attacks[i].name; |
|
|
button.innerHTML = player.attacks[i].name; |
|
|
button.addEventListener("click", function() { attackClicked(i); } ); |
|
|
button.addEventListener("click", function() { attackClicked(i); } ); |
|
|
button.addEventListener("mouseover", function() { attackHovered(i); } ); |
|
|
button.addEventListener("mouseover", function() { attackHovered(i); } ); |
|
|
|
|
|
button.addEventListener("mouseout", function() { document.getElementById("combat-desc").innerHTML = ""; } ); |
|
|
li.appendChild(button); |
|
|
li.appendChild(button); |
|
|
list.appendChild(li); |
|
|
list.appendChild(li); |
|
|
} |
|
|
} |
|
|
@@ -223,7 +225,10 @@ function generateSettings() { |
|
|
for (let i=0; i<form.length; i++) { |
|
|
for (let i=0; i<form.length; i++) { |
|
|
let value = form[i].value == "" ? form[i].placeholder : form[i].value; |
|
|
let value = form[i].value == "" ? form[i].placeholder : form[i].value; |
|
|
if (form[i].type == "text") |
|
|
if (form[i].type == "text") |
|
|
settings[form[i].name] = value; |
|
|
|
|
|
|
|
|
if (form[i].value == "") |
|
|
|
|
|
settings[form[i].name] = form[i].placeholder; |
|
|
|
|
|
else |
|
|
|
|
|
settings[form[i].name] = value; |
|
|
else if (form[i].type == "number") |
|
|
else if (form[i].type == "number") |
|
|
settings[form[i].name] = parseFloat(value); |
|
|
settings[form[i].name] = parseFloat(value); |
|
|
else if (form[i].type == "checkbox") { |
|
|
else if (form[i].type == "checkbox") { |
|
|
@@ -306,7 +311,11 @@ function attackClicked(index) { |
|
|
update(["The " + currentFoe.description() + " falls to the ground!"]); |
|
|
update(["The " + currentFoe.description() + " falls to the ground!"]); |
|
|
startDialog(new FallenFoe(currentFoe)); |
|
|
startDialog(new FallenFoe(currentFoe)); |
|
|
} else { |
|
|
} else { |
|
|
let attack = pick(currentFoe.attacks); |
|
|
|
|
|
|
|
|
let attack = pick(currentFoe.attacks.filter(attack => attack.conditions == undefined || attack.conditions.reduce((result, test) => result && test(prefs), true))); |
|
|
|
|
|
|
|
|
|
|
|
if (attack == null) { |
|
|
|
|
|
attack = currentFoe.backupAttack; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
update([attack.attackPlayer(player)]); |
|
|
update([attack.attackPlayer(player)]); |
|
|
|
|
|
|
|
|
|