Patrol Micro AI: fix bug in the attack part of this MAI
This was an oversight dating back to the introduction of the [filter] tag as a possible parameter to this Micro AI. A part of the attack code still relied on the id= key being given, although that key is not required any more now.
This commit is contained in:
parent
8e9fcd1704
commit
e5ea7824d1
2 changed files with 6 additions and 5 deletions
|
@ -4,13 +4,14 @@ Version 1.13.0-dev:
|
|||
game had been reloaded (bug #21750). This was a general bug in the RCA AI
|
||||
mechanism and applied to other CAs as well, but it was most visible in the
|
||||
Micro AIs.
|
||||
* Patrol Micro AI: fixed bug in the attack part of this MAI
|
||||
* Campaigns:
|
||||
* The Hammer of Thursagan:
|
||||
* Fixed missing objective in 'The Court of Karrag'.
|
||||
* Language and i18n:
|
||||
* Updated translations: German, Scottish Gaelic, Slovak
|
||||
* Lua API:
|
||||
* Fix bug #21761: wesnoth.synchronize_choice will now give a warning when
|
||||
* Fix bug #21761: wesnoth.synchronize_choice will now give a warning when
|
||||
the table returned by the user-specified function is not completely valid,
|
||||
when wesnoth is running in debug mode (--debug command line flag).
|
||||
* Units:
|
||||
|
|
|
@ -63,7 +63,7 @@ function ca_patrol:execution(ai, cfg, self)
|
|||
-- If so, don't move, but attack that enemy
|
||||
local enemies = wesnoth.get_units {
|
||||
id = cfg.attack,
|
||||
{ "filter_adjacent", { id = cfg.id } },
|
||||
{ "filter_adjacent", { id = patrol.id } },
|
||||
{ "filter_side", {{ "enemy_of", { side = wesnoth.current.side } }} }
|
||||
}
|
||||
if next(enemies) then break end
|
||||
|
@ -72,7 +72,7 @@ function ca_patrol:execution(ai, cfg, self)
|
|||
local unit_on_wp = wesnoth.get_units {
|
||||
x = self.data[patrol.id..'_x'],
|
||||
y = self.data[patrol.id..'_y'],
|
||||
{ "filter_adjacent", { id = cfg.id } }
|
||||
{ "filter_adjacent", { id = patrol.id } }
|
||||
}[1]
|
||||
|
||||
for i,wp in ipairs(waypoints) do
|
||||
|
@ -133,7 +133,7 @@ function ca_patrol:execution(ai, cfg, self)
|
|||
enemies = wesnoth.get_units{
|
||||
x = waypoints[n_wp][1],
|
||||
y = waypoints[n_wp][2],
|
||||
{ "filter_adjacent", { id = cfg.id } },
|
||||
{ "filter_adjacent", { id = patrol.id } },
|
||||
{ "filter_side", {{ "enemy_of", { side = wesnoth.current.side } }} }
|
||||
}
|
||||
end
|
||||
|
@ -142,7 +142,7 @@ function ca_patrol:execution(ai, cfg, self)
|
|||
if (not next(enemies)) then
|
||||
enemies = wesnoth.get_units{
|
||||
id = cfg.attack,
|
||||
{ "filter_adjacent", { id = cfg.id } },
|
||||
{ "filter_adjacent", { id = patrol.id } },
|
||||
{ "filter_side", {{ "enemy_of", { side = wesnoth.current.side } }} }
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue