Mercurial > repos > IBBoard.WarFoundry.API
annotate api/Objects/UnitEquipmentItem.cs @ 167:9ba56a8e5096
Re #198: Add slots with counts to units
* Add initial API methods
* Add value loading
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 06 Oct 2009 14:59:54 +0000 |
parents | 91f7b8da0b53 |
children | 3045a168714a |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
101
diff
changeset
|
1 // This file (UnitEquipmentItem.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard. |
15 | 2 // |
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
101
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 |
82 | 5 using System; |
164 | 6 using IBBoard.Lang; |
161
81abc04b3dbe
Re #192: Improve "clean coding" practice
IBBoard <dev@ibboard.co.uk>
parents:
157
diff
changeset
|
7 using IBBoard.WarFoundry.API.Util; |
82 | 8 |
9 namespace IBBoard.WarFoundry.API.Objects | |
10 { | |
11 /// <summary> | |
12 /// Summary description for UnitEquipmentItem. | |
167
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
13 /// </summary> |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
14 public class UnitEquipmentItem : WarFoundryObject |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
15 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
16 private EquipmentItem item; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
17 private bool required; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
18 private bool roundUp; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
19 private int minNum; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
20 private int maxNum; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
21 private double minPercentage; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
22 private double maxPercentage; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
23 private double costMultiplier; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
24 private RoundType roundType; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
25 private string[] mutexGroups; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
26 private UnitType unitType; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
27 private string slotName = ""; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
28 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
29 public UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipmentFor) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
30 : this(equipmentItem, equipmentFor, new string[0]) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
31 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
32 //Do nothing extra |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
33 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
34 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
35 public UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipmentFor, params string[] mutexGroups) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
36 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
37 item = equipmentItem; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
38 unitType = equipmentFor; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
39 this.mutexGroups = mutexGroups; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
40 unitType.AddEquipmentItem(this); |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
41 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
42 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
43 public override string Name |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
44 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
45 get |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
46 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
47 return item.Name; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
48 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
49 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
50 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
51 base.Name = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
52 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
53 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
54 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
55 public override string ID |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
56 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
57 get |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
58 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
59 return (EquipmentForUnit == null ? base.ID : EquipmentForUnit.ID) + EquipmentItemID; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
60 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
61 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
62 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
63 base.ID = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
64 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
65 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
66 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
67 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
68 public string EquipmentItemID |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
69 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
70 get { return item.ID; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
71 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
72 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
73 public double Cost |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
74 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
75 get |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
76 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
77 return IBBMath.Round(EquipmentItem.Cost * CostMultiplier, CostRoundType); |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
78 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
79 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
80 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
81 public double CostMultiplier |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
82 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
83 get { return costMultiplier; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
84 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
85 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
86 costMultiplier = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
87 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
88 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
89 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
90 public RoundType CostRoundType |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
91 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
92 get { return roundType; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
93 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
94 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
95 roundType = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
96 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
97 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
98 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
99 public bool IsRequired |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
100 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
101 get { return required; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
102 set { required = value; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
103 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
104 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
105 public bool RoundNumberUp |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
106 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
107 get { return roundUp; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
108 set { roundUp = value; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
109 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
110 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
111 [Obsolete("Use MutexGroups instead for greater flexibility")] |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
112 public string MutexGroup |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
113 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
114 get { return (mutexGroups.Length == 0 ? "" : mutexGroups[0]); } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
115 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
116 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
117 public String[] MutexGroups |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
118 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
119 get { return (string[]) mutexGroups.Clone(); } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
120 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
121 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
122 public UnitType EquipmentForUnit |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
123 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
124 get { return unitType; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
125 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
126 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
127 public bool IsRatioLimit |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
128 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
129 get { return minPercentage != 100 || maxPercentage != 100; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
130 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
131 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
132 public int MinNumber |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
133 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
134 get { return minNum; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
135 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
136 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
137 if (value >= 0 || value == WarFoundryCore.INFINITY) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
138 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
139 minNum = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
140 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
141 //TODO: Check Min<Max |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
142 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
143 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
144 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
145 public int MaxNumber |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
146 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
147 get { return maxNum; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
148 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
149 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
150 if (value >= 0 || value == WarFoundryCore.INFINITY) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
151 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
152 maxNum = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
153 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
154 //TODO: Check Min<Max |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
155 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
156 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
157 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
158 public double MinPercentage |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
159 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
160 get { return minPercentage; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
161 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
162 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
163 if (value >= 0 && value <= 100) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
164 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
165 minPercentage = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
166 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
167 //TODO: Check Min<Max |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
168 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
169 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
170 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
171 public double MaxPercentage |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
172 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
173 get { return maxPercentage; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
174 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
175 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
176 if (value >= 0 && value <= 100) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
177 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
178 maxPercentage = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
179 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
180 //TODO: Check Min<Max |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
181 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
182 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
183 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
184 public EquipmentItem EquipmentItem |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
185 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
186 get { return item; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
187 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
188 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
189 public override string ToString() |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
190 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
191 return EquipmentItem.Name + " (" + Cost + "pts each)"; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
192 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
193 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
194 public bool HasAlternatives() |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
195 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
196 if (MutexGroups.Length == 0) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
197 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
198 return false; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
199 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
200 else if (EquipmentForUnit == null) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
201 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
202 return false; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
203 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
204 else |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
205 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
206 //If the number of items in the MutEx group is greater than one then it must be this item plus another |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
207 return EquipmentForUnit.GetEquipmentItemsByExclusionGroups(MutexGroups).Length > 1; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
208 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
209 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
210 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
211 public ArmourType ItemArmourType |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
212 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
213 get { return EquipmentItem.ItemArmourType; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
214 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
215 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
216 public string Description |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
217 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
218 get { return EquipmentItem.Description; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
219 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
220 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
221 public Race EquipmentForRace |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
222 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
223 get { return EquipmentItem.EquipmentForRace; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
224 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
225 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
226 public bool CanBeUsedWithItem(EquipmentItem item) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
227 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
228 return EquipmentItem.CanBeUsedWithItem(item); |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
229 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
230 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
231 public bool CanBeUsedWithArmourType(ArmourType otherItemType) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
232 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
233 return EquipmentItem.CanBeUsedWithArmourType(otherItemType); |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
234 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
235 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
236 [Obsolete("Use UnitEquipmentUtil method instead")] |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
237 public bool IsMutuallyExclusive(UnitEquipmentItem item) |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
238 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
239 return UnitEquipmentUtil.ItemsAreMutuallyExclusive(this, item); |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
240 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
241 |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
242 public string SlotName |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
243 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
244 get { return slotName; } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
245 set |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
246 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
247 if (value != null && value != "") |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
248 { |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
249 slotName = value; |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
250 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
251 } |
9ba56a8e5096
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
164
diff
changeset
|
252 } |
82 | 253 } |
254 } |