mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:03:11 +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 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 objectIndex,
|
||||||
|
IEnumerable<TaikoDifficultyHitObjectRhythm> commonRhythms)
|
||||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, int n, IEnumerable<TaikoDifficultyHitObjectRhythm> commonRhythms)
|
|
||||||
: base(hitObject, lastObject, clockRate)
|
: base(hitObject, lastObject, clockRate)
|
||||||
{
|
{
|
||||||
var currentHit = hitObject as Hit;
|
var currentHit = hitObject as Hit;
|
||||||
|
|
||||||
NoteLength = DeltaTime;
|
|
||||||
double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate;
|
double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate;
|
||||||
Rhythm = getClosestRhythm(NoteLength / prevLength, commonRhythms);
|
|
||||||
|
Rhythm = getClosestRhythm(DeltaTime / prevLength, commonRhythms);
|
||||||
IsKat = currentHit?.Type == HitType.Rim;
|
IsKat = currentHit?.Type == HitType.Rim;
|
||||||
|
|
||||||
N = n;
|
ObjectIndex = objectIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TaikoDifficultyHitObjectRhythm getClosestRhythm(double ratio, IEnumerable<TaikoDifficultyHitObjectRhythm> commonRhythms)
|
private TaikoDifficultyHitObjectRhythm getClosestRhythm(double ratio, IEnumerable<TaikoDifficultyHitObjectRhythm> commonRhythms)
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
|
|
||||||
if (samePattern) // Repetition found!
|
if (samePattern) // Repetition found!
|
||||||
{
|
{
|
||||||
int notesSince = hitobject.N - rhythmHistory[start].N;
|
int notesSince = hitobject.ObjectIndex - rhythmHistory[start].ObjectIndex;
|
||||||
penalty *= repetitionPenalty(notesSince);
|
penalty *= repetitionPenalty(notesSince);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
|
|
||||||
objectStrain *= repetitionPenalties(hitobject);
|
objectStrain *= repetitionPenalties(hitobject);
|
||||||
objectStrain *= patternLengthPenalty(notesSinceRhythmChange);
|
objectStrain *= patternLengthPenalty(notesSinceRhythmChange);
|
||||||
objectStrain *= speedPenalty(hitobject.NoteLength);
|
objectStrain *= speedPenalty(hitobject.DeltaTime);
|
||||||
|
|
||||||
notesSinceRhythmChange = 0;
|
notesSinceRhythmChange = 0;
|
||||||
|
|
||||||
|
@ -49,14 +49,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
|
|
||||||
TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current;
|
TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current;
|
||||||
|
|
||||||
if (hitObject.N % 2 == hand)
|
if (hitObject.ObjectIndex % 2 == hand)
|
||||||
{
|
{
|
||||||
double objectStrain = 1;
|
double objectStrain = 1;
|
||||||
|
|
||||||
if (hitObject.N == 1)
|
if (hitObject.ObjectIndex == 1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
notePairDurationHistory.Add(hitObject.NoteLength + offhandObjectDuration);
|
notePairDurationHistory.Add(hitObject.DeltaTime + offhandObjectDuration);
|
||||||
|
|
||||||
if (notePairDurationHistory.Count > max_history_length)
|
if (notePairDurationHistory.Count > max_history_length)
|
||||||
notePairDurationHistory.RemoveAt(0);
|
notePairDurationHistory.RemoveAt(0);
|
||||||
@ -65,12 +65,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
objectStrain += speedBonus(shortestRecentNote);
|
objectStrain += speedBonus(shortestRecentNote);
|
||||||
|
|
||||||
if (hitObject.StaminaCheese)
|
if (hitObject.StaminaCheese)
|
||||||
objectStrain *= cheesePenalty(hitObject.NoteLength + offhandObjectDuration);
|
objectStrain *= cheesePenalty(hitObject.DeltaTime + offhandObjectDuration);
|
||||||
|
|
||||||
return objectStrain;
|
return objectStrain;
|
||||||
}
|
}
|
||||||
|
|
||||||
offhandObjectDuration = hitObject.NoteLength;
|
offhandObjectDuration = hitObject.DeltaTime;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user