[Gamebreaking Bug] attack(target) method broken in Dungeon Arena


#1

Type of Bug: Gamebreaking
Rate of reproduction: 100%
Steps to reproduce: Play any game with my code. I get an error:

Line 176, time = 6.5: Target a unit.

This is the first instance of the attack method in my code. Specifically, the line of code is:

this.attack(this.enemies[0]);

Where this.enemies is defined as:

this.enemies = this.getEnemies();

Because I wanted to make sure this was a problem with the Dungeon Arena code and not mine, I tested out some stuff:

this.say(this.enemies.length); // number is > 0 always
this.say(this.enemies[0].id); // says Ogre Base
this.attack(this.getNearest(this.getEnemies())); // fails as well

This is the first time this has ever happened in my code. It happens no matter whom I play against, and completely prevents me from playing the game. My hero is unable to attack or move as a result.

I had not changed my code between it working and getting ranked and this error occurring in my code. Regardless of what my code was, I reverted it to a known working code that I got off my repo, and it is showing the same issue. It appears to be losing me ladder games having submitted it. Again, I am 100% certain that the code I am currently simulating with is known to be working, as I have submitted this exact code more than once and not run into any issues like this (I know it is this exact code because it’s labeled as the master and has not changed since I submitted to my repo, and I have copied and submitted directly from my repo at least once).


#2

I ran those example pieces of code and they ran fine for me.

Do you have a copy of your code I can try to run?


#3

Upon further investigation, it looks like the actual line that causes this issue is this line:

this.friends = this.getFriends();

For some reason, when I set this.friends now, it breaks all of my code. It never broke any of my code before, but suddenly it’s affecting my code like above.

Did perhaps the internal implementation change to use this.friends? I would think only code changes on the game-side might affect this, since it’s a new bug.

For now I can get by just using this.getFriends() in place of each time I use this.friends, but I would still appreciate it if this was investigated.


#4

I just checked out this.friends = this.getFriends(); and it seems to be working fine for me.

What error are you getting?


#5

It wasn’t that line specifically giving me an error, it was it in conjunction with the other lines.

this.friends = this.getFriends();
this.enemies = this.getEnemies();

this.attack(this.enemies[0]);

It gives me the error I indicated above. Remove the first line and it’s fine.


#6

I did some deep digging this morning and found the problem, an interaction between the base setting this.enemies = this.getEnemies() and Tharin then calling this.getFriends() for the second time, if you can believe that:

I reverted to the old method of doing API protection for now until we can solve the issue. Thanks for the great bug report, @darksteel!