예제 #1
0
        private static PassiveNodeParser CreateSut(PassiveNodeDefinition nodeDefinition, ICoreParser coreParser = null)
        {
            coreParser = coreParser ?? Mock.Of <ICoreParser>();
            var treeDefinition = new PassiveTreeDefinition(new[] { nodeDefinition });

            return(new PassiveNodeParser(treeDefinition, CreateBuilderFactories(), coreParser));
        }
 public JewelInSkillTreeParser(
     PassiveTreeDefinition tree, IBuilderFactories builderFactories, ICoreParser coreParser)
 {
     _tree = tree;
     _transformationParser = CompositeTransformationJewelParser.Create(
         i => builderFactories.PassiveTreeBuilders.NodeEffectiveness(i).Value);
     _coreParser = coreParser;
 }
예제 #3
0
 public CompositionRoot()
 {
     _gameData = new Lazy <GameData>(
         () => new GameData(PassiveTreeDefinition.CreateKeystoneDefinitions(), true));
     _builderFactories = new Lazy <Task <IBuilderFactories> >(
         () => Builders.BuilderFactories.CreateAsync(_gameData.Value));
     _parser = new Lazy <Task <IParser> >(
         () => Parser <ParsingStep> .CreateAsync(_gameData.Value, _builderFactories.Value,
                                                 ParsingData.CreateAsync(_gameData.Value, _builderFactories.Value)));
 }
예제 #4
0
        public AttributesInJewelRadiusViewModel(PassiveTreeDefinition tree, IBuilderFactories builders, ObservableCalculator calculator)
        {
            _tree       = tree;
            _builders   = builders;
            _calculator = calculator;

            _strengthStatBuilder     = new Lazy <IStatBuilder>(() => _builders.StatBuilders.Attribute.Strength);
            _dexterityStatBuilder    = new Lazy <IStatBuilder>(() => _builders.StatBuilders.Attribute.Dexterity);
            _intelligenceStatBuilder = new Lazy <IStatBuilder>(() => _builders.StatBuilders.Attribute.Intelligence);
        }
 public CompositionRoot()
 {
     _gameData = new Lazy <GameData>(
         () => new GameData(PassiveTreeDefinition.CreateKeystoneDefinitions(), true));
     _calculator       = new Lazy <ICalculator>(Core.Calculator.Create);
     _builderFactories = new Lazy <Task <IBuilderFactories> >(
         () => Builders.BuilderFactories.CreateAsync(_gameData.Value));
     _parser = new Lazy <Task <IParser> >(
         async() => await Parser <ParsingStep> .CreateAsync(_gameData.Value, _builderFactories.Value,
                                                            ParsingData.CreateAsync(_gameData.Value, _builderFactories.Value)).ConfigureAwait(false));
 }
예제 #6
0
        public IObservable <CalculatorUpdate> InitialParse(PassiveTreeDefinition passiveTreeDefinition, TimeSpan bufferTimeSpan)
        {
            var givenResultObservable = _parser.CreateGivenModifierParseDelegates().ToObservable()
                                        .ObserveOn(_parsingScheduler)
                                        .SelectMany(d => d());
            var passiveNodesObservable = passiveTreeDefinition.Nodes.ToObservable()
                                         .ObserveOn(_parsingScheduler)
                                         .SelectMany(n => _parser.ParsePassiveNode(n.Id).Modifiers);

            return(givenResultObservable.Merge(passiveNodesObservable)
                   .Buffer(bufferTimeSpan)
                   .Where(ms => ms.Any())
                   .Select(ms => new CalculatorUpdate(ms.ToList(), Array.Empty <Modifier>())));
        }
예제 #7
0
        public void ReturnsCorrectModifier(ushort nodeId)
        {
            var definition = new PassiveNodeDefinition(nodeId, PassiveNodeType.Normal, "", false,
                                                       true, 0, new string[0]);
            var expected = new[]
            {
                CreateModifier($"{nodeId}.Skilled", Form.TotalOverride, 1, CreateGlobalSource(definition))
            };
            var treeDefinition = new PassiveTreeDefinition(new[] { definition });
            var sut            = new SkilledPassiveNodeParser(treeDefinition, CreateBuilderFactories());

            var result = sut.Parse(nodeId);

            Assert.AreEqual(expected, result.Modifiers);
        }
