Skip to content

Commit

Permalink
Lua AIs: use ai_helper.robust_move_and_attack()
Browse files Browse the repository at this point in the history
ai_helper.robust_move_and_attack() does the stop_unit_moves automatically if the unit is at the destination hex.
  • Loading branch information
mattsc committed Sep 4, 2018
1 parent 23f3554 commit fdc3249
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 1 addition & 5 deletions data/ai/micro_ais/cas/ca_herding_herd_sheep.lua
Expand Up @@ -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
2 changes: 0 additions & 2 deletions data/campaigns/Two_Brothers/ai/ca_muff_toras_move.lua
Expand Up @@ -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
Expand Down

0 comments on commit fdc3249

Please sign in to comment.