Skip to content
Snippets Groups Projects
Commit 47b4eafd authored by Hachem_Muche's avatar Hachem_Muche
Browse files

Fixed a bug in improved_tactical AI when activating draining sustains out of combat

parent 7d9287e2
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,8 @@ end)
--- Randomly use a talent, trying alternate talents if one fails (up to 5 total)
-- @param t_filter <optional> = filter passed to self:aiGetAvailableTalents to restrict talent choices
-- @param t_list, <optional, default self.talents> list of talent id's to pick from, passed to self:aiGetAvailableTalents
-- @return talent id used or false, table of remaining available talents
-- @return talent id used or false
-- @return table of remaining available talents
newAI("improved_talented", function(self, t_filter, t_list)
local log_detail = config.settings.log_detail_ai or 0
-- Find available talents
......
......@@ -576,9 +576,10 @@ newAI("use_improved_tactical", function(self, t_filter, t_list)
end
-- These checks replace those performed in aiCheckSustainedTalent for simpler AIs
-- don't turn on sustains that cannot be sustained indefinitely
-- active draining sustains may eventually be deactivated (std tactical evaluation)
if t.mode == "sustained" and t._may_drain_resources and not is_active then
local res_def, r_invert
for i, res in ipairs(t._may_drain_resources) do
for res, _ in pairs(t._may_drain_resources) do
res_def = self.resources_def[res]; r_invert = res_def.invert_values and -1 or 1
if ((self[res_def.regen_prop] or 0) - (util.getval(t[res_def.drain_prop], self, t) or 0)*r_invert)*r_invert <= 0 then
t_avail = false break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment