#define AI_MODIFY_MATCH_ASPECT ASPECT TYPE [elseif] glob_on_path=aspect[{ASPECT}] [then] [tag] name="aspect" min=1 [if] # This is the best way we have to proscribe a particular value: # If it's any other value, the tag must not contain what it's supposed to. id={ASPECT} [or] {AI_FILTER_KEY_MISSING id} [/or] [then] super="$ai/$component" {AI_ASPECT_INVALIDATE} [if] {AI_ASPECT_FILTER_COMPOSITE} {AI_ASPECT_FILTER_DEFAULT} [then] super="$ai/composite_aspect~{TYPE}" [/then] [elseif] # Check for attacks next so that you can't have standard_aspect with id=attacks {AI_ASPECT_FILTER_ATTACKS} [then] super="$ai/facet~attacks" [/then] [/elseif] [elseif] {AI_ASPECT_FILTER_STANDARD} [then] super="$ai/standard_aspect~{TYPE}" [/then] [/elseif] [elseif] {AI_ASPECT_FILTER_LUA} [then] super="$ai/facet~lua" [/then] [/elseif] # TODO: Somehow give an error for any other combination [/if] [/then] [/if] [/tag] [/then] [/elseif] [elseif] glob_on_path=aspect[{ASPECT}]*.facet[*] [or] action=add glob_on_path=aspect[{ASPECT}]*.facet [/or] # Glob isn't good enough to verify that these are really just a chain of facets # Combined with the regex type validation on path though, it should be good enough [then] [tag] name="facet" min=1 super="$ai/facet~{TYPE}" [/tag] [/then] [/elseif] #enddef [tag] name="modify_ai" super="$filter_side" {SIMPLE_KEY action ai_modify_action} {SIMPLE_KEY path ai_modify_path} [if] action=delete [or] action=try_delete [/or] # Nothing extra for deleting components [elseif] glob_on_path=goal[*] [or] action=add path=goal [/or] [then] [tag] name="goal" min=1 super="$ai/goal" [/tag] [/then] [/elseif] # Candidate actions before stages because the stage glob also matches candidate action paths [elseif] glob_on_path=stage[*].candidate_action[*] [or] action=add glob_on_path=stage[*].candidate_action [/or] [then] [tag] name="candidate_action" min=1 super="$ai/$candidate_action" [/tag] [/then] [/elseif] [elseif] glob_on_path=stage[*] [or] action=add path=stage [/or] [then] [tag] name="stage" min=1 super="$ai/stage" [/tag] [/then] [/elseif] # Recruitment jobs before aspects because some could also be matched by the facet globs [elseif] glob_on_path=aspect[recruitment_instructions]*.recruit[*] [or] action=add glob_on_path=aspect[recruitment_instructions]*.recruit [/or] [then] [tag] name="recruit" min=1 super="$ai/$recruit" [/tag] [/then] [/elseif] [elseif] glob_on_path=aspect[recruitment_instructions]*.limit[*] [or] action=add glob_on_path=aspect[recruitment_instructions]*.limit [/or] [then] [tag] name="limit" min=1 super="$ai/$recruit_limit" [/tag] [/then] [/elseif] # Okay, now the hard part. Basically need two entries for every possible type of aspect! {AI_MODIFY_MATCH_ASPECT aggression real} {AI_MODIFY_MATCH_ASPECT allow_ally_villages bool} {AI_MODIFY_MATCH_ASPECT caution real} {AI_MODIFY_MATCH_ASPECT leader_aggression real} {AI_MODIFY_MATCH_ASPECT leader_value real} {AI_MODIFY_MATCH_ASPECT retreat_enemy_weight real} {AI_MODIFY_MATCH_ASPECT retreat_factor real} {AI_MODIFY_MATCH_ASPECT scout_village_targeting real} {AI_MODIFY_MATCH_ASPECT village_value real} {AI_MODIFY_MATCH_ASPECT recruitment_diversity real} {AI_MODIFY_MATCH_ASPECT leader_ignores_keep bool} {AI_MODIFY_MATCH_ASPECT passive_leader bool} {AI_MODIFY_MATCH_ASPECT passive_leader_shares_keep bool} {AI_MODIFY_MATCH_ASPECT simple_targeting bool} {AI_MODIFY_MATCH_ASPECT support_villages bool} {AI_MODIFY_MATCH_ASPECT villages_per_scout int} {AI_MODIFY_MATCH_ASPECT recruitment_randomness int} {AI_MODIFY_MATCH_ASPECT grouping grouping} {AI_MODIFY_MATCH_ASPECT advancements string} {AI_MODIFY_MATCH_ASPECT recruitment_more string} {AI_MODIFY_MATCH_ASPECT recruitment_pattern string} {AI_MODIFY_MATCH_ASPECT avoid avoid} {AI_MODIFY_MATCH_ASPECT leader_goal leader_goal} {AI_MODIFY_MATCH_ASPECT recruitment_instructions recruitment_instructions} {AI_MODIFY_MATCH_ASPECT recruitment_save_gold recruitment_save_gold} {AI_MODIFY_MATCH_ASPECT attacks attacks} [/if] [/tag]