Big Animals MAI: bug fix for units sometimes not attacking

This commit is contained in:
mattsc 2014-11-27 07:01:59 -08:00
parent cdc246930c
commit ad43d71278
2 changed files with 11 additions and 5 deletions

View file

@ -1,4 +1,7 @@
Version 1.12.0+dev:
* AI:
* Big Animals Micro AI: bug fix for units not attacking when [avoid_unit] is
not set
* Editor:
* Fixed falcon race missing an icon due to having incorrectly-named image
files.

View file

@ -23,11 +23,14 @@ function ca_big_animals:execution(ai, cfg)
-- and attack whatever is in their range (except for some units that they avoid)
local big_animals = get_big_animals(cfg)
local avoid_map = LS.of_pairs(wesnoth.get_locations { radius = 1,
{ "filter", { { "and", cfg.avoid_unit },
{ "filter_side", { { "enemy_of", { side = wesnoth.current.side } } } }
} }
})
local avoid_map = LS.create()
if cfg.avoid_unit then
avoid_map = LS.of_pairs(wesnoth.get_locations { radius = 1,
{ "filter", { { "and", cfg.avoid_unit },
{ "filter_side", { { "enemy_of", { side = wesnoth.current.side } } } }
} }
})
end
for _,unit in ipairs(big_animals) do
local goal = MAIUV.get_mai_unit_variables(unit, cfg.ai_id)