/// <summary>
        /// Calculates the order of the attribute based on type.
        /// </summary>
        /// <param name="variable">variable to be checked</param>
        /// <returns>order number of the variable</returns>
        private static int CalcOrder(Variable variable)
        {
            ItemAttributesData aa = ItemAttributes.GetAttributeData(variable.Name);

            if (aa == null)
            {
                return(3000000);
            }

            return(CalcBaseOrder(aa.EffectType, aa.Suborder));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the order for an array of attributes
        /// </summary>
        /// <param name="attributes">List holding the attributes</param>
        /// <returns>value of the attribute</returns>
        private int CalcOrder(List <Variable> attributes)
        {
            // Get the first item to use as a reference.
            Variable           v  = attributes[0];
            ItemAttributesData aa = ItemAttributes.GetAttributeData(v.Name);

            // put granted skills at the end
            if (v.Name.Equals("itemSkillName"))
            {
                return(4000000);
            }

            if (aa == null)
            {
                return(3000000);
            }

            // This is a good first estimate.
            int order = this.CalcBaseOrder(aa.EffectType, aa.Suborder);

            // now some special cases
            if (aa.FullAttribute.Equals("characterBaseAttackSpeedTag"))
            {
                // put it right after the base piercing stat
                ItemAttributesData piercing = ItemAttributes.GetAttributeData("offensivePierceRatioMin");
                order = this.CalcBaseOrder(piercing.EffectType, piercing.Suborder) + 1;
            }
            else if (aa.FullAttribute.Equals("retaliationGlobalChance"))
            {
                // Put this guy at the beginning of the retaliation global group
                order = MakeGlobal(this.CalcBaseOrder(ItemAttributesEffectType.Retaliation, 0) - 1);
            }
            else if (aa.FullAttribute.Equals("offensiveGlobalChance"))
            {
                // put this guy at the beginning of the offensive global group
                order = MakeGlobal(this.CalcBaseOrder(ItemAttributesEffectType.Offense, 0) - 1);
            }
            else if (this.isArmor && aa.FullAttribute.Equals("offensivePhysicalMin"))
            {
                // put it right after the block recovery time stat
                ItemAttributesData blockRecovery = ItemAttributes.GetAttributeData("blockRecoveryTime");
                order = this.CalcBaseOrder(blockRecovery.EffectType, blockRecovery.Suborder) + 1;
            }

            // Now see if the variable is global and move it to the global group if it is
            if (ItemAttributes.AttributeGroupHas(new Collection <Variable>(attributes), "Global"))
            {
                order = MakeGlobal(order);
            }

            return(order);
        }