public IEnumerable <StatBuilderResult> Build(BuildParameters parameters)
        {
            var results  = new List <StatBuilderResult>();
            var entities = _entity.Build(parameters.ModifierSourceEntity);

            foreach (var entity in entities)
            {
                var resultsForEntity = _inner.WithEntity(new EntityBuilder(entity)).Build(parameters);
                foreach (var(stats, source, valueConverter) in resultsForEntity)
                {
                    results.Add(new StatBuilderResult(stats, source, valueConverter.AndThen(ConvertValue)));
                }
                IValueBuilder ConvertValue(IValueBuilder left) => _combineValues(left, _createValue(entity));
            }
            return(results);
        }
        public IEnumerable <StatBuilderResult> Build(BuildParameters parameters)
        {
            var results  = new List <StatBuilderResult>();
            var entities = _entity.Build(parameters.ModifierSourceEntity);

            foreach (var entity in entities)
            {
                var resultsForEntity = _inner.WithEntity(new EntityBuilder(entity))
                                       .Build(parameters)
                                       .Select(r
                                               => new StatBuilderResult(r.Stats, r.ModifierSource, r.ValueConverter.AndThen(ConvertValue)));
                results.AddRange(resultsForEntity);

                IValueBuilder ConvertValue(IValueBuilder left)
                {
                    var right = new ValueBuilderImpl(_buildValue(parameters, entity));

                    return(_combineValues(left, right));
                }
            }
            return(results);
        }
 public ICoreStatBuilder WithEntity(IEntityBuilder entityBuilder) =>
 new StatBuilderWithModifierSource(_statBuilder.WithEntity(entityBuilder), _modifierSource);
Beispiel #4
0
 public ICoreStatBuilder WithEntity(IEntityBuilder entityBuilder) =>
 new StatBuilderWithStatConverter(_inner.WithEntity(entityBuilder), _statConverter);
 public ICoreStatBuilder WithEntity(IEntityBuilder entityBuilder) =>
 new ParametrisedCoreStatBuilder <TParameter>(_inner.WithEntity(entityBuilder), _parameter, _statConverter);