Bottleneck Micro AI: fix bug involving units without moves

An integral part of this MAI is that it moves weaker units out of the way for stronger ones.  Units without moves are taken into account by giving them a very high rating.  This was previously only done on what's considered the AI's territory (the AI side of the bottleneck) which works fine most of the time since the AI does not try to move onto enemy territory.  However, it breaks down on more open maps, where there are way for units to move around the bottleneck, as AI territory is not always well defined on them.  However, there is no need to restrict this to AI territory only.

This fixes #6599.
This commit is contained in:
mattsc 2022-06-09 06:25:54 -07:00
parent c6bf0b4245
commit e8edb5e48c

View file

@ -312,11 +312,9 @@ function ca_bottleneck_move:evaluation(cfg, data)
-- A unit that cannot move any more, (or at least cannot move out of the way)
-- must be considered to have a very high rating (it's in the best position
-- it can possibly achieve), but only if it is in own territory
if on_my_territory then
local best_move_away = bottleneck_move_out_of_way(unit, data)
if (not best_move_away) then current_rating_map:insert(unit.x, unit.y, 20000) end
end
-- it can possibly achieve)
local best_move_away = bottleneck_move_out_of_way(unit, data)
if (not best_move_away) then current_rating_map:insert(unit.x, unit.y, 20000) end
end
local enemies = AH.get_attackable_enemies()