Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schema: Definition of [modify_ai] tag
Also reorder some things in [aspect] for better matching
- Loading branch information
1 parent
59e6f28
commit bf86c94
Showing
4 changed files
with
176 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,5 @@ | |
{./recruitment.cfg} | ||
{./goal.cfg} | ||
{./stage.cfg} | ||
{./modify.cfg} | ||
[/tag] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
|
||
#define AI_MODIFY_MATCH_ASPECT ASPECT TYPE | ||
[elseif] | ||
glob_on_path=aspect[{ASPECT}] | ||
[then] | ||
[tag] | ||
name="aspect" | ||
[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[*] | ||
# 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" | ||
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[*] | ||
[then] | ||
[tag] | ||
name="goal" | ||
super="$ai/goal" | ||
[/tag] | ||
[/then] | ||
[/elseif] | ||
[elseif] | ||
glob_on_path=stage[*].candidate_action[*] | ||
[then] | ||
[tag] | ||
name="candidate_action" | ||
super="$ai/$candidate_action" | ||
[/tag] | ||
[/then] | ||
[/elseif] | ||
[elseif] | ||
glob_on_path=stage[*] | ||
[then] | ||
[tag] | ||
name="stage" | ||
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[*] | ||
[then] | ||
[tag] | ||
name="recruit" | ||
super="$ai/$recruit" | ||
[/tag] | ||
[/then] | ||
[/elseif] | ||
[elseif] | ||
glob_on_path=aspect[recruitment_instructions]*.limit[*] | ||
[then] | ||
[tag] | ||
name="limit" | ||
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 caution real} | ||
{AI_MODIFY_MATCH_ASPECT leader_aggression 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 attack_depth int} | ||
{AI_MODIFY_MATCH_ASPECT recruitment_randomness int} | ||
{AI_MODIFY_MATCH_ASPECT grouping ai_grouping} | ||
{AI_MODIFY_MATCH_ASPECT advancements string_list} | ||
{AI_MODIFY_MATCH_ASPECT recruitment_more string_list} | ||
{AI_MODIFY_MATCH_ASPECT recruitment_pattern string_list} | ||
{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] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters