Egoistically / ALAuto

Azur Lane bot based on azurlane-auto. Discord: https://discord.gg/vCFxDen.
Do What The F*ck You Want To Public License
104 stars 43 forks source link

Bot could mistake a reachable target as unreachable #146

Open probabilitystatistic opened 4 years ago

probabilitystatistic commented 4 years ago

I found that sometimes the bot gets stucked and keeps swiping the screen in the formation screen if the previous target is unreachable.

After checking the code, I think the bot did so because, after clicking on the reachable target, the "Unable to reach the target" dialog from a precious attempt clicking on an unreachable target has not yet disappeared and is captured by the bot, making the bot believe the present reachable target is unreachable. See the figure below:

log

A: clicking on an unreachable target and detect unreachable dialog. B: found a new target(reachable) and click on it. C: capturing the screen to read the result for the click in B, but the unreachable dialog from A has not yet disappeared. Therefore the bot thinks the reachable target in B is unreachable.

Note that it takes only 2 second from A to C so it's very likely the "unable to reach..." dialog still remains on the screen.

After C the fleet reaches the target and enter the formation screen. But the bot tries to find the position of the fleet due to the call self.get_closest_target(self.blacklist), and stucked, swiping the screen endlessly.

I think this could be avoided by requiring the bot to wait for like 1~2 second before clicking the new found target to ensure the "Unable to reach..." dialog disappear. In unable_handler within combat.py I add Utils.script_sleep(1) before each Utils.touch and now it seems to work fine.