Lurkers MAI: bug fix for attack error when lurker runs into ambush
If the lurker move is interrupted by an ambush, the attack action previously sometimes caused an error, because the lurker might not get to its target.
This commit is contained in:
parent
ad43d71278
commit
77f88377e7
2 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@ Version 1.12.0+dev:
|
|||
* AI:
|
||||
* Big Animals Micro AI: bug fix for units not attacking when [avoid_unit] is
|
||||
not set
|
||||
* Lurkers MAI: bug fix for attack error when lurker runs into ambush
|
||||
* Editor:
|
||||
* Fixed falcon race missing an icon due to having incorrectly-named image
|
||||
files.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
local LS = wesnoth.require "lua/location_set.lua"
|
||||
local AH = wesnoth.require "ai/lua/ai_helper.lua"
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
|
||||
local function get_lurker(cfg)
|
||||
-- We simply pick the first of the lurkers, they have no strategy
|
||||
|
@ -58,6 +59,8 @@ function ca_lurkers:execution(ai, cfg)
|
|||
|
||||
AH.movefull_stopunit(ai, lurker, dst[rand])
|
||||
if (not lurker) or (not lurker.valid) then return end
|
||||
if (not target) or (not target.valid) then return end
|
||||
if (H.distance_between(lurker.x, lurker.y, target.x, target.y) ~= 1) then return end
|
||||
|
||||
AH.checked_attack(ai, lurker, target)
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue