This.attackRange returns 'null' for hero

this.attackRange, where this is a hero, returns null.
However, when I mouse this.attackRange, it shows a value of 5.

Just curious why I can hover over it and get the value, but when I call it, it returns null…


Could you post a screenshot?

Is this a hero where this.attackRange is available in the spell palette, or is it an undocumented property for this hero, for this level?

It’s not in the spell palette, but Dungeon Arena refers to it in Guide -> Defining Methods on this:

Defining Methods on this
You can simplify your code by adding helper methods like this:

this.findTypeInRange = function(units, type) {
for (var i = 0; i < units.length; ++i) {
var unit = units[i];
if (unit.type === type && this.distance(unit) < this.attackRange)
return unit;
return null;
var enemies = this.getEnemies();
var shaman = this.findShaman(enemies, ‘shaman’);
var brawler = this.findBrawler(enemies, ‘brawler’);

Ah, right. The ranged units have an attackRange property, but the melee units don’t (since they can only attack units that are right next to them). Actually, they do have one of 5m, but we don’t expose it, since it’s not very useful in this case. The hover debugger needs some improvement there.