mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-03 16:55:42 +00:00

The relative ranking of the CA scores is not changed, except for one case when two CAs had the same score. Reasons: - All scores should be lower than the scores of the default Goto CA (200,000) and the default scores of most Micro AIs (300,000). - Break tie, resulting in uncertain order of execution, of place_healers and retreat_injured CA. Healers should be placed first, to allow retreating injured units to adjacent hexes. - Set default for generic_recruit_engine to slightly above default AI recruiting score. That way it takes effect even if the default CA is not removed. - Increase move_to_any_enemy CA score from 1 to 1,000. It is still the lowest score that way, but allows for setting up custom CAs with even lower scores (even if it is just for end-of-turn statistics or the like). (cherry-picked from commit 35ba82050954c2cee86321e05d6706993c08e143)
26 lines
823 B
Lua
26 lines
823 B
Lua
------- Place Healers CA --------------
|
|
|
|
local AH = wesnoth.require "ai/lua/ai_helper.lua"
|
|
local HS = wesnoth.require "ai/micro_ais/cas/ca_healer_move.lua"
|
|
|
|
local ca_place_healers = {}
|
|
|
|
function ca_place_healers:evaluation(cfg, data)
|
|
local start_time, ca_name = wesnoth.get_time_stamp() / 1000., 'place_healers'
|
|
if AH.print_eval() then AH.print_ts(' - Evaluating place_healers CA:') end
|
|
|
|
if HS:evaluation(cfg, data) > 0 then
|
|
if AH.print_eval() then AH.done_eval_messages(start_time, ca_name) end
|
|
return 96000
|
|
end
|
|
if AH.print_eval() then AH.done_eval_messages(start_time, ca_name) end
|
|
return 0
|
|
end
|
|
|
|
function ca_place_healers:execution(cfg, data)
|
|
if AH.print_exec(cfg, data) then AH.print_ts(' Executing place_healers CA') end
|
|
HS:execution()
|
|
end
|
|
|
|
return ca_place_healers
|