Healer Support Micro AI: add optional SUF for healers

If set, only units passing this filter and having the healing ability
are used as healers.
This commit is contained in:
mattsc 2013-05-01 07:30:45 -07:00
parent 0b5da53da8
commit b1cef372d6
2 changed files with 5 additions and 2 deletions

View file

@ -93,12 +93,12 @@ return {
cfg = cfg or {}
local healers = wesnoth.get_units { side = wesnoth.current.side, ability = "healing",
formula = '$this_unit.moves > 0'
formula = '$this_unit.moves > 0', { "and", cfg.filter }
}
if (not healers[1]) then return 0 end
local healers_noMP = wesnoth.get_units { side = wesnoth.current.side, ability = "healing",
formula = '$this_unit.moves = 0'
formula = '$this_unit.moves = 0', { "and", cfg.filter }
}
local all_units = wesnoth.get_units{ side = wesnoth.current.side }

View file

@ -155,9 +155,12 @@ function wesnoth.wml_actions.micro_ai(cfg)
local cfg_hs = {}
if (cfg.action ~= 'delete') then
-- Optional keys
cfg = cfg.__parsed
cfg_hs.aggression = cfg.aggression or 1.0
cfg_hs.injured_units_only = cfg.injured_units_only
cfg_hs.max_threats = cfg.max_threats
cfg_hs.filter = H.get_child(cfg, "filter")
end
-- Set up the CA add/delete parameters