Experimental AI castle switch: bug fix for units on keep check
This also fixes the score assignment, with the 'break' being in the wrong part of the conditional.
This commit is contained in:
parent
bf6b66a789
commit
f528188c67
1 changed files with 4 additions and 6 deletions
|
@ -217,7 +217,7 @@ return {
|
|||
|
||||
self.data.leader_target = next_hop
|
||||
|
||||
-- if we're on a keep, wait until there are no movable units on the castle before moving off
|
||||
-- if we're on a keep, wait until there are no movable non-leader units on the castle before moving off
|
||||
self.data.leader_score = 290000
|
||||
if wesnoth.get_terrain_info(wesnoth.get_terrain(leader.x, leader.y)).keep then
|
||||
local castle = wesnoth.get_locations {
|
||||
|
@ -229,12 +229,10 @@ return {
|
|||
}
|
||||
local should_wait = false
|
||||
for i,loc in ipairs(castle) do
|
||||
local unit = wesnoth.get_unit(loc[1], loc[2])
|
||||
if (not AH.is_visible_unit(wesnoth.current.side, unit)) then
|
||||
should_wait = false
|
||||
break
|
||||
elseif unit.moves > 0 then
|
||||
local unit = wesnoth.units.get(loc[1], loc[2])
|
||||
if unit and (unit.side == wesnoth.current.side) and (not unit.canrecruit) and (unit.moves > 0) then
|
||||
should_wait = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if should_wait then
|
||||
|
|
Loading…
Add table
Reference in a new issue