Mercurial > repos > IBBoard.WarFoundry.API
comparison api/Requirements/UnitExcludesRequirement.cs @ 0:520818033bb6
Initial commit of WarFoundry code
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 19 Dec 2008 15:57:51 +0000 |
parents | |
children | 306558904c2a |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:520818033bb6 |
---|---|
1 using System; | |
2 using System.Collections.Generic; | |
3 using IBBoard.WarFoundry.API.Objects; | |
4 | |
5 namespace IBBoard.WarFoundry.API.Requirements | |
6 { | |
7 /// <summary> | |
8 /// Summary description for UnitExcludesRequirement. | |
9 /// </summary> | |
10 public class UnitExcludesRequirement : UnitRequirement | |
11 { | |
12 private UnitRequirementItem[] excludingTypes; | |
13 | |
14 public UnitExcludesRequirement(UnitType type, UnitRequirementItem[] excludingUnitTypes) : base(type) | |
15 { | |
16 excludingTypes = excludingUnitTypes; | |
17 } | |
18 | |
19 public override string Description | |
20 { | |
21 get | |
22 { | |
23 return "Some units are already included that excluded this unit"; | |
24 } | |
25 } | |
26 | |
27 protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type) | |
28 { | |
29 FailedUnitRequirement failed = null; | |
30 | |
31 for (int i = 0; i<excludingTypes.Length; i++) | |
32 { | |
33 if (army.GetUnitTypeCount(excludingTypes[i].UnitType) > 0) | |
34 { | |
35 failed = new FailedUnitRequirement(this); | |
36 break; | |
37 } | |
38 } | |
39 | |
40 return failed; | |
41 } | |
42 | |
43 protected override AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type) | |
44 { | |
45 return null; | |
46 } | |
47 | |
48 } | |
49 } |