コード例 #1
0
        /// <summary>
        /// Returns the final bonus as an <see cref="ItemAttributes"/> instance.
        /// </summary>
        /// <returns></returns>
        public ItemAttributes GetBonus()
        {
            var attr = new ItemAttributes();

            if (!String.IsNullOrEmpty(AttributeName))
            {
                attr.SetAttributeByName(AttributeName, CurrentPoints * BonusPerPoint);
            }

            return(attr);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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);
                }
            }
        }
コード例 #5
0
        /// <inheritdoc />
        public ItemAttributes GetBonus(D3Calculator calculator)
        {
            Item stuff = calculator.HeroStatsItem;
            var  attr  = new ItemAttributes();

            foreach (var resist in damageResists)
            {
                foreach (var thorns in thornsPrefixes)
                {
                    var value = stuff.GetAttributeByName(thorns + resist);
                    attr.SetAttributeByName(thorns + resist, multiplier * value);
                }
            }

            return(attr);
        }