1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 13:33:52 +08:00

Refactor TaikoDifficultyHitObject

This commit is contained in:
smoogipoo 2020-08-13 00:59:22 +09:00
parent 90189fc40c
commit d2a03f1146
3 changed files with 13 additions and 14 deletions

View File

@ -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<TaikoDifficultyHitObjectRhythm> commonRhythms)
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, int objectIndex,
IEnumerable<TaikoDifficultyHitObjectRhythm> 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<TaikoDifficultyHitObjectRhythm> commonRhythms)

View File

@ -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;

View File

@ -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;
}