A few Micro AI tweaks

- For MAIs using aspects, make the facet ID more unique
- Only shallow-preparse the [micro_ai], rather than fully preparsing it
  (This is so that filters in Micro AIs can use $this_unit if needed)
This commit is contained in:
Celtic Minstrel 2016-07-15 16:08:45 -04:00
parent 01d3156d47
commit 232709ea57
4 changed files with 5 additions and 3 deletions

View file

@ -80,6 +80,8 @@ Version 1.13.4+dev:
* All looping tags now give an error if they contain no [do] tag.
(They may contain multiple [do] tags, however.)
* AiWML:
* Filters within [micro_ai] can now use $this_unit, which was previously
impossible due to the config being prematurely parsed.
* Simplified aspect syntax which works for all aspects, present and future:
* All aspects with simple values can be specified as key=value
* Except attacks, all aspects with complex values have a simple tag form

View file

@ -46,7 +46,7 @@ function wesnoth.micro_ais.wolves(cfg)
aspect = "attacks",
facet = {
name = "ai_default_rca::aspect_attacks",
id = "dont_attack",
id = "mai_wolves_" .. cfg.ca_id .. "_dont_attack",
invalidate_on_gamestate_change = "yes",
{ "filter_enemy", {
{ "not", {

View file

@ -41,7 +41,7 @@ function wesnoth.micro_ais.protect_unit(cfg)
aspect = "attacks",
facet = {
name = "ai_default_rca::aspect_attacks",
id = "dont_attack",
id = "mai_protect_" .. cfg.ca_id .. "_dont_attack",
invalidate_on_gamestate_change = "yes",
{ "filter_own", {
{ "not", {

View file

@ -19,7 +19,7 @@ wesnoth.require("ai/micro_ais/mai-defs/recruiting.lua")
function wesnoth.wml_actions.micro_ai(cfg)
local CA_path = 'ai/micro_ais/cas/'
cfg = cfg.__parsed
cfg = cfg.__shallow_parsed
-- Check that the required common keys are all present and set correctly
if (not cfg.ai_type) then H.wml_error("[micro_ai] is missing required ai_type= key") end