Mercurial > repos > snowblizz-super-API-ideas
annotate api/Objects/UnitEquipmentItem.cs @ 82:3ea0ab04352b
* Fix line terminators
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 27 Jun 2009 18:59:49 +0000 |
parents | 284ebe05158c |
children | 46ad6f478203 |
rev | line source |
---|---|
15 | 1 // This file (UnitEquipmentItem.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard. |
2 // | |
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. | |
4 | |
82 | 5 using System; |
79
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
6 using System.Xml; |
82 | 7 using IBBoard.Lang; |
8 | |
9 namespace IBBoard.WarFoundry.API.Objects | |
10 { | |
11 /// <summary> | |
12 /// Summary description for UnitEquipmentItem. | |
13 /// </summary> | |
14 public class UnitEquipmentItem : WarFoundryObject | |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
15 { |
82 | 16 private EquipmentItem item; |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
17 private bool required; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
18 private bool roundUp; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
19 private int minNum; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
20 private int maxNum; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
21 private double minPercentage; |
79
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
22 private double maxPercentage; |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
23 private double costMultiplier; |
82 | 24 private RoundType roundType; |
25 private string mutexGroup; | |
26 private UnitType unitType; | |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
27 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
28 protected UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipForType) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
29 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
30 item = equipmentItem; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
31 EquipmentForUnit = equipForType; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
32 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
33 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
34 public override string Name |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
35 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
36 get { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
37 return item.Name; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
38 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
39 set { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
40 base.Name = value; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
41 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
42 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
43 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
44 public string EquipmentItemID |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
45 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
46 get { return item.ID; } |
82 | 47 } |
48 | |
49 public double Cost | |
50 { | |
79
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
51 get |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
52 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
53 return IBBMath.Round(EquipmentItem.Cost * CostMultiplier, CostRoundType); |
82 | 54 } |
79
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
55 } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
56 |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
57 public double CostMultiplier |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
58 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
59 get { return costMultiplier; } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
60 set |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
61 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
62 costMultiplier = value; |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
63 } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
64 } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
65 |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
66 public RoundType CostRoundType |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
67 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
68 get { return roundType; } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
69 set |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
70 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
71 roundType = value; |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
72 } |
82 | 73 } |
74 | |
75 public bool IsRequired | |
76 { | |
77 get { return required; } | |
78 set { required = value; } | |
79 } | |
80 | |
81 public bool RoundNumberUp | |
82 { | |
83 get { return roundUp; } | |
84 set { roundUp = value; } | |
85 } | |
86 | |
87 public string MutexGroup | |
88 { | |
89 get { return mutexGroup; } | |
90 set { mutexGroup = (value == null ? "" : value.Trim()); } | |
91 } | |
92 | |
93 public UnitType EquipmentForUnit | |
94 { | |
95 get { return unitType; } | |
96 set | |
97 { | |
98 if (value != null) | |
99 { | |
100 unitType = value; | |
101 } | |
102 } | |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
103 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
104 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
105 public bool IsRatioLimit |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
106 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
107 get { return minPercentage!=100 || maxPercentage!=100; } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
108 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
109 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
110 public int MinNumber |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
111 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
112 get { return minNum; } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
113 set |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
114 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
115 if (value >=0 || value == WarFoundryCore.INFINITY) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
116 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
117 minNum = value; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
118 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
119 //TODO: Check Min<Max |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
120 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
121 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
122 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
123 public int MaxNumber |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
124 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
125 get { return maxNum; } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
126 set |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
127 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
128 if (value >=0 || value == WarFoundryCore.INFINITY) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
129 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
130 maxNum = value; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
131 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
132 //TODO: Check Min<Max |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
133 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
134 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
135 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
136 public double MinPercentage |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
137 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
138 get { return minPercentage; } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
139 set |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
140 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
141 if (value >=0 && value <= 100) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
142 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
143 minPercentage = value; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
144 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
145 //TODO: Check Min<Max |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
146 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
147 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
148 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
149 public double MaxPercentage |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
150 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
151 get { return maxPercentage; } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
152 set |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
153 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
154 if (value >=0 && value <= 100) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
155 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
156 maxPercentage = value; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
157 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
158 //TODO: Check Min<Max |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
159 } |
82 | 160 } |
161 | |
162 public EquipmentItem EquipmentItem | |
163 { | |
164 get { return item; } | |
165 } | |
166 | |
167 public override string ToString() | |
168 { | |
169 return EquipmentItem.Name+ " ("+EquipmentItem.Cost+"pts each)"; | |
170 } | |
171 | |
172 public bool HasAlternatives() | |
173 { | |
174 if (MutexGroup=="") | |
175 { | |
176 return false; | |
177 } | |
178 else | |
179 { | |
180 //If the number of items in the MutEx group is greater than one then it must be this item plus another | |
181 return EquipmentForUnit.GetEquipmentItemsByExclusionGroup(MutexGroup).Length > 1; | |
182 } | |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
183 } |
79
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
184 |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
185 public ArmourType ItemArmourType |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
186 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
187 get { return EquipmentItem.ItemArmourType; } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
188 } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
189 |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
190 public string Description |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
191 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
192 get { return EquipmentItem.Description; } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
193 } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
194 |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
195 public Race EquipmentForRace |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
196 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
197 get { return EquipmentItem.EquipmentForRace; } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
198 } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
199 |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
200 public bool CanBeUsedWithItem(EquipmentItem item) |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
201 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
202 return EquipmentItem.CanBeUsedWithItem(item); |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
203 } |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
204 |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
205 public bool CanBeUsedWithArmourType(ArmourType otherItemType) |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
206 { |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
207 return EquipmentItem.CanBeUsedWithArmourType(otherItemType); |
284ebe05158c
Re #61 - Complete structure of API objects
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
208 } |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
209 |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
210 public static string FormatEquipmentAmount(UnitEquipmentItem item, double amount) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
211 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
212 if (item.IsRatioLimit) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
213 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
214 return Math.Round(amount * 100) + "%"; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
215 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
216 else |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
217 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
218 if (amount == WarFoundryCore.INFINITY) |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
219 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
220 return "all"; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
221 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
222 else |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
223 { |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
224 return amount.ToString(); |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
225 } |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
226 } |
82 | 227 } |
228 } | |
229 } |