http://bibian.ath.cx/openkore/viewtopic.php?t=37499
The new attack AI code commited was a bit buggy. I noticed the change when I upgraded my bot (that runs on v.2.0.5) to SVN 6386. While using the old version, my character gains about 900k to 1m exp per hour. With the new attack AI logic, the exp dropped down to 600k - 800k. That's quite a big downgrade.
Here are the issues I found:
- attackCheckLOS is originally intended for ranged attackers. Not many melee attackers would want LOS to be checked since they can do fine routing close to the target. However, the proposed attack logic forces ALL characters to check LOS. Also, even when attackCheckLOS is set to 0 in config.txt, LOS is still checked regardless (since the condition has an OR that supersedes the check to attackCheckLOS). I therefore reverted the attackCheckLOS code to the old working one retaining as much as possible pieces of code from the "new logic" that matters and works.
. - The @cleanMonster array is removed and the clean monsters now are inter-mixed with the @aggressives array. This destroys priority. I had to restore the @cleanMonster array back.
. - Minor bug, monsters whose mon_control flag is set to 3 are being ignored completely.
. - attackMaxDistance (originally attackDistance, but was changed by Bibian to attackMaxDistance) is being checked in the new attack logic for picking the best target. In the new logic, all monsters outside attackMaxDistance are immediately removed from the list of possible targets. There is an error of understanding attackMaxDistance here. Please note that the options attackDistance and attackMaxDistance only determines the range of normal attack, not the range of the character's capability to engage monsters. The options attackDistance and attackMaxDistance does not indicate an area within which Kore will be allowed to choose targets.
This is generally how Kore originally uses attackDistance and attackMaxDistance: after choosing a target, it checks if the monster is outside attackMaxDistance. If it is, then it will move near the target until it reach attackDistance. Then it uses normal attack. Attack skills work the same way, although in this case, Kore uses _dist for both attackDistance and attackMaxDistance. See the scenario? In the old logic, Kore can choose monsters outside attackMaxDistance. It simply moves closer to engage it.
By restricting Kore to choose targets that are only within the attackMaxDistance range, how would you think Kore will behave for melee characters that have attackMaxDistance set to 2? Obviously, it will ignore most monsters around. Kore would be lucky enough if after a teleport, it lands 2 cells away from a non-aggressive monster. Or while random-walking, it walked near an idling monster. But in most cases, it would just ignore everything else.
Therefore, I removed that check in getBestTarget().
. - Lastly, attackAuto_onlyWhenSafe is misplaced. In the new logic, it is checked for all monsters. In the old code, it is only checked for non-aggressive monsters. The old code is more reasonable since you wouldn't want Kore to just stand there and be killed by aggressive monsters when a player happens to walk by. Originally, attackAuto_onlyWhenSafe will only stop you from engaging non-aggressive monsters. You will have to continue killing aggressive ones even if players flock around you or you'll die like a stupid bot. This is reverted back to the old logic.
Thank you.