Patrol MAI: add optional ca_score parameter

This commit is contained in:
mattsc 2013-07-04 11:51:26 -07:00
parent f8e242d5ac
commit c225c2a3e7
3 changed files with 6 additions and 2 deletions

View file

@ -10,7 +10,7 @@ return {
local patrol = wesnoth.get_units({ id = cfg.id })[1]
-- Check if unit exists as sticky BCAs are not always removed successfully
if patrol and (patrol.moves > 0) then return 300000 end
if patrol and (patrol.moves > 0) then return cfg.ca_score end
return 0
end

View file

@ -399,7 +399,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
if (not cfg.id) then
H.wml_error("[micro_ai] tag (patrol_unit) is missing required parameter: id")
end
CA_parms = { { ca_id = "mai_patrol", score = 300000, sticky = true } }
CA_parms = { { ca_id = "mai_patrol", score = cfg.ca_score or 300000, sticky = true } }
--------- Recruiting Micro AI - side-wide AI ------------------------------------
elseif (cfg.ai_type == 'recruiting') then

View file

@ -137,6 +137,7 @@
action=add
id=Konrad
ca_score=300000
waypoint_x=9,24,25
waypoint_y=21,23,15
one_time_only=yes
@ -149,6 +150,7 @@
action=add
id=patrol1
ca_score=299999
waypoint_x=14,22,22,14,14
waypoint_y=12,12,18,19,12
out_and_back=yes
@ -160,6 +162,7 @@
action=add
id=patrol2
ca_score=299998
waypoint_x=14,14,22,22
waypoint_y=12,19,18,12
attack=xxxx # don't attack anybody
@ -180,6 +183,7 @@
guardian_type=zone_guardian
id=guard1
ca_score=299997
[filter_location]
x,y=10-26,26-28
[/filter_location]