Beispiel #1
0
            public IEnumerable <PathDefinition> GetPaths(IStat stat)
            {
                if (!_barSkillConversion.Equals(stat))
                {
                    return(_originalContext.GetPaths(stat));
                }

                return(_originalContext.GetPaths(stat)
                       .Where(p => p.ModifierSource is ModifierSource.Local.Skill));
            }
        private IEnumerable <PathDefinition> GetPaths(IValueCalculationContext context, IStat stat)
        {
            if (!_skillConversion.Equals(stat))
            {
                return(context.GetPaths(stat));
            }

            return(context.GetPaths(stat)
                   .Where(p => p.ModifierSource is ModifierSource.Local.Skill));
        }
        private IEnumerable <PathDefinition> GetPaths(IValueCalculationContext context, IStat stat)
        {
            var originalPaths = context.GetPaths(stat);

            if (_ailmentDamage.Equals(stat))
            {
                return(originalPaths.Union(context.GetPaths(_skillDamage)));
            }
            return(originalPaths);
        }
        private IReadOnlyCollection <PathDefinition> GetPaths(IValueCalculationContext context, IStat stat)
        {
            if (!_skillConversion.Equals(stat))
            {
                return(context.GetPaths(stat));
            }

            return(context.GetPaths(stat)
                   .Where(p => p.ModifierSource is ModifierSource.Local.Skill)
                   .ToList());
        }
Beispiel #5
0
            public IEnumerable <PathDefinition> GetPaths(IStat stat)
            {
                if (!_foo.Equals(stat))
                {
                    return(_originalContext.GetPaths(stat));
                }

                var originalPaths   = _originalContext.GetPaths(_foo);
                var conversionPaths = _originalContext.GetPaths(_bar)
                                      .Select(p => new PathDefinition(p.ModifierSource, _bar.Concat(p.ConversionStats).ToList()));

                return(originalPaths.Concat(conversionPaths).Distinct());
            }
        private IEnumerable <PathDefinition> GetPaths(IValueCalculationContext context, IStat stat)
        {
            if (!_target.Equals(stat))
            {
                return(context.GetPaths(stat));
            }

            var originalPaths   = context.GetPaths(_target);
            var conversionPaths = context.GetPaths(_source)
                                  .Select(p => new PathDefinition(p.ModifierSource, _source.Concat(p.ConversionStats).ToList()));

            return(originalPaths.Concat(conversionPaths).Distinct());
        }
        private IReadOnlyCollection <PathDefinition> GetPaths(IValueCalculationContext context, IStat stat)
        {
            if (!_target.Equals(stat))
            {
                return(context.GetPaths(stat));
            }

            var originalPaths   = context.GetPaths(_target);
            var conversionPaths = context.GetPaths(_source)
                                  .Select(p => new PathDefinition(p.ModifierSource, p.ConversionStats.Prepend(_source).ToArray()));
            var paths = new HashSet <PathDefinition>(originalPaths);

            paths.UnionWith(conversionPaths);
            return(paths);
        }
        private IReadOnlyCollection <PathDefinition> GetPaths(IValueCalculationContext context, IStat stat)
        {
            var originalPaths = context.GetPaths(stat);

            if (!_ailmentDamage.Equals(stat))
            {
                return(originalPaths);
            }

            var skillPaths = context.GetPaths(_skillDamage)
                             .Select(p => new PathDefinition(p.ModifierSource));
            var paths = new HashSet <PathDefinition>(originalPaths);

            paths.UnionWith(skillPaths);
            return(paths);
        }
        private NodeValue?GetValues(
            IValueCalculationContext context, IStat stat, NodeType nodeType, PathDefinition path)
        {
            var originalValue = context.GetValue(stat, nodeType, path);

            if (nodeType != NodeType.BaseAdd && nodeType != NodeType.BaseSet)
            {
                return(originalValue);
            }
            if (!stat.Equals(_transformedStat))
            {
                return(originalValue);
            }

            var effectivenessStat =
                nodeType == NodeType.BaseSet ? _baseSetEffectivenessStat : _baseAddEffectivenessStat;
            var effectiveness = context.GetValue(effectivenessStat) ?? new NodeValue(1);

            return(originalValue * effectiveness);
        }
        GetValue(IValueCalculationContext context, IStat stat, NodeType nodeType, PathDefinition path)
        {
            var value = context.GetValue(stat, nodeType, path);

            if (value is null || !_convertTo.Equals(stat) || nodeType != NodeType.PathTotal)
            {
                return(value);
            }

            var sourceConversion = context.GetValue(_conversion) ?? new NodeValue(0);

            if (sourceConversion <= 100)
            {
                // Conversions don't exceed 100%, No scaling required
                return(value);
            }

            var isSkillPath           = path.ModifierSource is ModifierSource.Local.Skill;
            var sourceSkillConversion = context.GetValue(_skillConversion) ?? new NodeValue(0);

            if (sourceSkillConversion >= 100)
            {
                // Conversions from skills are or exceed 100%
                // Non-skill conversions don't apply
                if (!isSkillPath)
                {
                    return(new NodeValue(0));
                }
                // Skill conversions are scaled to sum to 100%
                return(value / sourceSkillConversion * 100);
            }

            // Conversions exceed 100%
            // Skill conversions don't scale (they themselves don't exceed 100%)
            if (isSkillPath)
            {
                return(value);
            }
            // Non-skill conversions are scaled to sum to 100% - skill conversions
            return(value * (100 - sourceSkillConversion) / (sourceConversion - sourceSkillConversion));
        }
Beispiel #11
0
            public NodeValue?GetValue(IStat stat, NodeType nodeType, PathDefinition path)
            {
                var value = _originalContext.GetValue(stat, nodeType, path);

                if (value is null || !_barFooConversion.Equals(stat) || nodeType != NodeType.PathTotal)
                {
                    return(value);
                }

                var barConversion = _originalContext.GetValue(_barConversion) ?? new NodeValue(0);

                if (barConversion <= 1)
                {
                    // Conversions don't exceed 100%, No scaling required
                    return(value);
                }

                var isSkillPath        = path.ModifierSource is ModifierSource.Local.Skill;
                var barSkillConversion = _originalContext.GetValue(_barSkillConversion) ?? new NodeValue(0);

                if (barSkillConversion >= 1)
                {
                    // Conversions from skills are or exceed 100%
                    // Non-skill conversions don't apply
                    if (!isSkillPath)
                    {
                        return(new NodeValue(0));
                    }
                    // Skill conversions are scaled to sum to 100%
                    return(value / barSkillConversion);
                }

                // Conversions exceed 100%
                // Skill conversions don't scale (they themselves don't exceed 100%)
                if (isSkillPath)
                {
                    return(value);
                }
                // Non-skill conversions are scaled to sum to 100% - skill conversions
                return(value * (1 - barSkillConversion) / (barConversion - barSkillConversion));
            }