Пример #1
0
        private string GetArmorInfo(IItem item)
        {
            IArmor armor = item as IArmor;

            if (armor != null)
            {
                StringBuilder strBldr = new StringBuilder();

                IShield shield = item as IShield;
                if (shield != null)
                {
                    strBldr.AppendLine("ShieldNegateDamagePercent: " + shield.NegateDamagePercent);
                }

                strBldr.AppendLine(DiceInfo(armor.Dice));

                foreach (DamageType damageType in Enum.GetValues(typeof(DamageType)))
                {
                    strBldr.AppendLine(damageType.ToString() + ": " + armor.GetTypeModifier(damageType));
                }

                strBldr.Append(EquipmentInfo(armor));


                return(strBldr.ToString());
            }
            return("");
        }
Пример #2
0
        private static void VerifyArmor(IItem item)
        {
            IArmor armor = item as IArmor;

            if (armor != null)
            {
                string type = "Armor";

                foreach (Damage.DamageType damage in Enum.GetValues(typeof(Damage.DamageType)))
                {
                    if (armor.GetTypeModifier(damage) == Decimal.MaxValue &&
                        armor.Material == null)
                    {
                        ThrowConfigException(item, type, string.Format("Damage type {0} not set.", damage));
                    }
                }

                if (armor.Dice == null)
                {
                    ThrowConfigException(item, type, string.Format("No dice set."));
                }
            }
        }