Big Animals MAI: bug fix for units sometimes not attacking
This commit is contained in:
parent
ad93493f87
commit
051644b00f
2 changed files with 10 additions and 5 deletions
|
@ -8,6 +8,8 @@ Version 1.13.0-dev:
|
|||
* Major internal refactoring done.
|
||||
* AI:
|
||||
* New Micro AI: Fast AI
|
||||
* Big Animals Micro AI: bug fix for units not attacking when [avoid_unit] is
|
||||
not set
|
||||
* Messenger Escort Micro AI: new optional parameters [filter],
|
||||
[filter_second] and invert_order=
|
||||
* Coward Micro AI: new optional key attack_if_trapped=
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue