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;
|
public readonly int n;
|
||||||
private int counter = 0;
|
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)
|
: base(hitObject, lastObject, clockRate)
|
||||||
{
|
{
|
||||||
var lastHit = lastObject as Hit;
|
var lastHit = lastObject as Hit;
|
||||||
@ -31,11 +31,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
|
|
||||||
NoteLength = DeltaTime;
|
NoteLength = DeltaTime;
|
||||||
double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate;
|
double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate;
|
||||||
Rhythm = TaikoDifficultyHitObjectRhythm.GetClosest(NoteLength / prevLength);
|
Rhythm = rhythm.GetClosest(NoteLength / prevLength);
|
||||||
RhythmID = Rhythm.ID;
|
RhythmID = Rhythm.ID;
|
||||||
HasTypeChange = lastHit?.Type != currentHit?.Type;
|
HasTypeChange = lastHit?.Type != currentHit?.Type;
|
||||||
IsKat = lastHit?.Type == HitType.Rim;
|
IsKat = lastHit?.Type == HitType.Rim;
|
||||||
HasTimingChange = !TaikoDifficultyHitObjectRhythm.IsRepeat(RhythmID);
|
HasTimingChange = !rhythm.IsRepeat(RhythmID);
|
||||||
|
|
||||||
n = counter;
|
n = counter;
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -7,18 +7,36 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
{
|
{
|
||||||
public class TaikoDifficultyHitObjectRhythm
|
public class TaikoDifficultyHitObjectRhythm
|
||||||
{
|
{
|
||||||
|
private readonly TaikoDifficultyHitObjectRhythm[] commonRhythms;
|
||||||
private static TaikoDifficultyHitObjectRhythm[] commonRhythms;
|
private readonly TaikoDifficultyHitObjectRhythm constRhythm;
|
||||||
private static TaikoDifficultyHitObjectRhythm constRhythm;
|
private int constRhythmID;
|
||||||
private static int constRhythmID;
|
|
||||||
|
|
||||||
public int ID = 0;
|
public int ID = 0;
|
||||||
public readonly double Difficulty;
|
public readonly double Difficulty;
|
||||||
private readonly double ratio;
|
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
|
ALCHYRS CODE
|
||||||
@ -40,8 +58,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
commonRhythms = new[]
|
||||||
commonRhythms = new TaikoDifficultyHitObjectRhythm[]
|
|
||||||
{
|
{
|
||||||
new TaikoDifficultyHitObjectRhythm(1, 1, 0.1),
|
new TaikoDifficultyHitObjectRhythm(1, 1, 0.1),
|
||||||
new TaikoDifficultyHitObjectRhythm(2, 1, 0.3),
|
new TaikoDifficultyHitObjectRhythm(2, 1, 0.3),
|
||||||
@ -61,33 +78,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
|
|
||||||
constRhythmID = 0;
|
constRhythmID = 0;
|
||||||
constRhythm = commonRhythms[constRhythmID];
|
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)
|
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
|
// 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];
|
TaikoDifficultyHitObjectRhythm closestRhythm = commonRhythms[0];
|
||||||
double closestDistance = Double.MaxValue;
|
double closestDistance = Double.MaxValue;
|
||||||
|
|
||||||
@ -117,8 +102,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
}
|
}
|
||||||
|
|
||||||
return closestRhythm;
|
return closestRhythm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
private ColourSwitch lastColourSwitch = ColourSwitch.None;
|
private ColourSwitch lastColourSwitch = ColourSwitch.None;
|
||||||
private int sameColourCount = 1;
|
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;
|
private int sameTypeCount = 1;
|
||||||
|
|
||||||
// TODO: make this smarter (dont initialise with "Don")
|
// TODO: make this smarter (dont initialise with "Don")
|
||||||
private bool previousIsKat = false;
|
private bool previousIsKat;
|
||||||
|
|
||||||
protected override double StrainValueOf(DifficultyHitObject current)
|
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 SkillMultiplier => 1;
|
||||||
protected override double StrainDecayBase => 0;
|
protected override double StrainDecayBase => 0;
|
||||||
private const double strain_decay = 0.96;
|
private const double strain_decay = 0.96;
|
||||||
private double currentStrain = 0.0;
|
private double currentStrain;
|
||||||
|
|
||||||
private readonly List<TaikoDifficultyHitObject> ratioObjectHistory = new List<TaikoDifficultyHitObject>();
|
private readonly List<TaikoDifficultyHitObject> ratioObjectHistory = new List<TaikoDifficultyHitObject>();
|
||||||
private int ratioHistoryLength = 0;
|
private int ratioHistoryLength;
|
||||||
private const int ratio_history_max_length = 8;
|
private const int ratio_history_max_length = 8;
|
||||||
|
|
||||||
private int rhythmLength = 0;
|
private int rhythmLength;
|
||||||
|
|
||||||
// Penalty for repeated sequences of rhythm changes
|
// Penalty for repeated sequences of rhythm changes
|
||||||
private double repititionPenalty(double timeSinceRepititionMS)
|
private double repititionPenalty(double timeSinceRepititionMS)
|
||||||
|
@ -117,10 +117,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
|||||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||||
{
|
{
|
||||||
List<TaikoDifficultyHitObject> taikoDifficultyHitObjects = new List<TaikoDifficultyHitObject>();
|
List<TaikoDifficultyHitObject> taikoDifficultyHitObjects = new List<TaikoDifficultyHitObject>();
|
||||||
|
var rhythm = new TaikoDifficultyHitObjectRhythm();
|
||||||
|
|
||||||
for (int i = 2; i < beatmap.HitObjects.Count; i++)
|
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);
|
new StaminaCheeseDetector().FindCheese(taikoDifficultyHitObjects);
|
||||||
|
Loading…
Reference in New Issue
Block a user