Exemplo n.º 1
0
        /// <summary>
        /// Calculates the difficulty of the beatmap using a specific mod combination and returns a set of <see cref="TimedDifficultyAttributes"/> representing the difficulty at every relevant time value in the beatmap.
        /// </summary>
        /// <param name="mods">The mods that should be applied to the beatmap.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The set of <see cref="TimedDifficultyAttributes"/>.</returns>
        public List <TimedDifficultyAttributes> CalculateTimed([NotNull] IEnumerable <Mod> mods, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();
            preProcess(mods, cancellationToken);

            var attribs = new List <TimedDifficultyAttributes>();

            if (!Beatmap.HitObjects.Any())
            {
                return(attribs);
            }

            var skills             = CreateSkills(Beatmap, playableMods, clockRate);
            var progressiveBeatmap = new ProgressiveCalculationBeatmap(Beatmap);

            foreach (var hitObject in getDifficultyHitObjects())
            {
                progressiveBeatmap.HitObjects.Add(hitObject.BaseObject);

                foreach (var skill in skills)
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    skill.ProcessInternal(hitObject);
                }

                attribs.Add(new TimedDifficultyAttributes(hitObject.EndTime * clockRate, CreateDifficultyAttributes(progressiveBeatmap, playableMods, skills, clockRate)));
            }

            return(attribs);
        }
Exemplo n.º 2
0
        public List <TimedDifficultyAttributes> CalculateTimed(params Mod[] mods)
        {
            preProcess(mods);

            var attribs = new List <TimedDifficultyAttributes>();

            if (!Beatmap.HitObjects.Any())
            {
                return(attribs);
            }

            var skills             = CreateSkills(Beatmap, playableMods, clockRate);
            var progressiveBeatmap = new ProgressiveCalculationBeatmap(Beatmap);

            foreach (var hitObject in getDifficultyHitObjects())
            {
                progressiveBeatmap.HitObjects.Add(hitObject.BaseObject);

                foreach (var skill in skills)
                {
                    skill.ProcessInternal(hitObject);
                }

                attribs.Add(new TimedDifficultyAttributes(hitObject.EndTime, CreateDifficultyAttributes(progressiveBeatmap, playableMods, skills, clockRate)));
            }

            return(attribs);
        }