Mercurial > repos > IBBoard.WarFoundry.API
comparison api/Objects/UnitType.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 | 4a02c07278e7 |
children | 3045a168714a |
comparison
equal
deleted
inserted
replaced
166:6902f49e16e0 | 167:9ba56a8e5096 |
---|---|
29 private Dictionary<string, Ability> requiredAbilities = new Dictionary<string, Ability>(); | 29 private Dictionary<string, Ability> requiredAbilities = new Dictionary<string, Ability>(); |
30 private Dictionary<string, Ability> optionalAbilities = new Dictionary<string, Ability>(); | 30 private Dictionary<string, Ability> optionalAbilities = new Dictionary<string, Ability>(); |
31 private String notes = ""; | 31 private String notes = ""; |
32 private List<UnitType> containedTypes = new List<UnitType>(); | 32 private List<UnitType> containedTypes = new List<UnitType>(); |
33 private Dictionary<string, string> extraData = new Dictionary<string, string>(); | 33 private Dictionary<string, string> extraData = new Dictionary<string, string>(); |
34 private Dictionary<string, int> slotLimits = new Dictionary<string, int>(); | |
34 | 35 |
35 | 36 |
36 public UnitType(string id, string typeName, Race parentRace) : base(id, typeName) | 37 public UnitType(string id, string typeName, Race parentRace) : base(id, typeName) |
37 { | 38 { |
38 race = parentRace; | 39 race = parentRace; |
446 get | 447 get |
447 { | 448 { |
448 return stats.StatsID; | 449 return stats.StatsID; |
449 } | 450 } |
450 } | 451 } |
452 | |
453 public void AddEquipmentSlot(string slotName, int slotLimit) | |
454 { | |
455 slotLimits.Add(slotName, slotLimit); | |
456 } | |
457 | |
458 public bool HasEquipmentSlot(string slotName) | |
459 { | |
460 return slotLimits.ContainsKey(slotName); | |
461 } | |
462 | |
463 /// <summary> | |
464 /// Gets the maximum number of items allowed in a single slot | |
465 /// </summary> | |
466 /// <param name="slotName">The name of the equipment slot to get the limit for the named slot</param> | |
467 /// <returns>The maximum number of items allowed in a slot, or <code>-1</code> if the slot is the default one or has not been specified</returns> | |
468 public int GetEquipmentSlotLimit(string slotName) | |
469 { | |
470 int slotLimit = -1; | |
471 | |
472 if (HasEquipmentSlot(slotName)) | |
473 { | |
474 slotLimit = DictionaryUtils.GetValue(slotLimits, slotName); | |
475 } | |
476 | |
477 return slotLimit; | |
478 } | |
451 } | 479 } |
452 } | 480 } |