private ValueBuilder GetAdditionalQualityFromSupportingSkills(IReadOnlyList <Skill> supportingSkills) { var valueBuilder = new ValueBuilder(_valueBuilders.Create(0)); foreach (var supportingSkill in supportingSkills) { var supportValueBuilder = _gemStatBuilders.AdditionalLevels(supportingSkill).Value; valueBuilder += _valueBuilders.If(_metaStatBuilders.SkillIsEnabled(supportingSkill).IsTrue) .Then(supportValueBuilder.Select(d => SelectActiveAdditionalQuality(supportingSkill, (int)d), v => $"SelectActiveAdditionalQuality({supportingSkill.Id}, {supportingSkill.Level}, {v})")) .Else(0);; } return(valueBuilder); int SelectActiveAdditionalQuality(Skill supportingSkill, int supportAdditionalLevels) { var value = 0; foreach (var untranslatedStat in GetLevelStats(supportingSkill, supportAdditionalLevels)) { if (SkillStatIds.SupportedSkillGemQualityRegex.IsMatch(untranslatedStat.StatId)) { value += untranslatedStat.Value; } } return(value); } }
private ValueBuilder GetAdditionalValueFromSupportingSkills( IReadOnlyDictionary <Skill, ValueBuilder> supportingSkills, SkillBaseItemDefinition baseItem) { var valueBuilder = new ValueBuilder(_valueBuilders.Create(0)); foreach (var(supportingSkill, supportValueBuilder) in supportingSkills) { valueBuilder += _valueBuilders.If(_metaStatBuilders.SkillIsEnabled(supportingSkill).IsTrue) .Then(supportValueBuilder.Select(d => SelectActiveAdditionalLevels(supportingSkill, (int)d), v => $"SelectActiveAdditionalLevels({supportingSkill.Id}, {supportingSkill.Level}, {v})")) .Else(0); } return(valueBuilder); int SelectActiveAdditionalLevels(Skill supportingSkill, int supportAdditionalLevels) { var value = 0; foreach (var untranslatedStat in GetLevelStats(supportingSkill, supportAdditionalLevels)) { var match = SkillStatIds.SupportedSkillGemLevelRegex.Match(untranslatedStat.StatId); var tag = match.Groups[1].Value; if (tag == "active" || baseItem.GemTags.Contains(tag)) { value += untranslatedStat.Value; } } return(value); } }
public static ValueBuilder Maximum(this IValueBuilders valueFactory, ValueBuilder left, double right) => valueFactory.If(left < right).Then(right).Else(left);
public static ValueBuilder Minimum(this IValueBuilders valueFactory, ValueBuilder left, ValueBuilder right) => valueFactory.If(left > right).Then(right).Else(left);