From 44ceaa18747e7b7e581edc30907db12413c653d7 Mon Sep 17 00:00:00 2001 From: mattsc Date: Wed, 5 Sep 2018 19:34:44 -0700 Subject: [PATCH] ai_helper: get_unit functions should only return live units Live beiing defined as in get_live_units(), that is, non-petrified units (cherry-picked from commit a7d80240f2ca11b01e14120f80cd9ecace3eaa85) --- data/ai/lua/ai_helper.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/data/ai/lua/ai_helper.lua b/data/ai/lua/ai_helper.lua index 6a53305e6ab9..08c76b746f71 100644 --- a/data/ai/lua/ai_helper.lua +++ b/data/ai/lua/ai_helper.lua @@ -901,12 +901,20 @@ end function ai_helper.get_units_with_moves(filter) -- Note: the order of the filters and the [and] tags are important for speed reasons - return wesnoth.get_units { { "and", { formula = "moves > 0" } }, { "and", filter } } + return wesnoth.get_units { + { "and", { formula = "moves > 0" } }, + { "not", { status = "petrified" } }, + { "and", filter } + } end function ai_helper.get_units_with_attacks(filter) -- Note: the order of the filters and the [and] tags are important for speed reasons - return wesnoth.get_units { { "and", { formula = "attacks_left > 0 and size(attacks) > 0" } }, { "and", filter } } + return wesnoth.get_units { + { "and", { formula = "attacks_left > 0 and size(attacks) > 0" } }, + { "not", { status = "petrified" } }, + { "and", filter } + } end function ai_helper.get_visible_units(viewing_side, filter)