diff --git a/data/ai/micro_ais/ais/mai_protect_unit_engine.lua b/data/ai/micro_ais/ais/mai_protect_unit_engine.lua index a23e7da6850..db15d60cbc6 100644 --- a/data/ai/micro_ais/ais/mai_protect_unit_engine.lua +++ b/data/ai/micro_ais/ais/mai_protect_unit_engine.lua @@ -155,7 +155,7 @@ return { end function engine:mai_protect_unit_move_eval(cfg) - -- Always 94000 if one of the units can still move + -- Always 94999 if one of the units can still move local units = {} for i,id in ipairs(cfg.id) do table.insert(units, wesnoth.get_units{ id = id, formula = '$this_unit.moves > 0' }[1]) @@ -174,11 +174,8 @@ return { -- W.message { speaker = "narrator", image = "wesnoth-icon.png", caption = "Parameters set to:", message = "Enemy unit weight = " .. self.data.enemy_weight .. "\nMy unit weight = " .. self.data.my_unit_weight .. "\nGoal distance weight = " .. self.data.distance_weight .. "\nTerrain defense weight = " .. self.data.terrain_weight .. "\nBearing: " .. tmp } --end - if units[1] then - return 94000 - else - return 0 - end + if units[1] then return 94999 end + return 0 end function engine:mai_protect_unit_move_exec(cfg) @@ -414,9 +411,8 @@ return { if (max_rating > -9e99) then self.data.best_attack = best_attack return 95000 - else - return 0 end + return 0 end function engine:mai_protect_unit_attack_exec() diff --git a/data/ai/micro_ais/ais/micro_ais_wml_tags.lua b/data/ai/micro_ais/ais/micro_ais_wml_tags.lua index d5d3425f641..85c597cab54 100644 --- a/data/ai/micro_ais/ais/micro_ais_wml_tags.lua +++ b/data/ai/micro_ais/ais/micro_ais_wml_tags.lua @@ -192,10 +192,11 @@ function wesnoth.wml_actions.micro_ai(cfg) --------- Protect Unit Micro AI - side-wide AI ------------------------------------ elseif (cfg.ai_type == 'protect_unit') then required_keys = { "id", "goal_x", "goal_y" } + -- Scores for this AI need to be hard-coded, it does not work otherwise CA_parms = { { ca_id = 'mai_protect_unit_finish', score = 300000 }, { ca_id = 'mai_protect_unit_attack', score = 95000 }, - { ca_id = 'mai_protect_unit_move', score = 94000 } + { ca_id = 'mai_protect_unit_move', score = 94999 } } -- [unit] tags need to be dealt with separately