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:
parent
f09160ae75
commit
44ceaa1874
1 changed files with 10 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue