diff --git a/data/ai/lua/retreat.lua b/data/ai/lua/retreat.lua index c1955fa593e..16474d92161 100644 --- a/data/ai/lua/retreat.lua +++ b/data/ai/lua/retreat.lua @@ -50,7 +50,9 @@ function retreat_functions.retreat_injured_units(units, avoid_map) -- Split units into those that regenerate and those that do not local regen, regen_amounts, non_regen = {}, {}, {} for i,u in ipairs(units) do - if u.hitpoints < retreat_functions.min_hp(u) then + if (u.hitpoints < retreat_functions.min_hp(u)) + and ((not u.canrecruit) or (not ai.aspects.passive_leader)) + then if u:ability('regenerate') then -- Find the best regeneration ability and use it to estimate hp regained by regeneration local abilities = wml.get_child(u.__cfg, "abilities") diff --git a/data/ai/micro_ais/cas/ca_healer_move.lua b/data/ai/micro_ais/cas/ca_healer_move.lua index c73fc811a1b..9113483d915 100644 --- a/data/ai/micro_ais/cas/ca_healer_move.lua +++ b/data/ai/micro_ais/cas/ca_healer_move.lua @@ -19,8 +19,10 @@ function ca_healer_move:evaluation(cfg, data) local healers, healers_noMP = {}, {} for _,healer in ipairs(all_healers) do - -- For the purpose of this evaluation, guardians count as units without moves - if (healer.moves > 0) and (not healer.status.guardian) then + -- For the purpose of this evaluation, guardians count as units without moves, as do passive leaders + if (healer.moves > 0) and (not healer.status.guardian) + and ((not healer.canrecruit) or (not ai.aspects.passive_leader)) + then table.insert(healers, healer) else table.insert(healers_noMP, healer)