Ejemplo n.º 1
0
 /// <summary>
 /// Computes min damage of the weapon without taking account of "+% weapon damage".
 /// </summary>
 /// <param name="itemAttr">Attributes of a weapon.</param>
 /// <param name="resist"></param>
 /// <returns></returns>
 public static ItemValueRange GetBaseWeaponDamageMin(this ItemAttributes itemAttr, String resist)
 {
     return(itemAttr.GetAttributeByName("damageWeaponMin_" + resist) +
            itemAttr.GetAttributeByName("damageWeaponBonusMin_" + resist) +
            itemAttr.GetAttributeByName("damageWeaponBonusMinX1_" + resist) +
            itemAttr.GetAttributeByName("damageWeaponBonusFlat_" + resist));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Computes min damage of the item (based on a specific resist).
        /// </summary>
        /// <param name="itemAttr">Attributes of an item.</param>
        /// <param name="resist">Name of the resist.</param>
        /// <param name="useDamageTypePercentBonus"></param>
        /// <returns></returns>
        public static ItemValueRange GetRawBonusDamageMin(this ItemAttributes itemAttr, String resist, bool useDamageTypePercentBonus = true)
        {
            var result = itemAttr.GetAttributeByName("damageMin_" + resist) + itemAttr.GetAttributeByName("damageBonusMin_" + resist);

            if (useDamageTypePercentBonus && resist != "Physical")
            {
                result += itemAttr.GetRawBonusDamageMin("Physical") * itemAttr.GetAttributeByName("damageTypePercentBonus_" + resist);
            }

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Computes max 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 GetRawWeaponDamageMax(this ItemAttributes weaponAttr, String resist, bool useDamageTypePercentBonus = true)
        {
            var damage = weaponAttr.GetBaseWeaponDamageMax(resist);

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

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

            return(damage);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Check a specific case of "invalid" Weapon damage values (based on a specific resist):
        /// If bonus min > delta, then delta should be replaced by bonus min + 1
        /// </summary>
        /// <param name="itemAttr"></param>
        /// <param name="resist"></param>
        public static ItemAttributes CheckAndUpdateWeaponDelta(this ItemAttributes itemAttr, String resist)
        {
            var damageWeaponBonusMin = itemAttr.GetAttributeByName("damageWeaponBonusMin_" + resist);
            var damageWeaponDelta    = itemAttr.GetAttributeByName("damageWeaponDelta_" + resist);

            // Check "black weapon bug"
            if ((damageWeaponDelta != null) && (damageWeaponBonusMin != null) && (damageWeaponDelta.Min < damageWeaponBonusMin.Min))
            {
                damageWeaponDelta = damageWeaponBonusMin + 1;
            }

            // Store new values
            itemAttr.SetAttributeByName("damageWeaponDelta_" + resist, damageWeaponDelta);

            return(itemAttr);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Computes max damage of the weapon without taking account of "+% weapon damage".
 /// </summary>
 /// <param name="weaponAttr">Attributes of a weapon.</param>
 /// <param name="resist"></param>
 /// <returns></returns>
 public static ItemValueRange GetBaseWeaponDamageMax(this ItemAttributes weaponAttr, String resist)
 {
     return(weaponAttr.GetAttributeByName("damageWeaponMin_" + resist) +
            weaponAttr.GetAttributeByName("damageWeaponBonusMinX1_" + resist) +
            weaponAttr.GetAttributeByName("damageWeaponDelta_" + resist) +
            weaponAttr.GetAttributeByName("damageWeaponBonusDelta_" + resist) +
            weaponAttr.GetAttributeByName("damageWeaponBonusDeltaX1_" + resist) +
            weaponAttr.GetAttributeByName("damageWeaponBonusFlat_" + resist));
 }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="itemAttributes"></param>
        /// <remarks>No more damage malus applied on followers since Reaper of Souls.</remarks>
        private static void ApplyFollowersBonusMalusOnItemAttributes(ItemAttributes itemAttributes)
        {
            itemAttributes.dexterityItem    *= 2.5;
            itemAttributes.intelligenceItem *= 2.5;
            itemAttributes.strengthItem     *= 2.5;
            itemAttributes.vitalityItem     *= 2.5;

            foreach (var resist in Constants.DamageResists)
            {
                foreach (var damage in Constants.DamagePrefixes)
                {
                    var value = itemAttributes.GetAttributeByName(damage + resist);
                    itemAttributes.SetAttributeByName(damage + resist, value);
                }
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Returns the resistance value given by the gems for the given resist
 /// </summary>
 /// <param name="itemAttr"></param>
 /// <param name="resist"></param>
 /// <returns></returns>
 public static ItemValueRange GetResistance(this ItemAttributes itemAttr, String resist)
 {
     return(itemAttr.GetAttributeByName("resistance_" + resist));
 }