annotate api/Objects/UnitEquipmentItem.cs @ 54:3a90f70dac73

Re #61 - Complete structure of WarFoundry API objects * Remove min/max from EquipmentItem and add description * Add min/max numbers and percentages to UnitEquipmentItem * Make Race schema define min/max number without the ratio (which is the percentage) * Replace use of EquipmentItem with UnitEquipmentItem because of increased use of UnitEquipmentItem for unit-specific data * Use doubles instead of floats for equipment amounts * Distinguish between ratio and absolute limits * Delete UnitEquipmentItemObj helper class that was purely used for UI Re #9 - Use smaller methods * Deprecate long Race and EquipmentItem constructors and ensure all getters/setters exist Also: * Migrate Unit to using genericed collections * Always use GameSystem object for Race, not ID string
author IBBoard <dev@ibboard.co.uk>
date Sun, 05 Apr 2009 13:45:23 +0000
parents 306558904c2a
children 284ebe05158c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
306558904c2a Re #1 - LGPL license all code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
1 // This file (UnitEquipmentItem.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard.
306558904c2a Re #1 - LGPL license all code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
2 //
306558904c2a Re #1 - LGPL license all code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
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.
306558904c2a Re #1 - LGPL license all code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
4
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using System.Xml;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 namespace IBBoard.WarFoundry.API.Objects
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 /// <summary>
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 /// Summary description for UnitEquipmentItem.
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 /// </summary>
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 public class UnitEquipmentItem : WarFoundryObject
54
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
14 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
15 private EquipmentItem item;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
16 private bool required;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
17 private bool roundUp;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
18 private int minNum;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
19 private int maxNum;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
20 private double minPercentage;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
21 private double maxPercentage;
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 private string mutexGroup;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 private UnitType unitType;
54
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
24
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
25 protected UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipForType)
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
26 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
27 item = equipmentItem;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
28 EquipmentForUnit = 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
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
31 public override string Name
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 get {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
34 return item.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 set {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
37 base.Name = value;
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 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
40
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
41 public string EquipmentItemID
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 get { return item.ID; }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
44 }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45
54
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
46 public double Cost
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
47 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
48 get { return item.Cost; }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
49 }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 public bool IsRequired
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 get { return required; }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 set { required = value; }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 public bool RoundNumberUp
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
59 get { return roundUp; }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
60 set { roundUp = value; }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63 public string MutexGroup
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65 get { return mutexGroup; }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 set { mutexGroup = (value == null ? "" : value.Trim()); }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69 public UnitType EquipmentForUnit
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
70 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71 get { return unitType; }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72 set
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
73 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74 if (value != null)
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76 unitType = value;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78 }
54
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
79 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
80
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
81 public bool IsRatioLimit
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
82 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
83 get { return minPercentage!=100 || maxPercentage!=100; }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
84 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
85
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
86 public int MinNumber
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
87 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
88 get { return minNum; }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
89 set
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
90 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
91 if (value >=0 || value == WarFoundryCore.INFINITY)
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
92 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
93 minNum = value;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
94 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
95 //TODO: Check Min<Max
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
96 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
97 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
98
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
99 public int MaxNumber
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
100 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
101 get { return maxNum; }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
102 set
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 if (value >=0 || value == WarFoundryCore.INFINITY)
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
105 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
106 maxNum = value;
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
107 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
108 //TODO: Check Min<Max
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 }
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 public double MinPercentage
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
113 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
114 get { return minPercentage; }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
115 set
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 if (value >=0 && value <= 100)
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 minPercentage = value;
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 //TODO: Check Min<Max
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 }
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 public double MaxPercentage
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
126 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
127 get { return maxPercentage; }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
128 set
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 if (value >=0 && value <= 100)
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 maxPercentage = value;
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 //TODO: Check Min<Max
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
135 }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
136 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
137
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
138 public EquipmentItem EquipmentItem
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
139 {
54
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
140 get { return item; }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
141 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
142
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
143 public override string ToString()
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
144 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
145 return EquipmentItem.Name+ " ("+EquipmentItem.Cost+"pts each)";
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
146 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
147
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
148 public bool HasAlternatives()
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
149 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
150 if (MutexGroup=="")
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
151 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
152 return false;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
153 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
154 else
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
155 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
156 //If the number of items in the MutEx group is greater than one then it must be this item plus another
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
157 return EquipmentForUnit.GetEquipmentItemsByExclusionGroup(MutexGroup).Length > 1;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
158 }
54
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
159 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
160
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
161 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
162 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
163 if (item.IsRatioLimit)
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
164 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
165 return Math.Round(amount * 100) + "%";
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
166 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
167 else
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
168 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
169 if (amount == WarFoundryCore.INFINITY)
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
170 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
171 return "all";
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
172 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
173 else
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
174 {
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
175 return amount.ToString();
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
176 }
3a90f70dac73 Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
177 }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
178 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
179 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
180 }