Add grouped unit limits feature#40
Conversation
fixed typo in description of Unit Limit Groups in config file
|
This all looks alright. I'd rather have one way of categorizing unit types instead of having separate unit limit groups and unit counter groups (from PR #31). It would be nice then if the mod config could take a unit group anywhere that it already takes a unit type like, for example, for perfuming. However, if we have generic unit groups, we'll also want to allow unit types to be in multiple groups, f.e. a knight ought to able to be in a "mounted" group as well as a "melee" group. Then those groups could have different limits, which would add a layer of complication to the logic here. Anyway, those are all matters for the future. This PR is fine, I'll go ahead and merge it. |
|
@maxpetul great callout on a future general grouping system! will keep that in mind for sure! I love the idea. and thanks! |

**; Here it's possible to limit how many units of each type players may build. Example:
; ["Royal Guard": 3, Champion: 1 per-city, "Heavy Tank": 3 cities-per, "Heavy Infantry": 5 + 2 per-city]
; The limits may be constant values or vary depending on city counts. In the example above, players will each be limited to 3 Royal Guards. They may
; build one Champion for each city they own. They may build one Heavy Tank for every 3 cities they own. It is also possible to combine terms with plus
; signs, as for Heavy Infantry.
; The unit limits apply to unit production by players, not all forms of unit creation. Specifically, they apply to city production, upgrading, and
; auto-production from wonders. They do not apply to all other ways units may be created including by being captured, enslaved, spawned from a razed
; city, spawned for barbarians, pre-placed in a scenario, spawned for the AI based on difficulty level, etc.
; Can also add unit_limit_groups here too in order to limit entire unit group to x amount. See "unit_limit_groups".
unit_limits = ["Infantry Units": 2]
; Unit Limit groups -- All units in the unit limit group count towards the limit. If a unit name does not exist in unit_limits,
; then unit_limits checks unit_limit_groups for group names as well. Groups are separated by commas, and units within are group
; are separated by spaces.
; For instance:
; unit_limit_groups = ["Infantry Units": "Castle Guard" "Guardian",
; "Tanks": "Light Tank" "Heavy Tank" "Panzer"]
; then in unit_limits setting (above), set a limit for the unit group:
; unit_limits = ["Infantry Units": 4, "Tanks": 3 cities-per]
unit_limit_groups = ["Infantry Units": Warrior Spearman]**