Skip to content

Instantly share code, notes, and snippets.

jsWarrior.turn = function(warrior) {
if(warrior.check() == "enemy") {
warrior.attack();
}
else {
warrior.lastHealth = warrior.getHealth();
while(warrior.lastHealth < 20) {
warrior.rest();
if(warrior.getHealth() < warrior.lastHealth + 2) {
break;