view API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactory.cs @ 372:2f8b2467ba99

Re #351: Add extensible requirement handling method * Pass unit test (assumes units are already loaded)
author IBBoard <dev@ibboard.co.uk>
date Tue, 14 Jun 2011 13:58:16 +0000
parents bfdb95906075
children e10630f39ec2
line wrap: on
line source

// This file (UnitRequiresAtLeastNUnitsRequirementFactory.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard
// 
// 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.
using System;
using IBBoard.WarFoundry.API.Objects;
using IBBoard.WarFoundry.API.Objects.Requirement;

namespace IBBoard.WarFoundry.API.Factories.Requirement
{
	public class UnitRequiresAtLeastNUnitsRequirementFactory
	{
		public UnitRequiresAtLeastNUnitsRequirementFactory()
		{
			//Do nothing special
		}

		public UnitRequiresAtLeastNUnitsRequirement CreateRequirement (UnitType type, string data)
		{
			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(type);
			req.AddUnitTypeRequirement(type.Race.GetUnitType(data));
			return req;
		}
	}
}