예제 #1
0
        public ParseResult Parse(SupportSkillParserParameter parameter)
        {
            var(active, support) = parameter;
            if (!active.IsEnabled || !support.IsEnabled)
            {
                return(ParseResult.Empty);
            }

            var modifiers   = new List <Modifier>();
            var parsedStats = new List <UntranslatedStat>();

            var preParser      = new SkillPreParser(_skillDefinitions, _builderFactories.MetaStatBuilders);
            var preParseResult = preParser.ParseSupport(active, support);

            foreach (var partialParser in _partialParsers)
            {
                var(newlyParsedModifiers, newlyParsedStats) = partialParser.Parse(active, support, preParseResult);
                modifiers.AddRange(newlyParsedModifiers);
                parsedStats.AddRange(newlyParsedStats);
            }

            var translatingParser = new TranslatingSkillParser(_builderFactories, _statParserFactory);

            return(translatingParser.Parse(support, preParseResult,
                                           new PartialSkillParseResult(modifiers, parsedStats)));
        }
예제 #2
0
        public ParseResult Parse(Skill skill)
        {
            if (!skill.IsEnabled)
            {
                return(ParseResult.Empty);
            }

            var modifiers   = new List <Modifier>();
            var parsedStats = new List <UntranslatedStat>();

            var preParser      = new SkillPreParser(_skillDefinitions, _builderFactories.MetaStatBuilders);
            var preParseResult = preParser.ParseActive(skill);

            foreach (var partialParser in _partialParsers)
            {
                var(newlyParsedModifiers, newlyParsedStats) = partialParser.Parse(skill, skill, preParseResult);
                modifiers.AddRange(newlyParsedModifiers);
                parsedStats.AddRange(newlyParsedStats);
            }

            var translatingParser = new TranslatingSkillParser(_builderFactories, _statParserFactory);

            return(translatingParser.Parse(skill, preParseResult, new PartialSkillParseResult(modifiers, parsedStats)));
        }