Advanced "present" field of requirements
Posted: Wed Jun 19, 2019 6:42 pm
The idea is to make requirement mechanism more flexible without changing much. In 2.6 "present" field can be only TRUE (default: there is one in the range that conforms to the requirement) or FALSE (there is none in the range). I suggest allowing some other values:
- "all" - all items in the range must conform to the requirement. Thus,requires that every player in the alliance has a small wonder "Ecclesiastical palace".
Code: Select all
"Building", "EcclesiasticalPalace", "Alliance", "all"
- nn (a number) - exactly this number of items in the range accomplish the requirement. For example, to build a water pp, require that the city is in the middle of a river (at least so it shall work on a rectangular map):
Code: Select all
"Extra", "River", "CAdjacent", 3 "Extra", "River", "Local"
- -nn - exactly this number of items does not accomplish this. E.g. in a city effect definition
line shall mean that the effect works only if all cities that one trades with (read, except itself) are foreign.
Code: Select all
"DiplRel", "IsForeign", "Traderoute", -1
- "nn%", "-nn%" - the requirement (not) works for that part of the region (nn compared to int(n_[not_]works*100/n_total), so there is some gap).
- "[>|>=|<|<=][-]nn[%]" - generalized format of if the number of (not) accomplished requirements is greater, greater or equal etc. to a given amount or percentage. For example, let's move into the vector InspirePartisans requirement of at least citizen.partisans_pct (let it be 50) of the city must be natives (assuming that we also allowed "City" range for DiplRel to check citizens' nationalities relative to the player):
Code: Select all
"DiplRel", "IsForeign", "City", ">=50%"