Range bug in beginner level mobile artillery

There seems to be a small bug in mobile artillery beginner level. The range distance of the artillery unit is 30 and if an attack is made at 30, it fails with a range/distance failure. Example:


// fails:
// "{x: 45, y:60, z: 0} out of range (distance 30 / range 30)

Looks to me like a less-than check should be a less-than/equal-to check.

I guess, but it’s just a minor error. You could easily move a space closer.

As another player I’d just like to point out that I just tried this on the Mobile Artillery level and it worked for me. I wonder if someone fixed it or maybe you are looking at a different level.

If I go over to the level editor the attack component does say

return true if distance <= @attackRange

But since it is displaying toFixed(0) in the out of range error it’s hard to tell if it is a rounding error or something.

Hmm, I thought i had an idea for what might be happening: the Artillery thinks its moveXY is done when it gets very very close to (45, 30) and then tries to shoot at (45, 60) when it is still about 30.001 units away. But I just tried to reproduce it and couldn’t. Could you post the full example code you’re using, or a multiplayer link to it? It could be something even more tricky.

Sorry I took so long to reply; vacation and all. Here’s the full example:

this.moveXY(30, 26);  // Move into range
this.attackXY(46, 5);  // Shoot once in the middle of the ogres

this.moveXY(49, 36);
this.attackXY(69, 56);

this.moveXY(40, 31);
this.attackXY(50, 38);

this.moveXY(45, 30);
this.attackXY(45, 60);

this.moveXY(40, 31);
this.attackXY(43, 43);

Interestingly enough, I tried some other examples where there was a distance of 30 and could not reproduce it either. Example:

this.moveXY(49, 36);
this.attackXY(49, 66); // works fine!

So must be pretty subtle.

Cool, thanks for the example. I’ve added an issue over here in the GitHub; I think some sort of tiny leeway on the range check will do it.

Should be fixed now by one of our Archmages; let me know if you run into any more issues with it.