Exemplo n.º 1
0
        public List <AttributeModifier> GetAttributeModifiers(int level, float multiplier = 1)
        {
            var modifiers = new List <AttributeModifier>();

            foreach (var attributeModifierCurveData in this.data.Attributes)
            {
                var amount = Curve.Evaluate(
                    level,
                    attributeModifierCurveData.Min,
                    attributeModifierCurveData.Max,
                    attributeModifierCurveData.CurveType) * multiplier;

                amount *= Quality;

                var attributeData = new AttributeModifierData
                {
                    Type   = ModifierType.Flat,
                    Amount = amount
                };

                var attributeModifier = new AttributeModifier(
                    this.attributeRepository.Find(attributeModifierCurveData.AttributeId), attributeData);

                modifiers.Add(attributeModifier);
            }

            modifiers.AddRange(ItemModifiers.SelectMany(m => m.GetAttributeModifiers(level, multiplier)));

            return(modifiers);
        }
Exemplo n.º 2
0
        public List <PropertyModifier> GetPropertyModifiers(int level, int forgeLevel, float multiplier = 1)
        {
            var modifiers = new List <PropertyModifier>();

            foreach (var propertyModifierCurveData in this.data.Properties)
            {
                var property = this.propertyRepository.Find(propertyModifierCurveData.PropertyId);

                var amount = Curve.Evaluate(
                    level,
                    propertyModifierCurveData.Min,
                    propertyModifierCurveData.Max,
                    propertyModifierCurveData.CurveType) * (property.IsUnscalable ? 1 : multiplier);

                amount *= Quality;

                var forge = Curve.Evaluate(
                    forgeLevel,
                    propertyModifierCurveData.Min,
                    propertyModifierCurveData.Max,
                    propertyModifierCurveData.CurveType) * (property.IsUnscalable ? 1 : multiplier);

                if (property.IsFractional())
                {
                    forge *= 0.25f;
                }

                amount += forge;

                var propertyData = new PropertyModifierData
                {
                    PropertyId = property.Id,
                    Type       = ModifierType.Flat,
                    Amount     = amount
                };

                modifiers.Add(new PropertyModifier(property, propertyData));
            }

            modifiers.AddRange(ItemModifiers.SelectMany(m => m.GetPropertyModifiers(level, forgeLevel, multiplier)));

            return(modifiers);
        }