mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 11:28:16 +00:00
Added attributes of the [ai]
Added the optional parameter "limit-max(number)"
This commit is contained in:
parent
58e8bc7246
commit
74b72bb846
@ -432,14 +432,14 @@
|
||||
scale_background="optional boolean" # TODO: Required 'background' defined
|
||||
story="required string translatable"
|
||||
show_title="optional boolean"
|
||||
title="optional string translatable" # Incompatible with 'show_title=yes'
|
||||
title="optional string translatable" # TODO: Incompatible with 'show_title=yes'
|
||||
music="optional string" # TODO: Can be improved to check if the music file really exists
|
||||
sound="optional string list"
|
||||
[/part]
|
||||
typescontroller="enum ai,human,null"
|
||||
[side]
|
||||
# TODO: _fog_override=...
|
||||
# TODO: _ai=...
|
||||
_ai="repeated ai"
|
||||
# TODO: _village=...
|
||||
# TODO: _unit=...
|
||||
# TODO: _leader=...
|
||||
@ -480,6 +480,34 @@
|
||||
facing="optional direction"
|
||||
# TODO: And attributes for multiplayer?
|
||||
[/side]
|
||||
typesgrouping="enum offensive,defensive,no"
|
||||
typesrecruitment_pattern="enum scout,fighter,archer,healer,mixed fighter"
|
||||
[ai]
|
||||
#TODO: _attacks=...
|
||||
#TODO: _avoid=...
|
||||
#TODO: _goal=...
|
||||
#TODO: _leader_goal=...
|
||||
|
||||
time_of_day="optional string" # TODO: Can be improved be verified if the value exists in data/core/macros/schedules.cfg
|
||||
turns="optional string" # TODO: Complex case
|
||||
ai_algorithm="optional string" # TODO: Incompatible with 'time_of_day' and/or 'turns'
|
||||
advancements="optional string list" # TODO: Can be improved be verified that the unit exists or not
|
||||
aggression="optional float limit-max(1)"
|
||||
caution="optional float"
|
||||
grouping="optional typesgrouping"
|
||||
leader_aggression="optional float"
|
||||
leader_ignores_keep="optional boolean"
|
||||
leader_value="optional float limit-lower(0)"
|
||||
passive_leader="optional boolean"
|
||||
passive_leader_shares_keep="optional boolean"
|
||||
recruitment_ignore_bad_combat="optional boolean"
|
||||
recruitment_pattern="optional typesrecruitment_pattern list"
|
||||
scout_village_targeting="optional float"
|
||||
simple_targeting="optional boolean"
|
||||
support_villages="optional boolean"
|
||||
village_value="optional float limit-lower(0)"
|
||||
villages_per_scout="optional float limit-lower(0)"
|
||||
[/ai]
|
||||
[/schema]
|
||||
|
||||
## Things that still need to be converted, in a similar format.
|
||||
|
@ -109,6 +109,15 @@ class Validator:
|
||||
if float(value) < float(number):
|
||||
self.validate_result_add(node.file, node.line, "Attribute [%s] %s%s" % (verbosename, attribute.name, gerate_message_with_pos()), "Value needs to be at least %s, found : %s" % (number, value))
|
||||
|
||||
regex_limit_max = re.compile(ur'^limit-max\((\d+.\d+|\d+)\)$')
|
||||
check_limit_max = [i for i in attribute.optionals if regex_limit_max.search(i)]
|
||||
if len(check_limit_max):
|
||||
check_limit_max = check_limit_max[0]
|
||||
number = regex_limit_max.search(check_limit_max).group(1)
|
||||
|
||||
if float(value) > float(number):
|
||||
self.validate_result_add(node.file, node.line, "Attribute [%s] %s%s" % (verbosename, attribute.name, gerate_message_with_pos()), "Value needs to be at max %s, found : %s" % (number, value))
|
||||
|
||||
regex_file_exist = re.compile(ur'^need-file-in\(([\w.\-\/]+)\)$')
|
||||
check_file_exist = [i for i in attribute.optionals if regex_file_exist.search(i)]
|
||||
if len(check_file_exist):
|
||||
|
Loading…
x
Reference in New Issue
Block a user