Mercurial > repos > IBDev-IBBoard.WarFoundry.API
changeset 365:2fed577a1ea7
Re #27: Unit requirements
* Remove old requirements
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 02 May 2011 19:30:35 +0000 |
parents | 0dd8dbe8afe9 |
children | 4993e6f7c509 |
files | API/Requirements/AbstractArmyRequirement.cs API/Requirements/AbstractFailedRequirement.cs API/Requirements/AbstractRequirement.cs API/Requirements/AbstractUnitRequirement.cs API/Requirements/Delegates.cs API/Requirements/FailedRequirement.cs API/Requirements/FailedUnitRequirement.cs API/Requirements/RequirementAND.cs API/Requirements/RequirementOR.cs API/Requirements/UnitExcludesRequirement.cs API/Requirements/UnitRequirement.cs API/Requirements/UnitRequirementItem.cs API/Requirements/UnitRequirementMaxNumber.cs API/Requirements/UnitRequirementMinNumber.cs API/Requirements/UnitRequiresAtLeastRequirement.cs IBBoard.WarFoundry.API.csproj |
diffstat | 16 files changed, 0 insertions(+), 680 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Requirements/AbstractArmyRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -// This file (AbstractArmyRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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 System.Collections.Generic; -using IBBoard.WarFoundry.API.Objects; - - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Abstract class for any requirement for adding an object to an army, e.g. adding units. - /// </summary> - public abstract class AbstractArmyRequirement : AbstractRequirement - { - protected abstract AbstractFailedRequirement CanAddToArmy(Army army); - protected abstract AbstractFailedRequirement CanRemoveFromArmy(Army army); - - public override AbstractFailedRequirement CanAddToWarFoundryObject (WarFoundryObject obj) - { - AbstractFailedRequirement fail = null; - - if (obj is Army) - { - fail = CanAddToArmy((Army)obj); - } - else - { - fail = new FailedRequirement(this); - } - - return fail; - } - - public override AbstractFailedRequirement CanRemoveFromWarFoundryObject (WarFoundryObject obj) - { - AbstractFailedRequirement fail = null; - - if (obj is Army) - { - fail = CanRemoveFromArmy((Army)obj); - } - else - { - fail = new FailedRequirement(this); - } - - return fail; - } - } -}
--- a/API/Requirements/AbstractFailedRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -// This file (AbstractFailedRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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; - -namespace IBBoard.WarFoundry.API.Requirements -{ - public abstract class AbstractFailedRequirement - { - protected AbstractRequirement failedReq; - - public AbstractFailedRequirement(AbstractRequirement req) - { - failedReq = req; - } - - public abstract string Description { get; } - } -}
--- a/API/Requirements/AbstractRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -// This file (AbstractRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// The base class for Requirements. Specific types of abstract requirement should extend this class. - /// </summary> - public abstract class AbstractRequirement - { - public abstract string Description { get; } - public abstract AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj); - public abstract AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj); - } -}
--- a/API/Requirements/AbstractUnitRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -// This file (AbstractUnitRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Base abstract class for all requirements related to adding/removing something from a Unit (e.g. adding equipment or abilities) - /// </summary> - public abstract class AbstractUnitRequirement : AbstractRequirement - { - protected abstract AbstractFailedRequirement CanAddToUnit(Unit unit); - protected abstract AbstractFailedRequirement CanRemoveFromUnit(Unit unit); - - public override AbstractFailedRequirement CanAddToWarFoundryObject (WarFoundryObject obj) - { - AbstractFailedRequirement fail = null; - - if (obj is Unit) - { - fail = CanAddToUnit((Unit)obj); - } - else - { - fail = new FailedRequirement(this); - } - - return fail; - } - - public override AbstractFailedRequirement CanRemoveFromWarFoundryObject (WarFoundryObject obj) - { - AbstractFailedRequirement fail = null; - - if (obj is Unit) - { - fail = CanRemoveFromUnit((Unit)obj); - } - else - { - fail = new FailedRequirement(this); - } - - return fail; - } - } -}
--- a/API/Requirements/Delegates.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -// This file (Delegates.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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 System.Collections.Generic; - -namespace IBBoard.WarFoundry.API.Requirements -{ - public delegate void FailedUnitRequirementDelegate(List<FailedUnitRequirement> failedRequirements); -}
--- a/API/Requirements/FailedRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -// This file (FailedRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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; - -namespace IBBoard.WarFoundry.API.Requirements -{ - public class FailedRequirement : AbstractFailedRequirement - { - public FailedRequirement(AbstractRequirement req) : base(req) - { - } - - public override string Description - { - get { return failedReq.Description; } - } - } -}
--- a/API/Requirements/FailedUnitRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -// This file (FailedUnitRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Summary description for UnitRequirement. - /// </summary> - public class FailedUnitRequirement : AbstractFailedRequirement - { - public FailedUnitRequirement(UnitRequirement requirement) : base(requirement) - { - } - - public override string Description - { - get { return failedReq.Description; } - } - - } -}
--- a/API/Requirements/RequirementAND.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -// This file (RequirementAND.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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 System.Collections.Generic; -using IBBoard.Lang; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Summary description for RequirementAND. - /// </summary> - public class RequirementAND : AbstractRequirement - { - private static string and = Translation.GetTranslation("requirementAND", "{0} and {1}"); - - private AbstractRequirement reqA, reqB; - - public RequirementAND(AbstractRequirement requirementA, AbstractRequirement requirementB) - { - reqA = requirementA; - reqB = requirementB; - } - - public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj) - { - FailedRequirement failed = null; - - if (reqA.CanAddToWarFoundryObject(obj) !=null || reqB.CanAddToWarFoundryObject(obj)!=null) - { - failed = new FailedRequirement(this); - } - - return failed; - } - - public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj) - { - FailedRequirement failed = null; - - if (reqA.CanRemoveFromWarFoundryObject(obj) !=null || reqB.CanRemoveFromWarFoundryObject(obj)!=null) - { - failed = new FailedRequirement(this); - } - - return failed; - } - - public override string Description - { - get { return String.Format(and, reqA.Description, reqB.Description); } - } - } -}
--- a/API/Requirements/RequirementOR.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -// This file (RequirementOR.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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 System.Collections.Generic; -using IBBoard.Lang; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Summary description for UnitRequirementOR. - /// </summary> - public class RequirementOR : AbstractRequirement - { - private static string or = Translation.GetTranslation("requirementOR", "{0} or {1}"); - - private AbstractRequirement reqA, reqB; - - public RequirementOR(AbstractRequirement requirementA, AbstractRequirement requirementB) - { - reqA = requirementA; - reqB = requirementB; - } - - public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj) - { - FailedRequirement failed = null; - - if (reqA.CanAddToWarFoundryObject(obj) !=null && reqB.CanAddToWarFoundryObject(obj)!=null) - { - failed = new FailedRequirement(this); - } - - return failed; - } - - public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj) - { - FailedRequirement failed = null; - - if (reqA.CanRemoveFromWarFoundryObject(obj)!=null && reqB.CanRemoveFromWarFoundryObject(obj)!=null) - { - failed = new FailedRequirement(this); - } - - return failed; - } - - public override string Description - { - get { return String.Format(or, reqA.Description, reqB.Description); } - } - } -}
--- a/API/Requirements/UnitExcludesRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -// This file (UnitExcludesRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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 System.Collections.Generic; -using System.Text; -using IBBoard.WarFoundry.API.Objects; -using IBBoard.Lang; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Summary description for UnitExcludesRequirement. - /// </summary> - public class UnitExcludesRequirement : UnitRequirement - { - private UnitRequirementItem[] excludingTypes; - - public UnitExcludesRequirement(UnitType type, UnitRequirementItem[] excludingUnitTypes) : base(type) - { - excludingTypes = excludingUnitTypes; - } - - public override string Description - { - get - { - string otherUnits = GetOtherUnitTypeNames(); - return Translation.GetTranslation("requirementUnitExcludesDescription", "{0} can only be taken if none of the following are taken: {1}", unitType.Name, otherUnits); - } - } - - private string GetOtherUnitTypeNames() - { - StringBuilder sb = new StringBuilder(); - - foreach (UnitRequirementItem req in excludingTypes) - { - sb.Append(req.UnitType.Name); - } - - return sb.ToString(); - } - - protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type) - { - FailedUnitRequirement failed = null; - - for (int i = 0; i<excludingTypes.Length; i++) - { - if (army.GetUnitTypeCount(excludingTypes[i].UnitType) > 0) - { - failed = new FailedUnitRequirement(this); - break; - } - } - - return failed; - } - - protected override AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type) - { - return null; - } - - } -}
--- a/API/Requirements/UnitRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -// This file (UnitRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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 System.Collections.Generic; -using IBBoard.WarFoundry.API; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Summary description for UnitRequirement. - /// </summary> - public abstract class UnitRequirement : AbstractArmyRequirement - { - protected UnitType unitType; - - protected UnitRequirement(UnitType requirementFor) - { - unitType = requirementFor; - } - - /// <summary> - /// Checks whether the specified unit type can be added to the specified army. Returns a <see cref="FailedRequirement"> obejct if a unit of that type cannot legally be added, or no failure (null) if it can be added. - /// </summary> - /// <param name="army"> - /// The <see cref="Army"/> that the unit should be checked for adding to - /// </param> - /// <param name="type"> - /// The <see cref="UnitType"/> that is being checked. - /// </param> - /// <returns> - /// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="UnitType"/> cannot be legally added, else <code>null</code>. - /// </returns> - protected abstract AbstractFailedRequirement CanAddToArmy(Army army, UnitType type); - - /// <summary> - /// Checks whether the specified unit can be added to the specified army. Returns a <see cref="FailedRequirement"> obejct if the unit cannot legally be added, or no failure (null) if it can be added. - /// </summary> - /// <param name="army"> - /// The <see cref="Army"/> that the unit should be checked for adding to - /// </param> - /// <param name="type"> - /// The <see cref="Unit"/> that is being checked. - /// </param> - /// <returns> - /// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="Unit"/> cannot be legally added, else <code>null</code>. - /// </returns> - protected AbstractFailedRequirement CanAddToArmy(Army army, Unit unit) - { - return CanAddToArmy(army, unit.UnitType); - } - - /// <summary> - /// Checks whether the specified unit type can be removed from the specified army. Returns a <see cref="FailedRequirement"> obejct if a unit of that type cannot legally be removed, or no failure (null) if it can be removed. - /// </summary> - /// <param name="army"> - /// The <see cref="Army"/> that the unit should be checked for adding to - /// </param> - /// <param name="type"> - /// The <see cref="UnitType"/> that is being checked. - /// </param> - /// <returns> - /// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="UnitType"/> cannot be legally added, else <code>null</code>. - /// </returns> - protected abstract AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type); - - /// <summary> - /// Checks whether the specified unit can be removed from the specified army. Returns a <see cref="FailedRequirement"> obejct if the unit cannot legally be removed, or no failure (null) if it can be removed. - /// </summary> - /// <param name="army"> - /// The <see cref="Army"/> that the unit should be checked for adding to - /// </param> - /// <param name="type"> - /// The <see cref="Unit"/> that is being checked. - /// </param> - /// <returns> - /// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="Unit"/> cannot be legally removed, else <code>null</code>. - /// </returns> - protected AbstractFailedRequirement CanRemoveFromArmy(Army army, Unit unit) - { - return CanRemoveFromArmy(army, unit.UnitType); - } - - protected override AbstractFailedRequirement CanAddToArmy(Army army) - { - return CanAddToArmy(army, unitType); - } - - protected override AbstractFailedRequirement CanRemoveFromArmy(Army army) - { - return CanRemoveFromArmy(army, unitType); - } - } -}
--- a/API/Requirements/UnitRequirementItem.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -// This file (UnitRequirementItem.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Summary description for UnitRequirementItem. - /// </summary> - public class UnitRequirementItem - { - private UnitType type; - private int requiredNum; - - public UnitRequirementItem(UnitType unitType, int reqNumber) - { - type = unitType; - requiredNum = reqNumber; - } - - public UnitRequirementItem(UnitType type) : this(type, 1) { } - - public UnitType UnitType - { - get { return type; } - } - - public int Amount - { - get { return requiredNum; } - } - } -}
--- a/API/Requirements/UnitRequirementMaxNumber.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -// This file (UnitRequirementMaxNumber.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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.Lang; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry.API.Requirements -{ - public class UnitRequirementMaxNumber : UnitRequirement - { - private int maxUnitCount; - - public UnitRequirementMaxNumber(UnitType type, int maxNumber) : base(type) - { - maxUnitCount = maxNumber; - } - - public override string Description - { - get { return Translation.GetTranslation("requirementUnitMaxNumber", "an army can contain up to {0} units of type {1}", maxUnitCount, unitType.Name); } - } - - protected override AbstractFailedRequirement CanAddToArmy (Army army, UnitType type) - { - FailedUnitRequirement failed = null; - - if (army.GetUnitTypeCount(type) >= maxUnitCount) - { - failed = new FailedUnitRequirement(this); - } - - return failed; - } - - protected override AbstractFailedRequirement CanRemoveFromArmy (Army army, UnitType type) - { - return null; - } - } -}
--- a/API/Requirements/UnitRequirementMinNumber.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -// This file (UnitRequirementMinNumber.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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.Lang; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry.API.Requirements -{ - public class UnitRequirementMinNumber : UnitRequirement - { - private int minUnitCount; - - public UnitRequirementMinNumber(UnitType type, int minNumber) : base(type) - { - minUnitCount = minNumber; - } - - public override string Description - { - get { return Translation.GetTranslation("requirementUnitMinNumber", "you must include at least {0} of {1} in an army", minUnitCount, unitType.Name); } - } - - protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type) - { - return null; - } - - protected override AbstractFailedRequirement CanRemoveFromArmy (Army army, UnitType type) - { - FailedUnitRequirement failed = null; - - if (army.GetUnitTypeCount(type) <= minUnitCount) - { - failed = new FailedUnitRequirement(this); - } - - return failed; - } - } -}
--- a/API/Requirements/UnitRequiresAtLeastRequirement.cs Sun May 01 19:17:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -// This file (UnitRequiresAtLeastRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 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 System.Collections.Generic; -using System.Text; -using IBBoard.Lang; -using IBBoard.WarFoundry.API; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry.API.Requirements -{ - /// <summary> - /// Summary description for UnitRequiresRequirement. - /// </summary> - public class UnitRequiresAtLeastRequirement : UnitRequirement - { - private UnitRequirementItem[] requiredTypes; - private String unitList; - - public UnitRequiresAtLeastRequirement(UnitType type, UnitType requiredUnitType) : this(type, new UnitRequirementItem[]{new UnitRequirementItem(requiredUnitType)}) - { - } - - public UnitRequiresAtLeastRequirement(UnitType type, UnitRequirementItem[] requiredUnitTypes) : base(type) - { - requiredTypes = requiredUnitTypes; - bool first = true; - - foreach (UnitRequirementItem req in requiredTypes) - { - string reqString = Translation.GetTranslation("requirementUnitTypeAtLeastSingle", "{1} {0}", req.UnitType.Name, req.Amount); - - if (first) - { - first = false; - unitList = reqString; - } - else - { - unitList = Translation.GetTranslation("requirementUnitTypeAtLeastJoiner", "{0}, {1}", unitList, reqString); - } - } - } - - public override string Description - { - get { return Translation.GetTranslation("requirementUnitTypeAtLeast", "the army must include at least the following units to include a unit of type {0}: {1}", unitType.Name, unitList); } - } - - protected override AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type) - { - return null; - } - - protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type) - { - FailedRequirement failure = null; - - foreach (UnitRequirementItem req in requiredTypes) - { - if (army.GetUnitTypeCount(req.UnitType) < req.Amount) - { - failure = new FailedRequirement(this); - break; - } - } - - return failure; - } - } -}
--- a/IBBoard.WarFoundry.API.csproj Sun May 01 19:17:40 2011 +0000 +++ b/IBBoard.WarFoundry.API.csproj Mon May 02 19:30:35 2011 +0000 @@ -137,21 +137,6 @@ <Compile Include="API\Objects\UnitType.cs" /> <Compile Include="API\Objects\WarFoundryObject.cs" /> <Compile Include="API\Objects\WarFoundryStagedLoadingObject.cs" /> - <Compile Include="API\Requirements\AbstractArmyRequirement.cs" /> - <Compile Include="API\Requirements\AbstractFailedRequirement.cs" /> - <Compile Include="API\Requirements\AbstractRequirement.cs" /> - <Compile Include="API\Requirements\AbstractUnitRequirement.cs" /> - <Compile Include="API\Requirements\Delegates.cs" /> - <Compile Include="API\Requirements\FailedRequirement.cs" /> - <Compile Include="API\Requirements\FailedUnitRequirement.cs" /> - <Compile Include="API\Requirements\RequirementAND.cs" /> - <Compile Include="API\Requirements\RequirementOR.cs" /> - <Compile Include="API\Requirements\UnitExcludesRequirement.cs" /> - <Compile Include="API\Requirements\UnitRequirement.cs" /> - <Compile Include="API\Requirements\UnitRequirementItem.cs" /> - <Compile Include="API\Requirements\UnitRequirementMaxNumber.cs" /> - <Compile Include="API\Requirements\UnitRequirementMinNumber.cs" /> - <Compile Include="API\Requirements\UnitRequiresAtLeastRequirement.cs" /> <Compile Include="API\Savers\IWarFoundryFileSaver.cs" /> <Compile Include="API\Savers\WarFoundrySaver.cs" /> <Compile Include="API\Util\UnitEquipmentUtil.cs" />