コード例 #1
0
        private ValueBuilder ParseSupport(Skill supportingSkill)
        {
            var value = new ValueBuilder(_valueBuilders.Create(0));

            if (supportingSkill.Gem is null)
            {
                return(value);
            }

            value += _gemStatBuilders.AdditionalLevelsForModifierSourceItemSlot().Value
                     + _gemStatBuilders.AdditionalLevels(_skillBuilders.FromId(supportingSkill.Id)).Value;

            var baseItem = GetBaseItem(supportingSkill);

            if (baseItem is null)
            {
                return(value);
            }

            foreach (var gemTagBuilder in GetGemTagBuilders(baseItem))
            {
                value += _gemStatBuilders.AdditionalLevelsForModifierSourceItemSlot(gemTagBuilder).Value;
            }
            return(value);
        }
コード例 #2
0
        /// <summary>
        /// Adds a matcher with a form, value, stat and optionally a condition.
        /// </summary>
        public void Add([RegexPattern] string regex, IFormBuilder form, double value, IStatBuilder stat,
                        IConditionBuilder condition = null)
        {
            var builder = ModifierBuilder
                          .WithForm(form)
                          .WithStat(stat)
                          .WithValue(_valueFactory.Create(value));

            if (condition != null)
            {
                builder = builder.WithCondition(condition);
            }

            Add(regex, builder);
        }
コード例 #3
0
        public void Add([RegexPattern] string regex, IFormBuilder form, double value)
        {
            var builder = ModifierBuilder
                          .WithForm(form)
                          .WithValue(_valueFactory.Create(value));

            Add(regex, builder);
        }
コード例 #4
0
        public void Add(IEffectBuilder effect, IFormBuilder form, IStatBuilder stat, double value)
        {
            var builder = _modifierBuilder
                          .WithForm(form)
                          .WithStat(effect.AddStat(stat))
                          .WithValue(_valueFactory.Create(value));

            _data.Add(builder.Build());
        }
コード例 #5
0
        public IEnumerable <IValueBuilder> ParseValues(
            IReadOnlyDictionary <string, string> groups, string groupPrefix = "")
        {
            var fullPrefix = ValueGroupPrefix + groupPrefix;

            return
                (from pair in groups
                 let groupName = pair.Key
                                 where groupName.StartsWith(fullPrefix, StringComparison.Ordinal)
                                 let suffix = groupName.Substring(fullPrefix.Length)
                                              where suffix.Count(c => c == GroupNamePartDelimiter) == 0 // Ignore nested values
                                              let value = double.Parse(pair.Value)
                                                          select _valueBuilders.Create(value));
        }
コード例 #6
0
        public IReadOnlyList <IValueBuilder> ParseValues(
            IReadOnlyDictionary <string, string> groups, string groupPrefix = "")
        {
            var fullPrefix = ValueGroupPrefix + groupPrefix;
            var values     = new List <IValueBuilder>();

            foreach (var(groupName, stringValue) in groups)
            {
                if (!groupName.StartsWith(fullPrefix, StringComparison.Ordinal))
                {
                    continue;
                }

                var suffix = groupName.Substring(fullPrefix.Length);
                if (suffix.Count(c => c == GroupNamePartDelimiter) != 0)
                {
                    continue; // ignore nested values
                }
                var value = double.Parse(stringValue);
                values.Add(_valueBuilders.Create(value));
            }
            return(values);
        }
        private ValueBuilder Parse(Skill skill)
        {
            var max = GetSkillDefinition(skill.Id).Levels.Keys.Max();

            return(new ValueBuilder(_valueBuilders.Create(max)));
        }
コード例 #8
0
 /// <summary>
 /// Adds a matcher with a form, value, stat and optionally a condition.
 /// </summary>
 public void Add([RegexPattern] string regex, IFormBuilder form, double value, IStatBuilder stat,
                 IConditionBuilder condition = null)
 {
     Add(regex, form, _valueFactory.Create(value), stat, condition);
 }
コード例 #9
0
 private ValueBuilder ParseSupport() =>
 new ValueBuilder(_valueBuilders.Create(0))
 + _gemStatBuilders.AdditionalQualityForModifierSourceItemSlot.Value
 + _gemStatBuilders.AdditionalSupportQualityForModifierSourceItemSlot.Value;
コード例 #10
0
 public void Add(IEffectBuilder effect, IFormBuilder form, IStatBuilder stat, double value)
 {
     Add(effect, form, stat, _valueFactory.Create(value));
 }
コード例 #11
0
 public void Add(IFormBuilder form, IStatBuilder stat, bool value, IConditionBuilder?condition = null)
 => Add(form, stat, _valueFactory.Create(value), condition);