Fast Micro AI: better recovery from ambushes etc.
This is not necessary for most other Micro AIs, but this AI moves many units per execution for speed reasons. If an ambush or failed teleport or similar happens, it is better to reconsider rather than pull through with the rest of the moves.
This commit is contained in:
parent
cc6679159b
commit
93f95f1d4c
1 changed files with 3 additions and 1 deletions
|
@ -269,7 +269,9 @@ function ca_fast_move:execution(cfg)
|
|||
|
||||
if best_hex then
|
||||
local dx, dy = goal.x - best_hex[1], goal.y - best_hex[2]
|
||||
AH.robust_move_and_attack(ai, unit, best_hex, nil, { dx = dx, dy = dy })
|
||||
local move_result = AH.robust_move_and_attack(ai, unit, best_hex, nil, { dx = dx, dy = dy })
|
||||
-- If something unexpected happened, return and reconsider
|
||||
if (not move_result.ok) then return end
|
||||
end
|
||||
|
||||
-- Also remove this unit from all the tables; using table.remove is fine here
|
||||
|
|
Loading…
Add table
Reference in a new issue