1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 00:42:55 +08:00

Rename Colour / Rhythm related fields and classes

This commit is contained in:
Dean Herbert 2025-02-05 15:01:59 +09:00
parent f3c17f1c2b
commit fa844b0ebc
No known key found for this signature in database
10 changed files with 48 additions and 49 deletions

View File

@ -34,8 +34,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
var previousHitObject = (TaikoDifficultyHitObject)current.Previous(1);
double currentRatio = current.Rhythm.Ratio;
double previousRatio = previousHitObject.Rhythm.Ratio;
double currentRatio = current.RhythmData.Ratio;
double previousRatio = previousHitObject.RhythmData.Ratio;
// A consistent interval is defined as the percentage difference between the two rhythmic ratios with the margin of error.
if (Math.Abs(1 - currentRatio / previousRatio) <= threshold)
@ -61,17 +61,17 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
public static double EvaluateDifficultyOf(DifficultyHitObject hitObject)
{
var taikoObject = (TaikoDifficultyHitObject)hitObject;
TaikoDifficultyHitObjectColour colour = taikoObject.Colour;
TaikoColourData colourData = taikoObject.ColourData;
double difficulty = 0.0d;
if (colour.MonoStreak?.FirstHitObject == hitObject) // Difficulty for MonoStreak
difficulty += evaluateMonoStreakDifficulty(colour.MonoStreak);
if (colourData.MonoStreak?.FirstHitObject == hitObject) // Difficulty for MonoStreak
difficulty += evaluateMonoStreakDifficulty(colourData.MonoStreak);
if (colour.AlternatingMonoPattern?.FirstHitObject == hitObject) // Difficulty for AlternatingMonoPattern
difficulty += evaluateAlternatingMonoPatternDifficulty(colour.AlternatingMonoPattern);
if (colourData.AlternatingMonoPattern?.FirstHitObject == hitObject) // Difficulty for AlternatingMonoPattern
difficulty += evaluateAlternatingMonoPatternDifficulty(colourData.AlternatingMonoPattern);
if (colour.RepeatingHitPattern?.FirstHitObject == hitObject) // Difficulty for RepeatingHitPattern
difficulty += evaluateRepeatingHitPatternsDifficulty(colour.RepeatingHitPattern);
if (colourData.RepeatingHitPattern?.FirstHitObject == hitObject) // Difficulty for RepeatingHitPattern
difficulty += evaluateRepeatingHitPatternsDifficulty(colourData.RepeatingHitPattern);
double consistencyPenalty = consistentRatioPenalty(taikoObject);
difficulty *= consistencyPenalty;

View File

@ -18,21 +18,21 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
/// </summary>
public static double EvaluateDifficultyOf(DifficultyHitObject hitObject, double hitWindow)
{
TaikoDifficultyHitObjectRhythm rhythm = ((TaikoDifficultyHitObject)hitObject).Rhythm;
TaikoRhythmData rhythmData = ((TaikoDifficultyHitObject)hitObject).RhythmData;
double difficulty = 0.0d;
double sameRhythm = 0;
double samePattern = 0;
double intervalPenalty = 0;
if (rhythm.SameRhythmGroupedHitObjects?.FirstHitObject == hitObject) // Difficulty for SameRhythmGroupedHitObjects
if (rhythmData.SameRhythmGroupedHitObjects?.FirstHitObject == hitObject) // Difficulty for SameRhythmGroupedHitObjects
{
sameRhythm += 10.0 * evaluateDifficultyOf(rhythm.SameRhythmGroupedHitObjects, hitWindow);
intervalPenalty = repeatedIntervalPenalty(rhythm.SameRhythmGroupedHitObjects, hitWindow);
sameRhythm += 10.0 * evaluateDifficultyOf(rhythmData.SameRhythmGroupedHitObjects, hitWindow);
intervalPenalty = repeatedIntervalPenalty(rhythmData.SameRhythmGroupedHitObjects, hitWindow);
}
if (rhythm.SamePatternsGroupedHitObjects?.FirstHitObject == hitObject) // Difficulty for SamePatternsGroupedHitObjects
samePattern += 1.15 * ratioDifficulty(rhythm.SamePatternsGroupedHitObjects.IntervalRatio);
if (rhythmData.SamePatternsGroupedHitObjects?.FirstHitObject == hitObject) // Difficulty for SamePatternsGroupedHitObjects
samePattern += 1.15 * ratioDifficulty(rhythmData.SamePatternsGroupedHitObjects.IntervalRatio);
difficulty += Math.Max(sameRhythm, samePattern) * intervalPenalty;

View File

@ -55,8 +55,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
/// </summary>
private static int availableFingersFor(TaikoDifficultyHitObject hitObject)
{
DifficultyHitObject? previousColourChange = hitObject.Colour.PreviousColourChange;
DifficultyHitObject? nextColourChange = hitObject.Colour.NextColourChange;
DifficultyHitObject? previousColourChange = hitObject.ColourData.PreviousColourChange;
DifficultyHitObject? nextColourChange = hitObject.ColourData.NextColourChange;
if (previousColourChange != null && hitObject.StartTime - previousColourChange.StartTime < 300)
{

View File

@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
/// <summary>
/// Stores colour compression information for a <see cref="TaikoDifficultyHitObject"/>.
/// </summary>
public class TaikoDifficultyHitObjectColour
public class TaikoColourData
{
/// <summary>
/// The <see cref="MonoStreak"/> that encodes this note.

View File

@ -14,8 +14,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
public static class TaikoColourDifficultyPreprocessor
{
/// <summary>
/// Processes and encodes a list of <see cref="TaikoDifficultyHitObject"/>s into a list of <see cref="TaikoDifficultyHitObjectColour"/>s,
/// assigning the appropriate <see cref="TaikoDifficultyHitObjectColour"/>s to each <see cref="TaikoDifficultyHitObject"/>.
/// Processes and encodes a list of <see cref="TaikoDifficultyHitObject"/>s into a list of <see cref="TaikoColourData"/>s,
/// assigning the appropriate <see cref="TaikoColourData"/>s to each <see cref="TaikoDifficultyHitObject"/>.
/// </summary>
public static void ProcessAndAssign(List<DifficultyHitObject> hitObjects)
{
@ -41,9 +41,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
foreach (var hitObject in monoStreak.HitObjects)
{
hitObject.Colour.RepeatingHitPattern = repeatingHitPattern;
hitObject.Colour.AlternatingMonoPattern = monoPattern;
hitObject.Colour.MonoStreak = monoStreak;
hitObject.ColourData.RepeatingHitPattern = repeatingHitPattern;
hitObject.ColourData.AlternatingMonoPattern = monoPattern;
hitObject.ColourData.MonoStreak = monoStreak;
}
}
}

View File

@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
/// <summary>
/// Stores rhythm data for a <see cref="TaikoDifficultyHitObject"/>.
/// </summary>
public class TaikoDifficultyHitObjectRhythm
public class TaikoRhythmData
{
/// <summary>
/// The group of hit objects with consistent rhythm that this object belongs to.
@ -39,25 +39,25 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
/// <item>speeding up is <i>generally</i> harder than slowing down (with exceptions of rhythm changes requiring a hand switch).</item>
/// </list>
/// </remarks>
private static readonly TaikoDifficultyHitObjectRhythm[] common_rhythms =
private static readonly TaikoRhythmData[] common_rhythms =
{
new TaikoDifficultyHitObjectRhythm(1, 1),
new TaikoDifficultyHitObjectRhythm(2, 1),
new TaikoDifficultyHitObjectRhythm(1, 2),
new TaikoDifficultyHitObjectRhythm(3, 1),
new TaikoDifficultyHitObjectRhythm(1, 3),
new TaikoDifficultyHitObjectRhythm(3, 2),
new TaikoDifficultyHitObjectRhythm(2, 3),
new TaikoDifficultyHitObjectRhythm(5, 4),
new TaikoDifficultyHitObjectRhythm(4, 5)
new TaikoRhythmData(1, 1),
new TaikoRhythmData(2, 1),
new TaikoRhythmData(1, 2),
new TaikoRhythmData(3, 1),
new TaikoRhythmData(1, 3),
new TaikoRhythmData(3, 2),
new TaikoRhythmData(2, 3),
new TaikoRhythmData(5, 4),
new TaikoRhythmData(4, 5)
};
/// <summary>
/// Initialises a new instance of <see cref="TaikoDifficultyHitObjectRhythm"/>s,
/// Initialises a new instance of <see cref="TaikoRhythmData"/>s,
/// calculating the closest rhythm change and its associated difficulty for the current hit object.
/// </summary>
/// <param name="current">The current <see cref="TaikoDifficultyHitObject"/> being processed.</param>
public TaikoDifficultyHitObjectRhythm(TaikoDifficultyHitObject current)
public TaikoRhythmData(TaikoDifficultyHitObject current)
{
var previous = current.Previous(0);
@ -67,8 +67,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
return;
}
TaikoDifficultyHitObjectRhythm closestRhythm = getClosestRhythm(current.DeltaTime, previous.DeltaTime);
Ratio = closestRhythm.Ratio;
TaikoRhythmData closestRhythmData = getClosestRhythm(current.DeltaTime, previous.DeltaTime);
Ratio = closestRhythmData.Ratio;
}
/// <summary>
@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
/// </summary>
/// <param name="numerator">The numerator for <see cref="Ratio"/>.</param>
/// <param name="denominator">The denominator for <see cref="Ratio"/></param>
private TaikoDifficultyHitObjectRhythm(int numerator, int denominator)
private TaikoRhythmData(int numerator, int denominator)
{
Ratio = numerator / (double)denominator;
}
@ -88,11 +88,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
/// <param name="currentDeltaTime">The time difference between the current hit object and the previous one.</param>
/// <param name="previousDeltaTime">The time difference between the previous hit object and the one before it.</param>
/// <returns>The closest matching rhythm from <see cref="common_rhythms"/>.</returns>
private TaikoDifficultyHitObjectRhythm getClosestRhythm(double currentDeltaTime, double previousDeltaTime)
private TaikoRhythmData getClosestRhythm(double currentDeltaTime, double previousDeltaTime)
{
double ratio = currentDeltaTime / previousDeltaTime;
return common_rhythms.OrderBy(x => Math.Abs(x.Ratio - ratio)).First();
}
}
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
{
foreach (var hitObject in rhythmGroup.HitObjects)
{
hitObject.Rhythm.SameRhythmGroupedHitObjects = rhythmGroup;
hitObject.RhythmData.SameRhythmGroupedHitObjects = rhythmGroup;
hitObject.HitObjectInterval = rhythmGroup.HitObjectInterval;
}
}
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
{
foreach (var hitObject in patternGroup.AllHitObjects)
{
hitObject.Rhythm.SamePatternsGroupedHitObjects = patternGroup;
hitObject.RhythmData.SamePatternsGroupedHitObjects = patternGroup;
}
}
}

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
/// <summary>
/// The rhythm required to hit this hit object.
/// </summary>
public readonly TaikoDifficultyHitObjectRhythm Rhythm;
public readonly TaikoRhythmData RhythmData;
/// <summary>
/// The interval between this hit object and the surrounding hit objects in its rhythm group.
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
/// Colour data for this hit object. This is used by colour evaluator to calculate colour difficulty, but can be used
/// by other skills in the future.
/// </summary>
public readonly TaikoDifficultyHitObjectColour Colour;
public readonly TaikoColourData ColourData;
/// <summary>
/// The adjusted BPM of this hit object, based on its slider velocity and scroll speed.
@ -92,10 +92,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
noteDifficultyHitObjects = noteObjects;
// Create the Colour object, its properties should be filled in by TaikoDifficultyPreprocessor
Colour = new TaikoDifficultyHitObjectColour();
ColourData = new TaikoColourData();
// Create a Rhythm object, its properties are filled in by TaikoDifficultyHitObjectRhythm
Rhythm = new TaikoDifficultyHitObjectRhythm(this);
RhythmData = new TaikoRhythmData(this);
switch ((hitObject as Hit)?.Type)
{

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
}
var taikoObject = (TaikoDifficultyHitObject)current;
int index = taikoObject.Colour.MonoStreak?.HitObjects.IndexOf(taikoObject) ?? 0;
int index = taikoObject.ColourData.MonoStreak?.HitObjects.IndexOf(taikoObject) ?? 0;
currentStrain *= DifficultyCalculationUtils.Logistic(index, 4, -1 / 25.0, 0.5) + 0.5;

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
// Safely prevents previous strains from shifting as new notes are added.
var currentObject = current as TaikoDifficultyHitObject;
int index = currentObject?.Colour.MonoStreak?.HitObjects.IndexOf(currentObject) ?? 0;
int index = currentObject?.ColourData.MonoStreak?.HitObjects.IndexOf(currentObject) ?? 0;
double monolengthBonus = isConvert ? 1 : 1 + Math.Min(Math.Max((index - 5) / 50.0, 0), 0.30);