private ValueBuilder CombineHandsByAverage(IDamageRelatedStatBuilder statToCombine) { var mhWeight = SkillUsesHandAsMultiplier(AttackDamageHand.MainHand); var ohWeight = SkillUsesHandAsMultiplier(AttackDamageHand.OffHand); return(CombineByWeightedAverage( statToCombine.With(AttackDamageHand.MainHand).Value, mhWeight, statToCombine.With(AttackDamageHand.OffHand).Value, ohWeight)); }
private ValueBuilder CombineSource( IDamageRelatedStatBuilder statToCombine, Func <IDamageRelatedStatBuilder, IValueBuilder> handCombiner) => ValueFactory.If(_stat.SkillHitDamageSource.Value.Eq((int)DamageSource.Attack)) .Then(handCombiner(statToCombine)) .ElseIf(_stat.SkillHitDamageSource.Value.Eq((int)DamageSource.Spell)) .Then(statToCombine.With(DamageSource.Spell).Value) .ElseIf(_stat.SkillHitDamageSource.Value.Eq((int)DamageSource.Secondary)) .Then(statToCombine.With(DamageSource.Secondary).Value) .Else(0);
private void Add( IFormBuilder form, IDamageRelatedStatBuilder stat, IReadOnlyList <IDamageRelatedStatBuilder> valueParameters, Func <IReadOnlyList <IStatBuilder>, IValueBuilder> value) { Add(form, stat.With(AttackDamageHand.MainHand), value(valueParameters.Select(s => s.With(AttackDamageHand.MainHand)).ToList())); Add(form, stat.With(AttackDamageHand.OffHand), value(valueParameters.Select(s => s.With(AttackDamageHand.OffHand)).ToList())); Add(form, stat.With(DamageSource.Spell), value(valueParameters.Select(s => s.With(DamageSource.Spell)).ToList())); Add(form, stat.With(DamageSource.Secondary), value(valueParameters.Select(s => s.With(DamageSource.Secondary)).ToList())); }
private void AddForSkillAndAilments(GivenStatCollection collection, IFormBuilder form, IDamageRelatedStatBuilder stat, IDamageRelatedStatBuilder valueStat) { collection.Add(form, stat.WithSkills, valueStat.WithSkills.Value); foreach (var ailment in Enums.GetValues <Ailment>()) { var ailmentBuilder = Ailment.From(ailment); collection.Add(form, stat.With(ailmentBuilder), valueStat.With(ailmentBuilder).Value); } }
private void AddDamageWithModifiers(GivenStatCollection collection, IDamageRelatedStatBuilder damage, Func <DamageType, IDamageRelatedStatBuilder> damageForType) { var form = BaseAdd; foreach (var type in Enums.GetValues <DamageType>().Except(DamageType.RandomElement)) { var forType = damageForType(type); AddForSkillAndAilments(collection, form, damage.With(AttackDamageHand.MainHand), forType.With(AttackDamageHand.MainHand)); AddForSkillAndAilments(collection, form, damage.With(AttackDamageHand.OffHand), forType.With(AttackDamageHand.OffHand)); AddForSkillAndAilments(collection, form, damage.With(DamageSource.Spell), forType.With(DamageSource.Spell)); AddForSkillAndAilments(collection, form, damage.With(DamageSource.Secondary), forType.With(DamageSource.Secondary)); collection.Add(form, damage.WithSkills(DamageSource.OverTime), forType.WithSkills(DamageSource.OverTime).Value); } }