From d2a03f1146dc8257c1ffec299272edeff3f05d03 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Aug 2020 00:59:22 +0900 Subject: [PATCH] Refactor TaikoDifficultyHitObject --- .../Preprocessing/TaikoDifficultyHitObject.cs | 13 ++++++------- osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs | 4 ++-- .../Difficulty/Skills/Stamina.cs | 10 +++++----- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index cd45db2119..d0f621f4ad 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -17,21 +17,20 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing public bool StaminaCheese = false; - public readonly double NoteLength; + public readonly int ObjectIndex; - public readonly int N; - - public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, int n, IEnumerable commonRhythms) + public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, int objectIndex, + IEnumerable commonRhythms) : base(hitObject, lastObject, clockRate) { var currentHit = hitObject as Hit; - NoteLength = DeltaTime; double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate; - Rhythm = getClosestRhythm(NoteLength / prevLength, commonRhythms); + + Rhythm = getClosestRhythm(DeltaTime / prevLength, commonRhythms); IsKat = currentHit?.Type == HitType.Rim; - N = n; + ObjectIndex = objectIndex; } private TaikoDifficultyHitObjectRhythm getClosestRhythm(double ratio, IEnumerable commonRhythms) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs index c3e6ee4d12..31dc93a6b2 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills if (samePattern) // Repetition found! { - int notesSince = hitobject.N - rhythmHistory[start].N; + int notesSince = hitobject.ObjectIndex - rhythmHistory[start].ObjectIndex; penalty *= repetitionPenalty(notesSince); break; } @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills objectStrain *= repetitionPenalties(hitobject); objectStrain *= patternLengthPenalty(notesSinceRhythmChange); - objectStrain *= speedPenalty(hitobject.NoteLength); + objectStrain *= speedPenalty(hitobject.DeltaTime); notesSinceRhythmChange = 0; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 29c1c3c322..c9a691a2aa 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -49,14 +49,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current; - if (hitObject.N % 2 == hand) + if (hitObject.ObjectIndex % 2 == hand) { double objectStrain = 1; - if (hitObject.N == 1) + if (hitObject.ObjectIndex == 1) return 1; - notePairDurationHistory.Add(hitObject.NoteLength + offhandObjectDuration); + notePairDurationHistory.Add(hitObject.DeltaTime + offhandObjectDuration); if (notePairDurationHistory.Count > max_history_length) notePairDurationHistory.RemoveAt(0); @@ -65,12 +65,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills objectStrain += speedBonus(shortestRecentNote); if (hitObject.StaminaCheese) - objectStrain *= cheesePenalty(hitObject.NoteLength + offhandObjectDuration); + objectStrain *= cheesePenalty(hitObject.DeltaTime + offhandObjectDuration); return objectStrain; } - offhandObjectDuration = hitObject.NoteLength; + offhandObjectDuration = hitObject.DeltaTime; return 0; }