diff --git a/changelog.md b/changelog.md index f995e9e9a31f..a1f96d8c23b9 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ * Micro AIs * Add [avoid] tag functionality to Multipack Wolves, Wolves, Swarm and Goto Micro AIs * Support named locations for [micro_ai] tag location keys + * Goto and Assassin: fix MAIs not working with tunnels when using custom path finding cost functions * Experimental AI * Deprecate EXPERIMENTAL_AI macro: use ai_algorithm=experimental_ai in the [ai] tag instead * Convert to using external candidate actions diff --git a/data/ai/micro_ais/cas/ca_assassin_move.lua b/data/ai/micro_ais/cas/ca_assassin_move.lua index 9414299607d1..68eda8f35162 100644 --- a/data/ai/micro_ais/cas/ca_assassin_move.lua +++ b/data/ai/micro_ais/cas/ca_assassin_move.lua @@ -138,11 +138,11 @@ function ca_assassin_move:execution(cfg) end end - local path, cost = wesnoth.find_path(unit, target.x, target.y, - function(x, y, current_cost) + local path, cost = wesnoth.find_path(unit, target.x, target.y, { + calculate = function(x, y, current_cost) return custom_cost(x, y, unit, enemy_rating_map, prefer_map) end - ) + }) local path_map = LS.of_pairs(path) diff --git a/data/ai/micro_ais/cas/ca_goto.lua b/data/ai/micro_ais/cas/ca_goto.lua index c1425c855ca1..3de0d7004cb5 100644 --- a/data/ai/micro_ais/cas/ca_goto.lua +++ b/data/ai/micro_ais/cas/ca_goto.lua @@ -150,11 +150,11 @@ function ca_goto:execution(cfg, data) else -- Otherwise find the best path to take local path, cost if GO_avoid_map or cfg.avoid_enemies then - path, cost = wesnoth.find_path(unit, loc[1], loc[2], - function(x, y, current_cost) + path, cost = wesnoth.find_path(unit, loc[1], loc[2], { + calculate = function(x, y, current_cost) return custom_cost(x, y, unit, GO_avoid_map, enemy_map, enemy_attack_map, cfg.avoid_enemies) end - ) + }) else local enemy_at_goal if cfg.ignore_enemy_at_goal then