Fast MAI: don't target unowned villages if AI side has no leader
Only enemy-owned villages should be targets for leaderless AI sides.
This commit is contained in:
parent
7ba550a63e
commit
053a9350a1
1 changed files with 5 additions and 0 deletions
|
@ -30,11 +30,16 @@ function ca_fast_move:execution(ai, cfg, self)
|
|||
local villages = wesnoth.get_villages()
|
||||
|
||||
-- Eliminate villages owned by a side that is not an enemy
|
||||
-- Also remove unowned villages if the AI has no leader
|
||||
for i = #villages,1,-1 do
|
||||
local owner = wesnoth.get_village_owner(villages[i][1], villages[i][2])
|
||||
if owner and (not wesnoth.is_enemy(owner, wesnoth.current.side)) then
|
||||
table.remove(villages, i)
|
||||
end
|
||||
|
||||
if (not leader) and (not owner) then
|
||||
table.remove(villages, i)
|
||||
end
|
||||
end
|
||||
|
||||
-- Add rating that is sum of inverse distances from all other villages
|
||||
|
|
Loading…
Add table
Reference in a new issue