Mercurial > repos > IBBoard.WarFoundry.API
annotate API/Objects/Requirement/RequiresNUnitsForMUnitsRequirement.cs @ 437:0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
* Extend unit count requirement data to handle fixed numbers of units allowed per unit required
* Add initial stub of requirement using some copy-and-paste, but starting to avoid ticket:379
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 29 Nov 2011 20:55:21 +0000 |
parents | |
children | 410f3d85c9c5 |
rev | line source |
---|---|
437
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file(RequiresNUnitsForMUnitsRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
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. |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 using System; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System.Collections.Generic; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 namespace IBBoard.WarFoundry.API.Objects.Requirement |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 public class RequiresNUnitsForMUnitsRequirement : AbstractRequirement |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 public static readonly string REQUIREMENT_ID = "RequiresNUnitsForMUnits"; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 private List<UnitCountRequirementData> requiredTypes; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 private UnitType allowedType; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 public RequiresNUnitsForMUnitsRequirement(UnitType allowedType, params UnitType[] requiredUnitTypes) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 this.allowedType = allowedType; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 FailureStringPrefix = "Army must contain: "; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 requiredTypes = new List<UnitCountRequirementData>(); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 foreach (UnitType unitType in requiredUnitTypes) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 AddUnitTypeRequirement(unitType); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 public override int GetHashCode() |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 int hash = 0; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 foreach (UnitCountRequirementData req in requiredTypes) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 hash += req.UnitType.GetHashCode(); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 return hash; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
39 protected override bool TypeEquals(object obj) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 RequiresNUnitsForMUnitsRequirement otherReq = (RequiresNUnitsForMUnitsRequirement)obj; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 if (!Collections.Collections.AreEqual(requiredTypes, otherReq.requiredTypes)) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
44 return false; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 else |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
47 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
48 return true; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
50 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
51 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 protected string FailureStringPrefix { get; set; } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
53 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
54 protected override string GetValidationFailedMessage(Army army) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
55 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
56 return ""; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
57 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
58 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
59 protected override string GetAllowsAddingFailedMessage(UnitType toAdd, Army toArmy) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
60 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
61 return ""; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
62 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
63 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
64 public override Validation AllowsAdding(WarFoundryObject wfObject, Army toArmy) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
65 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
66 Validation canAdd = Validation.NotApplicable; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
67 UnitType addedUnitType = (wfObject is Unit) ? ((Unit)wfObject).UnitType : wfObject as UnitType; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
68 bool typeFound = (addedUnitType == allowedType); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
69 int allowedTypeCount = GetUnitTypeCount(toArmy, allowedType, wfObject); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
70 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
71 foreach (UnitCountRequirementData limit in requiredTypes) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
72 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
73 typeFound |= (addedUnitType == limit.UnitType); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
74 int limitedTypeCount = GetUnitTypeCount(toArmy, limit.UnitType, wfObject); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
75 double limitedTypeMultiplier = limitedTypeCount / (limit.Count * 1.0); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
76 double allowedTypeMultiplier = allowedTypeCount / (limit.AllowsCount * 1.0); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
77 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
78 if (allowedTypeMultiplier > limitedTypeMultiplier) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
79 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
80 canAdd = Validation.Failed; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
81 break; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
82 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
84 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
85 if (typeFound && canAdd == Validation.NotApplicable) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
86 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
87 canAdd = Validation.Passed; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
88 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
89 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
90 return canAdd; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
91 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
92 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
93 private int GetUnitTypeCount(Army toArmy, UnitType unitType, WarFoundryObject wfObject) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
94 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
95 return toArmy.GetUnitTypeCount(unitType) + GetCountFromObject(wfObject, unitType); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
96 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
97 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
98 private int GetCountFromObject(WarFoundryObject wfObject, UnitType limitedType) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
99 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
100 return (limitedType.Equals(wfObject) || (wfObject is Unit && ((Unit)wfObject).UnitType.Equals(limitedType))) ? 1 : 0; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
101 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
102 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
103 public override Validation ValidatesArmy(Army army) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
104 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
105 return Validation.NotApplicable; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
106 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
107 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
108 public override string RequirementID |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
109 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
110 get |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
111 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
112 return REQUIREMENT_ID; |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
113 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
114 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
115 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
116 /// <summary> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
117 /// Adds a requirement for there to be at least minCount of a given UnitType, allowing allowedCount of this UnitType |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
118 /// </summary> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
119 /// <param name='unitType'> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
120 /// The unit type to require. |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
121 /// </param> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
122 /// <param name='minCount'> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
123 /// The minimum number of that type that must exist. |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
124 /// </param> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
125 public void AddUnitTypeRequirement(UnitType unitType, int minCount, int allowedCount) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
126 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
127 requiredTypes.Add(new UnitCountRequirementData(unitType, minCount, allowedCount)); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
128 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
129 |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
130 /// <summary> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
131 /// Adds a requirement for there to be one or more of a given UnitType, allowing one of this UnitType |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
132 /// </summary> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
133 /// <param name='unitType'> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
134 /// The unit type to require. |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
135 /// </param> |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
136 public void AddUnitTypeRequirement(UnitType unitType) |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
137 { |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
138 AddUnitTypeRequirement(unitType, 1, 1); |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
139 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
140 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
141 } |
0922851f6125
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
142 |