// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Utils; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Difficulty.Skills { /// /// A bare minimal abstract skill for fully custom skill implementations. /// /// /// This class should be considered a "processing" class and not persisted, as it keeps references to /// gameplay objects after processing is run (see ). /// public abstract class Skill { /// /// s that were processed previously. They can affect the strain values of the following objects. /// protected readonly ReverseQueue Previous; /// /// Number of previous s to keep inside the queue. /// protected virtual int HistoryLength => 1; /// /// Mods for use in skill calculations. /// protected IReadOnlyList Mods => mods; private readonly Mod[] mods; protected Skill(Mod[] mods) { this.mods = mods; Previous = new ReverseQueue(HistoryLength + 1); } internal void ProcessInternal(DifficultyHitObject current) { while (Previous.Count > HistoryLength) Previous.Dequeue(); Process(current); Previous.Enqueue(current); } /// /// Process a . /// /// The to process. protected abstract void Process(DifficultyHitObject current); /// /// Returns the calculated difficulty value representing all s that have been processed up to this point. /// public abstract double DifficultyValue(); } }