mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Do not use statics
This commit is contained in:
parent
779af48802
commit
b0ed39f32b
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
public readonly int n;
|
||||
private int counter = 0;
|
||||
|
||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate)
|
||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, TaikoDifficultyHitObjectRhythm rhythm)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
var lastHit = lastObject as Hit;
|
||||
@ -31,11 +31,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
|
||||
NoteLength = DeltaTime;
|
||||
double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate;
|
||||
Rhythm = TaikoDifficultyHitObjectRhythm.GetClosest(NoteLength / prevLength);
|
||||
Rhythm = rhythm.GetClosest(NoteLength / prevLength);
|
||||
RhythmID = Rhythm.ID;
|
||||
HasTypeChange = lastHit?.Type != currentHit?.Type;
|
||||
IsKat = lastHit?.Type == HitType.Rim;
|
||||
HasTimingChange = !TaikoDifficultyHitObjectRhythm.IsRepeat(RhythmID);
|
||||
HasTimingChange = !rhythm.IsRepeat(RhythmID);
|
||||
|
||||
n = counter;
|
||||
counter++;
|
||||
|
@ -7,18 +7,36 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
{
|
||||
public class TaikoDifficultyHitObjectRhythm
|
||||
{
|
||||
|
||||
private static TaikoDifficultyHitObjectRhythm[] commonRhythms;
|
||||
private static TaikoDifficultyHitObjectRhythm constRhythm;
|
||||
private static int constRhythmID;
|
||||
private readonly TaikoDifficultyHitObjectRhythm[] commonRhythms;
|
||||
private readonly TaikoDifficultyHitObjectRhythm constRhythm;
|
||||
private int constRhythmID;
|
||||
|
||||
public int ID = 0;
|
||||
public readonly double Difficulty;
|
||||
private readonly double ratio;
|
||||
|
||||
private static void initialiseCommonRhythms()
|
||||
public bool IsRepeat()
|
||||
{
|
||||
return ID == constRhythmID;
|
||||
}
|
||||
|
||||
public bool IsRepeat(int id)
|
||||
{
|
||||
return id == constRhythmID;
|
||||
}
|
||||
|
||||
public bool IsSpeedup()
|
||||
{
|
||||
return ratio < 1.0;
|
||||
}
|
||||
|
||||
public bool IsLargeSpeedup()
|
||||
{
|
||||
return ratio < 0.49;
|
||||
}
|
||||
|
||||
public TaikoDifficultyHitObjectRhythm()
|
||||
{
|
||||
/*
|
||||
|
||||
ALCHYRS CODE
|
||||
@ -40,8 +58,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
|
||||
*/
|
||||
|
||||
|
||||
commonRhythms = new TaikoDifficultyHitObjectRhythm[]
|
||||
commonRhythms = new[]
|
||||
{
|
||||
new TaikoDifficultyHitObjectRhythm(1, 1, 0.1),
|
||||
new TaikoDifficultyHitObjectRhythm(2, 1, 0.3),
|
||||
@ -61,33 +78,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
|
||||
constRhythmID = 0;
|
||||
constRhythm = commonRhythms[constRhythmID];
|
||||
|
||||
}
|
||||
|
||||
public bool IsRepeat()
|
||||
{
|
||||
return ID == constRhythmID;
|
||||
}
|
||||
|
||||
public static bool IsRepeat(int id)
|
||||
{
|
||||
return id == constRhythmID;
|
||||
}
|
||||
|
||||
public bool IsSpeedup()
|
||||
{
|
||||
return ratio < 1.0;
|
||||
}
|
||||
|
||||
public bool IsLargeSpeedup()
|
||||
{
|
||||
return ratio < 0.49;
|
||||
}
|
||||
|
||||
private TaikoDifficultyHitObjectRhythm(double ratio, double difficulty)
|
||||
{
|
||||
this.ratio = ratio;
|
||||
this.Difficulty = difficulty;
|
||||
}
|
||||
|
||||
private TaikoDifficultyHitObjectRhythm(int numerator, int denominator, double difficulty)
|
||||
@ -97,13 +87,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
}
|
||||
|
||||
// Code is inefficient - we are searching exhaustively through the sorted list commonRhythms
|
||||
public static TaikoDifficultyHitObjectRhythm GetClosest(double ratio)
|
||||
public TaikoDifficultyHitObjectRhythm GetClosest(double ratio)
|
||||
{
|
||||
if (commonRhythms == null)
|
||||
{
|
||||
initialiseCommonRhythms();
|
||||
}
|
||||
|
||||
TaikoDifficultyHitObjectRhythm closestRhythm = commonRhythms[0];
|
||||
double closestDistance = Double.MaxValue;
|
||||
|
||||
@ -117,8 +102,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
}
|
||||
|
||||
return closestRhythm;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
||||
private ColourSwitch lastColourSwitch = ColourSwitch.None;
|
||||
private int sameColourCount = 1;
|
||||
|
||||
private int[] previousDonLengths = { 0, 0 }, previousKatLengths = { 0, 0 };
|
||||
private readonly int[] previousDonLengths = { 0, 0 };
|
||||
private readonly int[] previousKatLengths = { 0, 0 };
|
||||
|
||||
private int sameTypeCount = 1;
|
||||
|
||||
// TODO: make this smarter (dont initialise with "Don")
|
||||
private bool previousIsKat = false;
|
||||
private bool previousIsKat;
|
||||
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
|
@ -14,13 +14,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
||||
protected override double SkillMultiplier => 1;
|
||||
protected override double StrainDecayBase => 0;
|
||||
private const double strain_decay = 0.96;
|
||||
private double currentStrain = 0.0;
|
||||
private double currentStrain;
|
||||
|
||||
private readonly List<TaikoDifficultyHitObject> ratioObjectHistory = new List<TaikoDifficultyHitObject>();
|
||||
private int ratioHistoryLength = 0;
|
||||
private int ratioHistoryLength;
|
||||
private const int ratio_history_max_length = 8;
|
||||
|
||||
private int rhythmLength = 0;
|
||||
private int rhythmLength;
|
||||
|
||||
// Penalty for repeated sequences of rhythm changes
|
||||
private double repititionPenalty(double timeSinceRepititionMS)
|
||||
|
@ -117,10 +117,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||
{
|
||||
List<TaikoDifficultyHitObject> taikoDifficultyHitObjects = new List<TaikoDifficultyHitObject>();
|
||||
var rhythm = new TaikoDifficultyHitObjectRhythm();
|
||||
|
||||
for (int i = 2; i < beatmap.HitObjects.Count; i++)
|
||||
{
|
||||
taikoDifficultyHitObjects.Add(new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate));
|
||||
taikoDifficultyHitObjects.Add(new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, rhythm));
|
||||
}
|
||||
|
||||
new StaminaCheeseDetector().FindCheese(taikoDifficultyHitObjects);
|
||||
|
Loading…
Reference in New Issue
Block a user