Bottleneck MAI: add optional ca_score parameter

This commit is contained in:
mattsc 2013-07-04 12:06:36 -07:00
parent ff7a2590f4
commit 64b923f98f
2 changed files with 6 additions and 5 deletions

View file

@ -487,7 +487,7 @@ return {
self.data.unit = best_unit
self.data.hex = best_hex
end
return 300000
return cfg.ca_score
end
function engine:mai_bottleneck_move_exec()
@ -530,7 +530,7 @@ return {
self.data.def_map, self.data.healer_map, self.data.leadership_map, self.data.healing_map = nil, nil, nil, nil
end
function engine:mai_bottleneck_attack_eval()
function engine:mai_bottleneck_attack_eval(cfg)
-- All units with attacks_left and enemies next to them
-- This will be much easier once the 'attacks' variable is implemented
@ -593,7 +593,7 @@ return {
self.data.target = best_tar
self.data.weapon = best_weapon
end
return 290000
return cfg.ca_score
end
function engine:mai_bottleneck_attack_exec()

View file

@ -165,9 +165,10 @@ function wesnoth.wml_actions.micro_ai(cfg)
elseif (cfg.ai_type == 'bottleneck_defense') then
required_keys = { "x", "y", "enemy_x", "enemy_y" }
optional_keys = { "healer_x", "healer_y", "leadership_x", "leadership_y", "active_side_leader" }
local score = cfg.ca_score or 300000
CA_parms = {
{ ca_id = 'mai_bottleneck_move', score = 300000 },
{ ca_id = 'mai_bottleneck_attack', score = 290000 }
{ ca_id = 'mai_bottleneck_move', score = score },
{ ca_id = 'mai_bottleneck_attack', score = score - 1 }
}
--------- Messenger Escort Micro AI - side-wide AI ------------------------------------