Exemple #1
0
 public DamageStatConcretizer(
     IStatFactory statFactory, DamageSpecificationBuilder specificationBuilder,
     bool canApplyToSkillDamage = false, bool canApplyToAilmentDamage = false)
     : this(statFactory, specificationBuilder,
            CanApplyToDefault(canApplyToSkillDamage), CanApplyToDefault(canApplyToAilmentDamage),
            _ => new NullConditionBuilder())
 {
 }
Exemple #2
0
 private DamageStatConcretizer WithCanApply(DamageSpecificationBuilder specificationBuilder,
                                            bool applyToSkillDamage = false, bool applyToAilmentDamage = false,
                                            Func <IDamageSpecification, IConditionBuilder>?condition = null)
 {
     return(new DamageStatConcretizer(_statFactory, specificationBuilder,
                                      CanApplyToSkillDamage && applyToSkillDamage ? true : _applyToSkillDamage,
                                      CanApplyToAilmentDamage && applyToAilmentDamage ? true : _applyToAilmentDamage,
                                      condition ?? _condition));
 }
Exemple #3
0
 private DamageStatConcretizer(
     IStatFactory statFactory, DamageSpecificationBuilder specificationBuilder,
     bool?applyToSkillDamage, bool?applyToAilmentDamage,
     Func <IDamageSpecification, IConditionBuilder> condition)
 {
     _statFactory          = statFactory;
     _specificationBuilder = specificationBuilder;
     _applyToSkillDamage   = applyToSkillDamage;
     _applyToAilmentDamage = applyToAilmentDamage;
     _condition            = condition;
 }
Exemple #4
0
        private IEnumerable <StatBuilderResult> ApplyToAilmentDamage(
            BuildParameters parameters, StatBuilderResult result, IEnumerable <IStat> sourceStats)
        {
            var specBuilder = new DamageSpecificationBuilder().WithAilments();
            var applyStats  = sourceStats.Select(
                s => _statFactory.ApplyModifiersToAilmentDamage(s, parameters.ModifierForm)).ToList();

            foreach (var spec in specBuilder.Build(parameters))
            {
                var stats          = ConcretizeStats(spec, result.Stats);
                var valueConverter = ValueConverterForResult(parameters, result, spec)
                                     .AndThen(ApplyToDamageValueConverter(applyStats));
                yield return(new StatBuilderResult(stats, result.ModifierSource, valueConverter));
            }
        }
Exemple #5
0
 private DamageStatConcretizer With(DamageSpecificationBuilder specificationBuilder) =>
 new DamageStatConcretizer(_statFactory, specificationBuilder, null, null, _condition);