Introduced another approach to determine enemies position
Special thanks to @phantasmalmira for the idea and for the assets.
The bot searches for the triangles which represent the enemy type and for the level: for each finding a rectangle is drawn. An enemy is recognized as such if there is an intersection between a rectangle drawn from the enemy type and one drawn from the level: the center of this intersection is the enemy's coordinates. This should improve the reliability of enemies' search.
A new option SearchMode is introduced to either use this search method (value 1) or the old one (value 0).
Other changes
Switched from multiprocessing library to threading library.
Added get_mask_from_alpha method to Utils, which is able to calculate the mask to apply during template matching from the alpha channel of the image.
Split the find_all method into two methods: one which still uses the template resizing (find_all_with_resize) and one which doesn't (find_all).
The distance used by filter_similar_coords method is now passed as an argument.
find_closest method now uses the C implementation of KDTree.
Updated filtering method for coordinates out of the combat grid:
Instead of defining two areas of allowed values, prohibited regions are defined and if the coordinates obtained are inside one of these areas, they are discarded.
Updated retreat_handler and battle_handler.
Removed old and unused code and other minor adjustments.
Highlight
Introduced another approach to determine enemies position
Special thanks to @phantasmalmira for the idea and for the assets. The bot searches for the triangles which represent the enemy type and for the level: for each finding a rectangle is drawn. An enemy is recognized as such if there is an intersection between a rectangle drawn from the enemy type and one drawn from the level: the center of this intersection is the enemy's coordinates. This should improve the reliability of enemies' search. A new option
SearchMode
is introduced to either use this search method (value1
) or the old one (value0
).Other changes
get_mask_from_alpha
method to Utils, which is able to calculate the mask to apply during template matching from the alpha channel of the image.find_all_with_resize
) and one which doesn't (find_all
).filter_similar_coords
method is now passed as an argument.find_closest
method now uses the C implementation of KDTree.retreat_handler
andbattle_handler
.