Lua AIs: use ai_helper.robust_move_and_attack()
ai_helper.robust_move_and_attack() does the stop_unit_moves automatically if the unit is at the destination hex.
(cherry-picked from commit fdc3249496
)
This commit is contained in:
parent
ad594688be
commit
fc6d71b023
2 changed files with 1 additions and 7 deletions
|
@ -73,11 +73,7 @@ function ca_herding_herd_sheep:execution(cfg)
|
|||
end
|
||||
end
|
||||
|
||||
if (best_hex[1] == best_dog.x) and (best_hex[2] == best_dog.y) then
|
||||
AH.checked_stopunit_moves(ai, best_dog)
|
||||
else
|
||||
AH.checked_move(ai, best_dog, best_hex[1], best_hex[2]) -- partial move only!
|
||||
end
|
||||
AH.robust_move_and_attack(ai, best_dog, best_hex, nil, { partial_move = true })
|
||||
end
|
||||
|
||||
return ca_herding_herd_sheep
|
||||
|
|
|
@ -64,8 +64,6 @@ function muff_toras_move:execution()
|
|||
|
||||
if ((go_to[1] ~= muff_toras.x) or (go_to[2] ~= muff_toras.y)) then
|
||||
AH.robust_move_and_attack(ai, muff_toras, go_to)
|
||||
else
|
||||
AH.checked_stopunit_moves(ai, muff_toras)
|
||||
end
|
||||
|
||||
-- Test whether an attack without retaliation or with little damage is possible
|
||||
|
|
Loading…
Add table
Reference in a new issue