# HG changeset patch # User IBBoard # Date 1301428393 0 # Node ID 17d8d357467e73a8e19b5a3799a4f73a50676ca0 # Parent 2cb3bd9b11ea0446c8b82d991f1de710dfef6b99 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 diff -r 2cb3bd9b11ea -r 17d8d357467e api/Objects/Requirement/RequiresAtLeastNUnitsRequirement.cs --- 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 { /// - /// 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. /// public class RequiresAtLeastNUnitsRequirement { @@ -41,12 +41,32 @@ return this.ValidatesArmy(toArmy); } + /// + /// Adds a requirement for there to be at least minCount of a given UnitType + /// + /// + /// The unit type to require. + /// + /// + /// The minimum number of that type that must exist. + /// public void AddUnitTypeRequirement(UnitType unitType, int minCount) { requiredTypes.Add(new UnitCountRequirementData(unitType, minCount)); } /// + /// Adds a requirement for there to be one or more of a given UnitType + /// + /// + /// The unit type to require. + /// + public void AddUnitTypeRequirement (UnitType unitType) + { + AddUnitTypeRequirement(unitType, 1); + } + + /// /// Checks whether the supplied army is currently valid according to this requirement. /// ///