mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:35:10 +08:00
Refactor TaikoDifficultyHitObject
This commit is contained in:
parent
90189fc40c
commit
d2a03f1146
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user