private Behavior AilmentDamageUncappedSubtotalBehavior(IStat stat, IDamageSpecification damageSpecification) => GetOrAdd(() => _statFactory.ConcretizeDamage(stat, damageSpecification), NodeType.UncappedSubtotal, BehaviorPathInteraction.All, v => new AilmentDamageUncappedSubtotalValue( _statFactory.ConcretizeDamage(stat, damageSpecification), _statFactory.ConcretizeDamage(stat, damageSpecification.ForSkills()), v), new CacheKey(stat, damageSpecification));
public IReadOnlyList <Behavior> ConcretizeDamage(IStat stat, IDamageSpecification damageSpecification) { // Behaviors are only for damage, not other damage related stats if (!Enums.GetValues <DamageType>().Any(t => _statFactory.Damage(stat.Entity, t).Equals(stat))) { return(new Behavior[0]); } if (damageSpecification.DamageSource == DamageSource.OverTime) { // Skill DoT return(new Behavior[0]); } else if (damageSpecification.IsSkillDamage()) { // Skill Hit return(new[] { DamageEffectivenessBaseBehavior(stat, damageSpecification) }); } else { // Ailment return(new[] { AilmentDamageUncappedSubtotalBehavior(stat, damageSpecification), AilmentDamageBaseBehavior(stat, damageSpecification), AilmentDamageIncreaseMoreBehavior(stat, damageSpecification) }); } }
private Behavior DamageEffectivenessBaseBehavior(IStat stat, IDamageSpecification damageSpecification) => GetOrAdd(() => _statFactory.ConcretizeDamage(stat, damageSpecification), NodeType.Base, BehaviorPathRules.NonConversion, v => new DamageEffectivenessBaseValue( _statFactory.ConcretizeDamage(stat, damageSpecification), _statFactory.DamageBaseSetEffectiveness(stat.Entity), _statFactory.DamageBaseAddEffectiveness(stat.Entity), v), new CacheKey(stat, damageSpecification));
private Behavior AilmentDamageIncreaseMoreBehavior(IStat stat, IDamageSpecification damageSpecification) => GetOrAdd(new LazyStatEnumerable(() => _statFactory.ConcretizeDamage(stat, damageSpecification)), new[] { NodeType.Increase, NodeType.More }, BehaviorPathInteraction.All, v => new AilmentDamageIncreaseMoreValue( _statFactory.ConcretizeDamage(stat, damageSpecification), _statFactory.AilmentDealtDamageType(stat.Entity, damageSpecification.Ailment.Value), t => _statFactory.ConcretizeDamage(_statFactory.Damage(stat.Entity, t), damageSpecification), v), new CacheKey(stat, damageSpecification));
private ValueConverter ValueConverterForResult( BuildParameters parameters, StatBuilderResult result, IDamageSpecification spec) { var condition = _condition(spec).Build(parameters); if (condition.HasStatConverter) { throw new InvalidOperationException("Conditions passed to With must not have stat converters"); } if (!condition.HasValue) { return(result.ValueConverter); } return(result.ValueConverter.AndThen(v => v.If(condition.Value))); }
public IReadOnlyList <Behavior> ConcretizeDamage(IStat stat, IDamageSpecification damageSpecification) { if (damageSpecification.IsSkillDamage()) { return(new Behavior[0]); } if (!Enums.GetValues <DamageType>().Any(t => _statFactory.Damage(stat.Entity, t).Equals(stat))) { return(new Behavior[0]); } return(new[] { AilmentDamageUncappedSubtotalBehavior(stat, damageSpecification), AilmentDamageBaseBehavior(stat, damageSpecification), AilmentDamageIncreaseMoreBehavior(stat, damageSpecification) }); }
private IConditionBuilder KeywordCondition(IDamageSpecification spec, IKeywordBuilder keyword) => ValueConditionBuilder.Create((ps, k) => BuildKeywordStat(spec, ps, k), keyword);
protected override IStat BuildKeywordStat(IDamageSpecification spec, Entity entity, Keyword keyword) { return(spec.Ailment.HasValue ? StatFactory.MainSkillPartAilmentDamageHasKeyword(entity, keyword) : StatFactory.MainSkillPartDamageHasKeyword(entity, keyword, spec.DamageSource)); }
private IReadOnlyList <IStat> ConcretizeStats(IDamageSpecification spec, IReadOnlyList <IStat> stats) => stats.SelectToList(s => _statFactory.ConcretizeDamage(s, spec));
private Behavior AilmentDamageIncreaseMoreBehavior(IStat stat, IDamageSpecification damageSpecification) => GetOrAdd(new LazyStatList(() => _statFactory.ConcretizeDamage(stat, damageSpecification)), new[] { NodeType.Increase, NodeType.More }, BehaviorPathRules.All, v => new AilmentDamageIncreaseMoreValue(
private Behavior AilmentDamageBaseBehavior(IStat stat, IDamageSpecification damageSpecification) => GetOrAdd(() => _statFactory.ConcretizeDamage(stat, damageSpecification), NodeType.Base, BehaviorPathInteraction.NonConversion, v => new AilmentDamageBaseValue( _statFactory.ConcretizeDamage(stat, damageSpecification.ForSkills()), v), new CacheKey(stat, damageSpecification));
public static bool IsSkillDamage(this IDamageSpecification @this) => [email protected];
protected virtual IStat BuildKeywordStat(IDamageSpecification spec, Entity entity, Keyword keyword) => StatFactory.MainSkillPartHasKeyword(entity, keyword);
private IConditionBuilder KeywordCondition(IDamageSpecification spec, IKeywordBuilder keyword) => ValueConditionBuilder.Create( (ps, k) => BuildKeywordStat(spec, ps.ModifierSourceEntity, k.Build(ps)), keyword);
protected override IStat BuildKeywordStat(IDamageSpecification spec, Entity entity, Keyword keyword) => StatFactory.MainSkillPartCastRateHasKeyword(entity, keyword);
private IStat BuildKeywordStat(IDamageSpecification spec, BuildParameters parameters, IKeywordBuilder keyword) { return(StatFactory.ActiveSkillPartDamageHasKeyword(parameters.ModifierSourceEntity, keyword.Build(), spec.DamageSource)); }
private static IStat ConcretizeDamage(IDamageSpecification spec) => new Stat($"Damage.{spec.StatIdentitySuffix}");
private IReadOnlyList <IStat> ConcretizeStats(IDamageSpecification spec, IEnumerable <IStat> resultStats) => resultStats.Select(s => _statFactory.ConcretizeDamage(s, spec)).ToList();