I am trying to utilise an if statement within an if statement, I would like the hero to cleave if ready, but if not to sheild himself and if not to both, then attack.
while(true) {
var enemy = hero.findNearestEnemy();
var distance = hero.distanceTo(enemy);
if (distanc < 5) {
if (hero.isReady(“cleave”)) {
hero.cleave(enemy);
}
else {
hero.shield();