예제 #8
0
 public static void CreateCompositionRoot()
 {
     if (_gameData is null)
     {
         _gameData = new Lazy <GameData>(
             () => new GameData(PassiveTreeDefinition.CreateKeystoneDefinitions()));
         _builderFactories = new Lazy <Task <IBuilderFactories> >(
             () => Builders.BuilderFactories.CreateAsync(_gameData.Value));
         _parsingData = new Lazy <Task <IParsingData <ParsingStep> > >(
             () => Data.ParsingData.CreateAsync(_gameData.Value, _builderFactories.Value));
         _parser = new Lazy <Task <IParser> >(
             () => Parser <ParsingStep> .CreateAsync(_gameData.Value, _builderFactories.Value,
                                                     _parsingData.Value));
     }
 }
예제 #9
0
        private ParsingData(
            IBuilderFactories builderFactories,
            SkillDefinitions skills, PassiveTreeDefinition passives,
            CharacterBaseStats characterBaseStats, MonsterBaseStats monsterBaseStats)
        {
            _builderFactories = builderFactories;

            _statMatchers = new Lazy <IReadOnlyList <IStatMatchers> >(
                () => CreateStatMatchers(ModifierBuilder.Empty, passives.Nodes));
            _referencedMatchers = new Lazy <IReadOnlyList <IReferencedMatchers> >(
                () => CreateReferencedMatchers(skills.Skills));
            _givenStats = new Lazy <IReadOnlyList <IGivenStats> >(
                () => new GivenStatsCollection(builderFactories, characterBaseStats, monsterBaseStats));
            _statMatchersSelector = new Lazy <StatMatchersSelector>(
                () => new StatMatchersSelector(StatMatchers));
        }
예제 #10
0
        private Parser(
            PassiveTreeDefinition passiveTree, BaseItemDefinitions baseItems, SkillDefinitions skills,
            StatTranslators statTranslators, IBuilderFactories builderFactories, IParsingData <TStep> parsingData)
        {
            _statTranslators = statTranslators;
            _coreParser      = new CoreParser <TStep>(parsingData, builderFactories);
            _givenStats      = parsingData.GivenStats;

            _passiveNodeParser        = Caching(new PassiveNodeParser(passiveTree, builderFactories, _coreParser));
            _skilledPassiveNodeParser = Caching(new SkilledPassiveNodeParser(passiveTree, builderFactories));
            _itemParser = Caching(new ItemParser(baseItems, builderFactories, _coreParser,
                                                 statTranslators[StatTranslationFileNames.Main]));
            _activeSkillParser =
                Caching(new ActiveSkillParser(skills, builderFactories, GetOrAddUntranslatedStatParser));
            _supportSkillParser =
                Caching(new SupportSkillParser(skills, builderFactories, GetOrAddUntranslatedStatParser));
            _skillsParser = new SkillsParser(skills, _activeSkillParser, _supportSkillParser);
        }
        public BuilderFactories(PassiveTreeDefinition tree, SkillDefinitions skills)
        {
            var statFactory = new StatFactory();

            ActionBuilders      = new ActionBuilders(statFactory);
            BuffBuilders        = new BuffBuilders(statFactory, skills);
            ChargeTypeBuilders  = new ChargeTypeBuilders(statFactory);
            ConditionBuilders   = new ConditionBuilders(statFactory);
            DamageTypeBuilders  = new DamageTypeBuilders(statFactory);
            EffectBuilders      = new EffectBuilders(statFactory);
            EntityBuilders      = new EntityBuilders(statFactory);
            EquipmentBuilders   = new EquipmentBuilders(statFactory);
            FormBuilders        = new FormBuilders();
            KeywordBuilders     = new KeywordBuilders();
            PassiveTreeBuilders = new PassiveTreeBuilders(statFactory, tree);
            SkillBuilders       = new SkillBuilders(statFactory, skills);
            StatBuilders        = new StatBuilders(statFactory);
            ValueBuilders       = new ValueBuilders();
            MetaStatBuilders    = new MetaStatBuilders(statFactory);
            MatchContexts       = new MatchContexts(statFactory);
        }
 public SkilledPassiveNodeParser(
     PassiveTreeDefinition passiveTreeDefinition, IBuilderFactories builderFactories)
 => (_passiveTreeDefinition, _builderFactories) = (passiveTreeDefinition, builderFactories);
 public PassiveNodeParser(
     PassiveTreeDefinition passiveTreeDefinition, IBuilderFactories builderFactories, ICoreParser coreParser)
 => (_passiveTreeDefinition, _builderFactories, _coreParser) =
 public PassiveTreeBuilders(IStatFactory statFactory, PassiveTreeDefinition tree) : base(statFactory)
 {
     _tree = tree;
 }