Mercurial > repos > IBBoard.WarFoundry.API
annotate api/Requirements/UnitRequirementMinNumber.cs @ 104:2f3cafb69799
Re #121: Migrate to AGPL license
* Update all API files to AGPL license
* Include AGPL license and remove GPL/LGPL documents
* Fix copyright dates where they're known
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 15 Aug 2009 10:36:50 +0000 |
parents | 306558904c2a |
children | 6083010a005c |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
1 // This file (UnitRequirementMinNumber.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard. |
0 | 2 // |
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
3 // 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. |
0 | 4 |
5 using System; | |
6 using IBBoard.WarFoundry.API.Objects; | |
7 | |
8 namespace IBBoard.WarFoundry.API.Requirements | |
9 { | |
10 public class UnitRequirementMinNumber : UnitRequirement | |
11 { | |
12 private int minUnitCount; | |
13 | |
14 public UnitRequirementMinNumber(UnitType type, int minNumber) : base(type) | |
15 { | |
16 minUnitCount = minNumber; | |
17 } | |
18 | |
19 public override string Description | |
20 { | |
21 get { return "You must include at least "+minUnitCount+" "+unitType.Name+" units in an army"; } | |
22 } | |
23 | |
24 protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type) | |
25 { | |
26 return null; | |
27 } | |
28 | |
29 protected override AbstractFailedRequirement CanRemoveFromArmy (Army army, UnitType type) | |
30 { | |
31 FailedUnitRequirement failed = null; | |
32 | |
33 if (army.GetUnitTypeCount(type) <= minUnitCount) | |
34 { | |
35 failed = new FailedUnitRequirement(this); | |
36 } | |
37 | |
38 return failed; | |
39 } | |
40 } | |
41 } |