Mercurial > repos > IBDev-IBBoard.WarFoundry.API
annotate api/Requirements/UnitRequirementMaxNumber.cs @ 389:121d9d1ba53c default-army-name
Re #314: Bugfix of HTML exporter that Frostlee found
author | snowblizz |
---|---|
date | Sun, 21 Nov 2010 21:53:16 +0000 |
parents | 6083010a005c |
children |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
1 // This file (UnitRequirementMaxNumber.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; | |
229
6083010a005c
Re #223: Use translations within the API
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
6 using IBBoard.Lang; |
0 | 7 using IBBoard.WarFoundry.API.Objects; |
8 | |
9 namespace IBBoard.WarFoundry.API.Requirements | |
10 { | |
11 public class UnitRequirementMaxNumber : UnitRequirement | |
12 { | |
13 private int maxUnitCount; | |
14 | |
15 public UnitRequirementMaxNumber(UnitType type, int maxNumber) : base(type) | |
16 { | |
17 maxUnitCount = maxNumber; | |
18 } | |
19 | |
20 public override string Description | |
21 { | |
229
6083010a005c
Re #223: Use translations within the API
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
22 get { return Translation.GetTranslation("requirementUnitMaxNumber", "an army can contain up to {0} units of type {1}", maxUnitCount, unitType.Name); } |
0 | 23 } |
24 | |
25 protected override AbstractFailedRequirement CanAddToArmy (Army army, UnitType type) | |
26 { | |
27 FailedUnitRequirement failed = null; | |
28 | |
29 if (army.GetUnitTypeCount(type) >= maxUnitCount) | |
30 { | |
31 failed = new FailedUnitRequirement(this); | |
32 } | |
33 | |
34 return failed; | |
35 } | |
36 | |
37 protected override AbstractFailedRequirement CanRemoveFromArmy (Army army, UnitType type) | |
38 { | |
39 return null; | |
40 } | |
41 } | |
42 } |