Hmm, the proposed syntax seems rather messy/limited. It wouldn't give any way to imply needing two out of three things, for example. What if we had the concept of multiple different requirements, and only one would be used? So for example, in the unit XML:
Single list of requirements (as we have it now):
<unit-requirements/>
<upgrade-requirements />
<resource-requirements>
<resource name="gold" amount="100" />
<resource name="stone" amount="300" />
<resource name="wood" amount="150" />
</resource-requirements>
Multiple lists of requirements:
<production-requirements>
<requirements>
<unit-requirements>
<unit name="blacksmith" />
</unit-requirements>
<upgrade-requirements />
<resource-requirements>
<resource name="gold" amount="100" />
<resource name="food" amount="1" />
</resource-requirements>
</requirements>
<requirements>
<unit-requirements>
<unit name="barracks" />
</unit-requirements>
<upgrade-requirements />
<resource-requirements>
<resource name="gold" amount="100" />
<resource name="food" amount="1" />
</resource-requirements>
</requirements>
</production-requirements>
In this above example, the unit has two separate "lists" of requirements. Both require the same resources (100 gold and 1 food), but differ in what building is needed: either a blacksmith or barracks. This system would be far more versatile: since perhaps one way to produce a unit is with an advanced upgrade, or alternatively, they can expend more resources to produce the unit (MegaGlest does not yet support
cost modifier in upgrades).
The requirements would be read from top to bottom, so if the first
<requirements> tag uses less resources but has an upgrade requirement, while the second requirements tag uses more resources but doesn't require that upgrade; the first would be checked first. If the player has that upgrade, it will use that list of requirements, while if they do not, it will try to use the second. Thus, the order of the requirements tag would be important. If the requirement tags in this example were switched in order, it wouldn't matter if you had the upgrade in question or not, since you'd always usually meet the first requirement instead (unless you don't have enough resources).
The requirements would each be shown as separate tooltips, separated by the word "OR" on a new line. So for the top example, the tooltip might say:
Requirements:
Blacksmith
100 Gold
1 Food
OR
Barracks
100 Gold
1 Food
Overall, using this type of syntax would be able to do what Ishmaru needs, without restricting the system to those simple instances, allowing future mods to be less linear.