15
|
1 // This file (SystemStats.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
|
0
|
5 using System;
|
|
6 using System.Collections.Generic;
|
|
7
|
|
8 namespace IBBoard.WarFoundry.API.Objects
|
|
9 {
|
|
10 /// <summary>
|
10
|
11 /// SystemStats defines the available statistics/attributes that entity types can use (either a unit or an equipment item that has a stats line). Statistic/attribute values will be defined by a <see cref="Stats"/> object.
|
0
|
12 /// </summary>
|
|
13 public class SystemStats
|
|
14 {
|
|
15 private Dictionary<string, StatSlot> stats;
|
|
16 private string id;
|
|
17
|
|
18 public SystemStats(string statsID, StatSlot[] statSlots)
|
|
19 {
|
|
20 id = statsID;
|
|
21 stats = new Dictionary<string, StatSlot>();
|
|
22
|
|
23 foreach (StatSlot slot in statSlots)
|
|
24 {
|
|
25 slot.SystemStats = this;
|
|
26 stats[slot.Name] = slot;
|
|
27 }
|
|
28 }
|
|
29
|
|
30 public StatSlot[] StatSlots
|
|
31 {
|
|
32 get
|
|
33 {
|
|
34 StatSlot[] slots = new StatSlot[stats.Count];
|
|
35 stats.Values.CopyTo(slots, 0);
|
|
36 return slots;
|
|
37 }
|
|
38 }
|
|
39
|
|
40 public StatSlot this[string key]
|
|
41 {
|
|
42 get
|
|
43 {
|
|
44 StatSlot slot = null;
|
|
45 stats.TryGetValue(key, out slot);
|
|
46 return slot;
|
|
47 }
|
|
48 }
|
|
49
|
|
50 public int SlotCount
|
|
51 {
|
|
52 get { return stats.Count; }
|
|
53 }
|
|
54
|
|
55 public string ID
|
|
56 {
|
|
57 get { return id; }
|
|
58 }
|
|
59 }
|
|
60 }
|