Пример #1
0
 /// <summary>
 /// Computes min damage of the weapon.
 /// </summary>
 /// <param name="weaponAttr">Attributes of a weapon.</param>
 /// <returns></returns>
 public static ItemValueRange GetRawWeaponDamageMin(this ItemAttributes weaponAttr)
 {
     return(weaponAttr.GetRawWeaponDamageMin("Arcane") + weaponAttr.GetRawWeaponDamageMin("Cold")
            + weaponAttr.GetRawWeaponDamageMin("Fire") + weaponAttr.GetRawWeaponDamageMin("Holy")
            + weaponAttr.GetRawWeaponDamageMin("Lightning") + weaponAttr.GetRawWeaponDamageMin("Physical")
            + weaponAttr.GetRawWeaponDamageMin("Poison"));
 }
Пример #2
0
        /// <summary>
        /// Computes min damage of the weapon (based on a specific resist).
        /// </summary>
        /// <param name="weaponAttr">Attributes of a weapon.</param>
        /// <param name="resist">Name of the resist.</param>
        /// <param name="useDamageTypePercentBonus"></param>
        /// <returns></returns>
        public static ItemValueRange GetRawWeaponDamageMin(this ItemAttributes weaponAttr, String resist, bool useDamageTypePercentBonus = true)
        {
            var damage = weaponAttr.GetBaseWeaponDamageMin(resist);

            damage *= 1 + weaponAttr.GetAttributeByName("damageWeaponPercentBonus_" + resist);

            if (useDamageTypePercentBonus && resist != "Physical")
            {
                damage += weaponAttr.GetRawWeaponDamageMin("Physical") * weaponAttr.GetAttributeByName("damageTypePercentBonus_" + resist);
            }

            return(damage);
        }
Пример #3
0
 /// <summary>
 /// Computes weapon only damages
 /// </summary>
 /// <param name="itemAttr"></param>
 /// <returns></returns>
 public static ItemValueRange GetRawAverageWeaponDamage(this ItemAttributes itemAttr)
 {
     // formula: ( min + max ) / 2
     return((itemAttr.GetRawWeaponDamageMin() + itemAttr.GetRawWeaponDamageMax()) / 2);
 }
Пример #4
0
 public void GetRawWeaponDamageMin()
 {
     Assert.AreEqual(new ItemValueRange(16.8, 168), weaponAttr.GetRawWeaponDamageMin("Arcane"));
     Assert.AreEqual(new ItemValueRange(24, 240), weaponAttr.GetRawWeaponDamageMin("Physical"));
 }