Mercurial > repos > snowblizz-super-API-ideas
changeset 333:17d8d357467e
Re #27: Define unit requirements
* Document methods
* Add new method that provides default "must have at least one" behaviour - "must have at least N to take unlimited" (where N is greater than 1) is probably less common
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 29 Mar 2011 19:53:13 +0000 |
parents | 2cb3bd9b11ea |
children | f56254f50ce5 |
files | api/Objects/Requirement/RequiresAtLeastNUnitsRequirement.cs |
diffstat | 1 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/api/Objects/Requirement/RequiresAtLeastNUnitsRequirement.cs Mon Mar 28 19:41:43 2011 +0000 +++ b/api/Objects/Requirement/RequiresAtLeastNUnitsRequirement.cs Tue Mar 29 19:53:13 2011 +0000 @@ -8,7 +8,7 @@ namespace IBBoard.WarFoundry.API.Objects.Requirement { /// <summary> - /// A requirement where a WarFoundryObject requires at least N units of one or more unit types before it can be taken in an army. + /// A requirement where a WarFoundryObject requires at least N units of one or more unit types before any number of that object can be taken in an army. /// </summary> public class RequiresAtLeastNUnitsRequirement { @@ -41,12 +41,32 @@ return this.ValidatesArmy(toArmy); } + /// <summary> + /// Adds a requirement for there to be at least minCount of a given UnitType + /// </summary> + /// <param name='unitType'> + /// The unit type to require. + /// </param> + /// <param name='minCount'> + /// The minimum number of that type that must exist. + /// </param> public void AddUnitTypeRequirement(UnitType unitType, int minCount) { requiredTypes.Add(new UnitCountRequirementData(unitType, minCount)); } /// <summary> + /// Adds a requirement for there to be one or more of a given UnitType + /// </summary> + /// <param name='unitType'> + /// The unit type to require. + /// </param> + public void AddUnitTypeRequirement (UnitType unitType) + { + AddUnitTypeRequirement(unitType, 1); + } + + /// <summary> /// Checks whether the supplied army is currently valid according to this requirement. /// </summary> /// <returns>