From fdc3249496e7c2418a8ab8c7ec19b85bba3f79fb Mon Sep 17 00:00:00 2001 From: mattsc Date: Tue, 4 Sep 2018 07:16:56 -0700 Subject: [PATCH] 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. --- data/ai/micro_ais/cas/ca_herding_herd_sheep.lua | 6 +----- data/campaigns/Two_Brothers/ai/ca_muff_toras_move.lua | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/data/ai/micro_ais/cas/ca_herding_herd_sheep.lua b/data/ai/micro_ais/cas/ca_herding_herd_sheep.lua index 07f063f7fb89..e325ca766002 100644 --- a/data/ai/micro_ais/cas/ca_herding_herd_sheep.lua +++ b/data/ai/micro_ais/cas/ca_herding_herd_sheep.lua @@ -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 diff --git a/data/campaigns/Two_Brothers/ai/ca_muff_toras_move.lua b/data/campaigns/Two_Brothers/ai/ca_muff_toras_move.lua index b1efd65f010b..edf847913ff2 100644 --- a/data/campaigns/Two_Brothers/ai/ca_muff_toras_move.lua +++ b/data/campaigns/Two_Brothers/ai/ca_muff_toras_move.lua @@ -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