Skip to content

Commit

Permalink
Schema validation: support Micro AI named location keys
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsc committed Dec 4, 2018
1 parent dca3fe7 commit f07897c
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions data/schema/core/actionwml.cfg
Expand Up @@ -41,6 +41,21 @@
{SIMPLE_KEY gravity_hint font_gravity_hint}
#enddef

#define REQUIRED_KEYS_LOC_OR_XY KEY_BASE TYPE_LOC TYPE_XY
[if]
[not]
glob_on_{KEY_BASE}_loc=*
[/not]
[then]
{REQUIRED_KEY {KEY_BASE}_x {TYPE_XY}}
{REQUIRED_KEY {KEY_BASE}_y {TYPE_XY}}
[/then]
[else]
{REQUIRED_KEY {KEY_BASE}_loc {TYPE_LOC}}
[/else]
[/if]
#enddef

[tag]
name="$action_wml"
max=0
Expand Down Expand Up @@ -1252,8 +1267,7 @@
{FILTER_TAG "filter" unit min=1}
{FILTER_TAG "filter_second" unit min=1}
{FILTER_TAG "filter_location" location min=1}
{REQUIRED_KEY herd_x s_unsigned}
{REQUIRED_KEY herd_y s_unsigned}
{REQUIRED_KEYS_LOC_OR_XY herd string s_unsigned}
{DEFAULT_KEY attention_distance s_unsigned 8}
{DEFAULT_KEY attack_distance s_unsigned 4}
{DEFAULT_KEY ca_score s_unsigned 300000}
Expand All @@ -1262,8 +1276,7 @@
value=hunter
{FILTER_TAG "filter" unit min=1}
{DEPRECATED_KEY id string}
{REQUIRED_KEY home_x s_unsigned}
{REQUIRED_KEY home_y s_unsigned}
{REQUIRED_KEYS_LOC_OR_XY home string s_unsigned}
{DEFAULT_KEY ca_score s_unsigned 300000}
{FILTER_TAG "filter_location" location ()}
{DEFAULT_KEY rest_turns s_unsigned 3}
Expand All @@ -1284,16 +1297,27 @@
[/case]
[case]
value=bottleneck_defense
{REQUIRED_KEY x s_range_list}
{REQUIRED_KEY y s_range_list}
{REQUIRED_KEY enemy_x s_range_list}
{REQUIRED_KEY enemy_y s_range_list}
[if]
[not]
glob_on_location_id=*
[/not]
[then]
{REQUIRED_KEY x s_range_list}
{REQUIRED_KEY y s_range_list}
[/then]
[else]
{REQUIRED_KEY location_id string_list}
[/else]
[/if]
{REQUIRED_KEYS_LOC_OR_XY enemy string_list s_range_list}
{DEFAULT_KEY active_side_leader s_bool no}
{DEFAULT_KEY ca_score s_unsigned 300000}
{SIMPLE_KEY healer_x s_range_list}
{SIMPLE_KEY healer_y s_range_list}
{SIMPLE_KEY healer_loc string_list}
{SIMPLE_KEY leadership_x s_range_list}
{SIMPLE_KEY leadership_y s_range_list}
{SIMPLE_KEY leadership_loc string_list}
[/case]
[case]
value=fast_ai
Expand Down Expand Up @@ -1331,17 +1355,16 @@
{DEPRECATED_KEY id string}
{SIMPLE_KEY return_x s_unsigned}
{SIMPLE_KEY return_y s_unsigned}
{SIMPLE_KEY return_loc string}
{DEFAULT_KEY ca_score s_unsigned 100100}
[/case]
[case]
value=stationed_guardian
{FILTER_TAG "filter" unit min=1}
{DEPRECATED_KEY id string}
{REQUIRED_KEY distance s_unsigned}
{REQUIRED_KEY station_x s_unsigned}
{REQUIRED_KEY station_y s_unsigned}
{REQUIRED_KEY guard_x s_unsigned}
{REQUIRED_KEY guard_y s_unsigned}
{REQUIRED_KEYS_LOC_OR_XY station string s_unsigned}
{REQUIRED_KEYS_LOC_OR_XY guard string s_unsigned}
{DEFAULT_KEY ca_score s_unsigned 300000}
[/case]
[case]
Expand All @@ -1352,8 +1375,10 @@
{DEFAULT_KEY attack_if_trapped s_bool no}
{SIMPLE_KEY avoid_x s_unsigned}
{SIMPLE_KEY avoid_y s_unsigned}
{SIMPLE_KEY avoid_loc string}
{SIMPLE_KEY seek_x s_unsigned}
{SIMPLE_KEY seek_y s_unsigned}
{SIMPLE_KEY seek_loc string}
{DEFAULT_KEY ca_score s_unsigned 300000}
{FILTER_TAG "filter_second" unit ()}
[/case]
Expand All @@ -1365,6 +1390,7 @@
{DEFAULT_KEY ca_score s_unsigned 300000}
{SIMPLE_KEY station_x s_unsigned}
{SIMPLE_KEY station_y s_unsigned}
{SIMPLE_KEY station_loc string}
{FILTER_TAG "filter_location_enemy" location ()}
[/case]
[case]
Expand Down Expand Up @@ -1399,8 +1425,7 @@
value=messenger_escort
{FILTER_TAG "filter" unit min=1}
{DEPRECATED_KEY id string}
{REQUIRED_KEY waypoint_x s_range_list}
{REQUIRED_KEY waypoint_y s_range_list}
{REQUIRED_KEYS_LOC_OR_XY waypoint string_list s_range_list}
{DEFAULT_KEY ca_score s_unsigned 300000}
{DEFAULT_KEY enemy_death_chance s_real 0.67}
{DEFAULT_KEY messenger_death_chance s_bool 0.0}
Expand All @@ -1411,8 +1436,7 @@
value=patrol
{FILTER_TAG "filter" unit min=1}
{DEPRECATED_KEY id string}
{REQUIRED_KEY waypoint_x s_range_list}
{REQUIRED_KEY waypoint_y s_range_list}
{REQUIRED_KEYS_LOC_OR_XY waypoint string_list s_range_list}
{SIMPLE_KEY attack string_list}
{DEFAULT_KEY ca_score s_unsigned 300000}
{DEFAULT_KEY one_time_only s_bool no}
Expand All @@ -1425,8 +1449,7 @@
min=1
max=infinite
{REQUIRED_KEY id string}
{REQUIRED_KEY goal_x s_unsigned}
{REQUIRED_KEY goal_y s_unsigned}
{REQUIRED_KEYS_LOC_OR_XY goal string s_unsigned}
[/tag]
{DEFAULT_KEY disable_move_leader_to_keep s_bool no}
[/case]
Expand Down

0 comments on commit f07897c

Please sign in to comment.