Mercurial > repos > snowblizz-super-API-ideas
annotate api/Requirements/UnitExcludesRequirement.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 | 3ea0ab04352b |
children | 6083010a005c |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
82
diff
changeset
|
1 // This file (UnitExcludesRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard. |
15 | 2 // |
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
82
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. |
15 | 4 |
0 | 5 using System; |
6 using System.Collections.Generic; | |
82 | 7 using IBBoard.WarFoundry.API.Objects; |
8 | |
9 namespace IBBoard.WarFoundry.API.Requirements | |
10 { | |
11 /// <summary> | |
12 /// Summary description for UnitExcludesRequirement. | |
13 /// </summary> | |
14 public class UnitExcludesRequirement : UnitRequirement | |
15 { | |
16 private UnitRequirementItem[] excludingTypes; | |
17 | |
18 public UnitExcludesRequirement(UnitType type, UnitRequirementItem[] excludingUnitTypes) : base(type) | |
19 { | |
20 excludingTypes = excludingUnitTypes; | |
21 } | |
22 | |
23 public override string Description | |
24 { | |
25 get | |
26 { | |
27 return "Some units are already included that excluded this unit"; | |
28 } | |
29 } | |
30 | |
31 protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type) | |
0 | 32 { |
82 | 33 FailedUnitRequirement failed = null; |
34 | |
35 for (int i = 0; i<excludingTypes.Length; i++) | |
36 { | |
37 if (army.GetUnitTypeCount(excludingTypes[i].UnitType) > 0) | |
38 { | |
0 | 39 failed = new FailedUnitRequirement(this); |
82 | 40 break; |
41 } | |
0 | 42 } |
43 | |
82 | 44 return failed; |
45 } | |
46 | |
47 protected override AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type) | |
48 { | |
49 return null; | |
50 } | |
51 | |
52 } | |
53 } |