// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm.Data; namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm { /// /// Stores rhythm data for a . /// public class TaikoRhythmData { /// /// The group of hit objects with consistent rhythm that this object belongs to. /// public SameRhythmHitObjectGrouping? SameRhythmGroupedHitObjects; /// /// The larger pattern of rhythm groups that this object is part of. /// public SamePatternsGroupedHitObjects? SamePatternsGroupedHitObjects; /// /// The ratio of current /// to previous for the rhythm change. /// A above 1 indicates a slow-down; a below 1 indicates a speed-up. /// /// /// This is snapped to the closest matching . /// public readonly double Ratio; /// /// Initialises a new instance of s, /// calculating the closest rhythm change and its associated difficulty for the current hit object. /// /// The current being processed. public TaikoRhythmData(TaikoDifficultyHitObject current) { var previous = current.Previous(0); if (previous == null) { Ratio = 1; return; } double actualRatio = current.DeltaTime / previous.DeltaTime; double closestRatio = common_ratios.OrderBy(r => Math.Abs(r - actualRatio)).First(); Ratio = closestRatio; } /// /// List of most common rhythm changes in taiko maps. Based on how each object's interval compares to the previous object. /// /// /// The general guidelines for the values are: /// /// rhythm changes with ratio closer to 1 (that are not 1) are harder to play, /// speeding up is generally harder than slowing down (with exceptions of rhythm changes requiring a hand switch). /// /// private static readonly double[] common_ratios = new[] { 1.0 / 1, 2.0 / 1, 1.0 / 2, 3.0 / 1, 1.0 / 3, 3.0 / 2, 2.0 / 3, 5.0 / 4, 4.0 / 5 }; } }