ai_helper: deprecate has_ability()

This commit is contained in:
mattsc 2020-01-01 20:50:32 -08:00
parent 800c943221
commit 5f05ae31d6
2 changed files with 5 additions and 2 deletions

View file

@ -1274,6 +1274,9 @@ end
function ai_helper.has_ability(unit, ability, exact_match)
-- Returns true/false depending on whether unit has the given ability type (tag name)
wesnoth.deprecated_message('ai_helper.has_ability', 3, '1.17.0', "Use unit:matches { ability_type = ability } instead.")
return unit:matches { ability_type = ability }
end

View file

@ -307,7 +307,7 @@ function ca_bottleneck_move:evaluation(cfg, data)
for _,unit in ipairs(all_units) do
-- Is this a healer or leadership unit?
local is_healer = (unit.usage == "healer")
local has_leadership = AH.has_ability(unit, "leadership")
local has_leadership = unit:matches { ability_type = "leadership" }
local on_my_territory = BD_is_my_territory:get(unit.x, unit.y)
local rating = bottleneck_get_rating(unit, unit.x, unit.y, has_leadership, is_healer, on_my_territory, data)
@ -356,7 +356,7 @@ function ca_bottleneck_move:evaluation(cfg, data)
local max_rating, best_unit, best_hex = 0
for _,unit in ipairs(units) do
local is_healer = (unit.usage == "healer")
local has_leadership = AH.has_ability(unit, "leadership")
local has_leadership = unit:matches { ability_type = "leadership" }
local on_my_territory = BD_is_my_territory:get(unit.x, unit.y)
local reach = wesnoth.find_reach(unit)