changeset 326:331995582990

Re #27: Define unit requirements * First skeleton of first new style requirement
author IBBoard <dev@ibboard.co.uk>
date Sat, 26 Mar 2011 17:03:00 +0000
parents e0580a009e75
children 1c32b8a1600e
files IBBoard.WarFoundry.API.csproj api/Objects/UnitRequiresAtLeastNUnitsRequirement.cs
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/IBBoard.WarFoundry.API.csproj	Sat Mar 12 20:32:08 2011 +0000
     1.2 +++ b/IBBoard.WarFoundry.API.csproj	Sat Mar 26 17:03:00 2011 +0000
     1.3 @@ -185,6 +185,7 @@
     1.4      <Compile Include="api\Savers\Xml\WarFoundryXmlArmySaver.cs" />
     1.5      <Compile Include="api\Savers\Xml\WarFoundryXmlGameSystemSaver.cs" />
     1.6      <Compile Include="api\Savers\Xml\WarFoundryXmlFileSaver.cs" />
     1.7 +    <Compile Include="api\Objects\UnitRequiresAtLeastNUnitsRequirement.cs" />
     1.8    </ItemGroup>
     1.9    <ItemGroup>
    1.10      <Reference Include="System.Xml" />
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/api/Objects/UnitRequiresAtLeastNUnitsRequirement.cs	Sat Mar 26 17:03:00 2011 +0000
     2.3 @@ -0,0 +1,28 @@
     2.4 +// This file (UnitRequiresAtLeastNUnitsRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard
     2.5 +// 
     2.6 +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
     2.7 +using System;
     2.8 +using System.Collections.Generic;
     2.9 +using IBBoard.WarFoundry.API.Objects;
    2.10 +
    2.11 +namespace IBBoard.WarFoundry.API.Objects
    2.12 +{
    2.13 +	/// <summary>
    2.14 +	/// A requirement where a Unit requires at least N units of one or more unit types before it can be taken.
    2.15 +	/// </summary>
    2.16 +	public class UnitRequiresAtLeastNUnitsRequirement
    2.17 +	{
    2.18 +		private List<UnitType> requiredTypes;
    2.19 +
    2.20 +		public UnitRequiresAtLeastNUnitsRequirement(params UnitType[] requiredUnitTypes)
    2.21 +		{
    2.22 +			requiredTypes = new List<UnitType>(requiredUnitTypes);
    2.23 +		}
    2.24 +
    2.25 +		public bool CanAddToArmy(Unit unit, Army army)
    2.26 +		{
    2.27 +			return false;
    2.28 +		}
    2.29 +	}
    2.30 +}
    2.31 +