Exemple #1
0
 /// <summary>
 /// Computes max damage of the item.
 /// </summary>
 /// <param name="itemAttr">Attributes of an item.</param>
 /// <returns></returns>
 public static ItemValueRange GetRawBonusDamageMax(this ItemAttributes itemAttr)
 {
     return(itemAttr.GetRawBonusDamageMax("Arcane") + itemAttr.GetRawBonusDamageMax("Cold")
            + itemAttr.GetRawBonusDamageMax("Fire") + itemAttr.GetRawBonusDamageMax("Holy")
            + itemAttr.GetRawBonusDamageMax("Lightning") + itemAttr.GetRawBonusDamageMax("Physical")
            + itemAttr.GetRawBonusDamageMax("Poison"));
 }
Exemple #2
0
        /// <summary>
        /// Computes max 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 GetRawBonusDamageMax(this ItemAttributes itemAttr, String resist, bool useDamageTypePercentBonus = true)
        {
            var result = itemAttr.GetAttributeByName("damageMin_" + resist) + itemAttr.GetAttributeByName("damageDelta_" + resist);

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

            return(result);
        }
Exemple #3
0
        /// <summary>
        /// Returns a new <see cref="ItemAttributes"/> by aggregating some raw attributes of <paramref name="itemAttr"/> (for easier editing for example).
        /// </summary>
        /// <param name="itemAttr"></param>
        /// <returns>The <paramref name="itemAttr"/> instance.</returns>
        public static ItemAttributes GetSimplified(this ItemAttributes itemAttr)
        {
            var attr = new ItemAttributes(itemAttr);

            // Characteristics
            attr.armorItem      = itemAttr.GetArmor().NullIfZero();
            attr.armorBonusItem = null;

            // Weapon characterics
            attr.attacksPerSecondItem        = itemAttr.GetRawWeaponAttackPerSecond().NullIfZero();
            attr.attacksPerSecondItemPercent = null;

            itemAttr.CheckAndUpdateWeaponDelta();

            foreach (var resist in D3Calculator.DamageResists)
            {
                var baseWeaponDamageMin   = itemAttr.GetBaseWeaponDamageMin(resist);
                var baseWeaponDamageDelta = itemAttr.GetBaseWeaponDamageMax(resist) - baseWeaponDamageMin;

                attr.SetAttributeByName("damageWeaponMin_" + resist, baseWeaponDamageMin.NullIfZero())
                .SetAttributeByName("damageWeaponDelta_" + resist, baseWeaponDamageDelta.NullIfZero())
                .SetAttributeByName("damageWeaponBonusMin_" + resist, null)
                .SetAttributeByName("damageWeaponBonusDelta_" + resist, null)
                .SetAttributeByName("damageWeaponBonusMinX1_" + resist, null)
                .SetAttributeByName("damageWeaponBonusDeltaX1_" + resist, null)
                .SetAttributeByName("damageWeaponBonusFlat_" + resist, null);
            }

            // Item damage bonuses
            foreach (var resist in D3Calculator.DamageResists)
            {
                var rawDamageMin   = itemAttr.GetRawBonusDamageMin(resist, false);
                var rawDamageDelta = itemAttr.GetRawBonusDamageMax(resist, false) - rawDamageMin;

                attr.SetAttributeByName("damageMin_" + resist, rawDamageMin.NullIfZero())
                .SetAttributeByName("damageDelta_" + resist, rawDamageDelta.NullIfZero())
                .SetAttributeByName("damageBonusMin_" + resist, null);
            }

            return(attr);
        }
Exemple #4
0
 /// <summary>
 /// Computes damages other than weapon damages (on rings, amulets, ...).
 /// </summary>
 /// <param name="itemAttr">Attributes of an item.</param>
 /// <returns></returns>
 public static ItemValueRange GetRawAverageBonusDamage(this ItemAttributes itemAttr)
 {
     // formula: ( min + max ) / 2
     return((itemAttr.GetRawBonusDamageMin() + itemAttr.GetRawBonusDamageMax()) / 2);
 }