Пример #1
0
 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));
Пример #2
0
        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)
                });
            }
        }
Пример #3
0
 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));
Пример #4
0
 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));
Пример #5
0
        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)));
        }
Пример #6
0
 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)
     });
 }
Пример #7
0
 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));
 }
Пример #9
0
 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(
Пример #11
0
 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));
Пример #12
0
 public static bool IsSkillDamage(this IDamageSpecification @this) =>
 [email protected];
Пример #13
0
 protected virtual IStat BuildKeywordStat(IDamageSpecification spec, Entity entity, Keyword keyword)
 => StatFactory.MainSkillPartHasKeyword(entity, keyword);
Пример #14
0
 private IConditionBuilder KeywordCondition(IDamageSpecification spec, IKeywordBuilder keyword)
 => ValueConditionBuilder.Create(
     (ps, k) => BuildKeywordStat(spec, ps.ModifierSourceEntity, k.Build(ps)), keyword);
Пример #15
0
 protected override IStat BuildKeywordStat(IDamageSpecification spec, Entity entity, Keyword keyword)
 => StatFactory.MainSkillPartCastRateHasKeyword(entity, keyword);
Пример #16
0
 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();