Protect Unit MAI: slight adjustment of evaluation scores

and add comment about them being hardcoded.
This commit is contained in:
mattsc 2013-07-04 12:28:29 -07:00
parent 338d2f1f22
commit 7242ed59bf
2 changed files with 6 additions and 9 deletions

View file

@ -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()

View file

@ -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