Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Util/UnitEquipmentUtil.cs @ 186:c8682d206a73
Re #198: Add equipment slots
* Add method for testing if equipment and slot are ratio limited
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 27 Oct 2009 20:26:19 +0000 |
parents | 3577bfb7702b |
children | 104a683b5ef8 |
line wrap: on
line diff
--- a/api/Util/UnitEquipmentUtil.cs Tue Oct 27 20:17:40 2009 +0000 +++ b/api/Util/UnitEquipmentUtil.cs Tue Oct 27 20:26:19 2009 +0000 @@ -119,11 +119,16 @@ return max; } - - + public static int GetMinEquipmentCount (Unit unit, UnitEquipmentItem equip) { return GetEquipmentCountLimit (unit, equip); } + + public static bool IsEquipmentRatioLimited(Unit unit, UnitEquipmentItem equip) + { + AbstractLimit limit = unit.UnitType.GetEquipmentSlotLimit(equip.SlotName); + return equip.IsRatioLimit && (limit is IPercentageLimit || limit is UnlimitedLimit); + } } }