Example #1
0
        private void AddProtectionDescription(List <StyledLine> descriptionResult, IArmorItem equipedArmor)
        {
            var equiped = Equals(equipedArmor);

            foreach (Element element in Enum.GetValues(typeof(Element)))
            {
                var value        = GetProtection(element);
                var equipedValue = equipedArmor?.GetProtection(element) ?? 0;

                if (value != 0 || equipedValue != 0)
                {
                    var protectionLine = new StyledLine
                    {
                        new StyledString($"{TextHelper.GetElementName(element)}",
                                         TextHelper.GetElementColor(element)),
                        " Protection: "
                    };

                    if (equiped)
                    {
                        protectionLine.Add(TextHelper.GetValueString(value, "%"));
                    }
                    else
                    {
                        protectionLine.Add(TextHelper.GetCompareValueString(value, equipedValue, "%"));
                    }

                    descriptionResult.Add(protectionLine);
                }
            }
        }
Example #2
0
 private void EquipArmor(IArmorItem newArmor)
 {
     UnequipArmor(newArmor.ArmorType);
     Armor[newArmor.ArmorType] = newArmor;
 }