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 a7d80240f2)
This commit is contained in:
mattsc 2018-09-05 19:34:44 -07:00
parent f09160ae75
commit 44ceaa1874

View file

@ -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)