Healer Support MAI: rename internal engine functions
No change of functionality. This is done to ensure that function names are unique, a necessary step toward making different MAIs combinable.
This commit is contained in:
parent
09bb809e73
commit
6e40d48970
2 changed files with 11 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
|
||||
local healer_support = {}
|
||||
local engine = {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local W = H.set_wml_action_metatable {}
|
||||
|
@ -17,12 +17,12 @@ return {
|
|||
|
||||
-- Set variables and aspects correctly at the beginning of the turn
|
||||
-- This will be blacklisted after first execution each turn
|
||||
function healer_support:initialize_healer_support_eval()
|
||||
function engine:mai_healer_initialize_eval()
|
||||
local score = 999990
|
||||
return score
|
||||
end
|
||||
|
||||
function healer_support:initialize_healer_support_exec(cfg)
|
||||
function engine:mai_healer_initialize_exec(cfg)
|
||||
--print(' Initializing healer_support at beginning of Turn ' .. wesnoth.current.turn)
|
||||
|
||||
-- First, modify the attacks aspect to exclude healers
|
||||
|
@ -56,12 +56,12 @@ return {
|
|||
|
||||
-- After attacks by all other units are done, reset things so that healers can attack, if desired
|
||||
-- This will be blacklisted after first execution each turn
|
||||
function healer_support:healers_can_attack_eval()
|
||||
function engine:mai_healer_may_attack_eval()
|
||||
local score = 99990
|
||||
return score
|
||||
end
|
||||
|
||||
function healer_support:healers_can_attack_exec()
|
||||
function engine:mai_healer_may_attack_exec()
|
||||
--print(' Letting healers participate in attacks from now on')
|
||||
|
||||
--local leader = wesnoth.get_units { side = wesnoth.current.side, canrecruit = 'yes' }[1]
|
||||
|
@ -82,7 +82,7 @@ return {
|
|||
|
||||
------ Place healers -----------
|
||||
|
||||
function healer_support:healer_support_eval(cfg)
|
||||
function engine:mai_healer_move_eval(cfg)
|
||||
|
||||
-- Should happen with higher priority than attacks, except at beginning of turn,
|
||||
-- when we want attacks done first
|
||||
|
@ -220,7 +220,7 @@ return {
|
|||
return 0
|
||||
end
|
||||
|
||||
function healer_support:healer_support_exec()
|
||||
function engine:mai_healer_move_exec()
|
||||
-- Only show this message in the healer_support scenario in AI-Demos
|
||||
local scenario = wesnoth.get_variable("scenario_name")
|
||||
if (scenario == 'healer_support') then
|
||||
|
@ -231,6 +231,6 @@ return {
|
|||
self.data.HS_unit, self.data.HS_hex = nil, nil
|
||||
end
|
||||
|
||||
return healer_support
|
||||
return engine
|
||||
end
|
||||
}
|
||||
|
|
|
@ -167,11 +167,11 @@ function wesnoth.wml_actions.micro_ai(cfg)
|
|||
-- Set up the CA add/delete parameters
|
||||
local CA_parms = {
|
||||
{
|
||||
id = 'initialize_healer_support', eval_name = 'initialize_healer_support_eval', exec_name = 'initialize_healer_support_exec',
|
||||
id = 'initialize_healer_support', eval_name = 'mai_healer_initialize_eval', exec_name = 'mai_healer_initialize_exec',
|
||||
max_score = 999990, cfg_table = cfg_hs
|
||||
},
|
||||
{
|
||||
id = 'healer_support', eval_name = 'healer_support_eval', exec_name = 'healer_support_exec',
|
||||
id = 'healer_support', eval_name = 'mai_healer_move_eval', exec_name = 'mai_healer_move_exec',
|
||||
max_score = 105000, cfg_table = cfg_hs
|
||||
},
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
|
|||
if (cfg.action == 'delete') or (tonumber(cfg.aggression) ~= 0) then
|
||||
table.insert(CA_parms,
|
||||
{
|
||||
id = 'healers_can_attack', eval_name = 'healers_can_attack_eval', exec_name = 'healers_can_attack_exec',
|
||||
id = 'healers_can_attack', eval_name = 'mai_healer_may_attack_eval', exec_name = 'mai_healer_may_attack_exec',
|
||||
max_score = 99990, cfg_table = {}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue