mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Update with latest changes
This commit is contained in:
@ -14,25 +14,26 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
|
||||
public void FindCheese(List<TaikoDifficultyHitObject> difficultyHitObjects)
|
||||
{
|
||||
this.hitObjects = difficultyHitObjects;
|
||||
hitObjects = difficultyHitObjects;
|
||||
findRolls(3);
|
||||
findRolls(4);
|
||||
findTLTap(0, true);
|
||||
findTLTap(1, true);
|
||||
findTLTap(0, false);
|
||||
findTLTap(1, false);
|
||||
findTlTap(0, true);
|
||||
findTlTap(1, true);
|
||||
findTlTap(0, false);
|
||||
findTlTap(1, false);
|
||||
}
|
||||
|
||||
private void findRolls(int patternLength)
|
||||
{
|
||||
List<TaikoDifficultyHitObject> history = new List<TaikoDifficultyHitObject>();
|
||||
|
||||
int repititionStart = 0;
|
||||
int repetitionStart = 0;
|
||||
|
||||
for (int i = 0; i < hitObjects.Count; i++)
|
||||
{
|
||||
history.Add(hitObjects[i]);
|
||||
if (history.Count < 2 * patternLength) continue;
|
||||
|
||||
if (history.Count > 2 * patternLength) history.RemoveAt(0);
|
||||
|
||||
bool isRepeat = true;
|
||||
@ -47,43 +48,41 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
|
||||
if (!isRepeat)
|
||||
{
|
||||
repititionStart = i - 2 * patternLength;
|
||||
repetitionStart = i - 2 * patternLength;
|
||||
}
|
||||
|
||||
int repeatedLength = i - repititionStart;
|
||||
int repeatedLength = i - repetitionStart;
|
||||
|
||||
if (repeatedLength >= roll_min_repetitions)
|
||||
{
|
||||
// Console.WriteLine("Found Roll Cheese.\tStart: " + repititionStart + "\tEnd: " + i);
|
||||
for (int j = repititionStart; j < i; j++)
|
||||
for (int j = repetitionStart; j < i; j++)
|
||||
{
|
||||
(hitObjects[i]).StaminaCheese = true;
|
||||
hitObjects[i].StaminaCheese = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void findTLTap(int parity, bool kat)
|
||||
private void findTlTap(int parity, bool kat)
|
||||
{
|
||||
int tl_length = -2;
|
||||
int tlLength = -2;
|
||||
|
||||
for (int i = parity; i < hitObjects.Count; i += 2)
|
||||
{
|
||||
if (kat == hitObjects[i].IsKat)
|
||||
{
|
||||
tl_length += 2;
|
||||
tlLength += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
tl_length = -2;
|
||||
tlLength = -2;
|
||||
}
|
||||
|
||||
if (tl_length >= tl_min_repetitions)
|
||||
if (tlLength >= tl_min_repetitions)
|
||||
{
|
||||
// Console.WriteLine("Found TL Cheese.\tStart: " + (i - tl_length) + "\tEnd: " + i);
|
||||
for (int j = i - tl_length; j < i; j++)
|
||||
for (int j = i - tlLength; j < i; j++)
|
||||
{
|
||||
(hitObjects[i]).StaminaCheese = true;
|
||||
hitObjects[i].StaminaCheese = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
@ -9,38 +12,31 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
{
|
||||
public class TaikoDifficultyHitObject : DifficultyHitObject
|
||||
{
|
||||
public readonly bool HasTypeChange;
|
||||
public readonly bool HasTimingChange;
|
||||
public readonly TaikoDifficultyHitObjectRhythm Rhythm;
|
||||
public readonly bool IsKat;
|
||||
|
||||
public bool StaminaCheese = false;
|
||||
|
||||
public readonly int RhythmID;
|
||||
|
||||
public readonly double NoteLength;
|
||||
|
||||
public readonly int n;
|
||||
private int counter = 0;
|
||||
public readonly int N;
|
||||
|
||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, TaikoDifficultyHitObjectRhythm rhythm)
|
||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, int n, IEnumerable<TaikoDifficultyHitObjectRhythm> commonRhythms)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
var lastHit = lastObject as Hit;
|
||||
var currentHit = hitObject as Hit;
|
||||
|
||||
NoteLength = DeltaTime;
|
||||
double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate;
|
||||
Rhythm = rhythm.GetClosest(NoteLength / prevLength);
|
||||
RhythmID = Rhythm.ID;
|
||||
HasTypeChange = lastHit?.Type != currentHit?.Type;
|
||||
IsKat = lastHit?.Type == HitType.Rim;
|
||||
HasTimingChange = !rhythm.IsRepeat(RhythmID);
|
||||
Rhythm = getClosestRhythm(NoteLength / prevLength, commonRhythms);
|
||||
IsKat = currentHit?.Type == HitType.Rim;
|
||||
|
||||
n = counter;
|
||||
counter++;
|
||||
N = n;
|
||||
}
|
||||
|
||||
public const int CONST_RHYTHM_ID = 0;
|
||||
private TaikoDifficultyHitObjectRhythm getClosestRhythm(double ratio, IEnumerable<TaikoDifficultyHitObjectRhythm> commonRhythms)
|
||||
{
|
||||
return commonRhythms.OrderBy(x => Math.Abs(x.Ratio - ratio)).First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,107 +1,19 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
{
|
||||
public class TaikoDifficultyHitObjectRhythm
|
||||
{
|
||||
private readonly TaikoDifficultyHitObjectRhythm[] commonRhythms;
|
||||
private readonly TaikoDifficultyHitObjectRhythm constRhythm;
|
||||
private int constRhythmID;
|
||||
|
||||
public int ID = 0;
|
||||
public readonly double Difficulty;
|
||||
private readonly double ratio;
|
||||
public readonly double Ratio;
|
||||
public readonly bool IsRepeat;
|
||||
|
||||
public bool IsRepeat()
|
||||
public TaikoDifficultyHitObjectRhythm(int numerator, int denominator, double difficulty, 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
|
||||
|
||||
If (change < 0.48) Then 'sometimes gaps are slightly different due to position rounding
|
||||
Return 0.65 'This number increases value of anything that more than doubles speed. Affects doubles.
|
||||
ElseIf (change < 0.52) Then
|
||||
Return 0.5 'speed doubling - this one affects pretty much every map other than stream maps
|
||||
ElseIf change <= 0.9 Then
|
||||
Return 1.0 'This number increases value of 1/4 -> 1/6 and other weird rhythms.
|
||||
ElseIf change < 0.95 Then
|
||||
Return 0.25 '.9
|
||||
ElseIf change > 1.95 Then
|
||||
Return 0.3 'half speed or more - this affects pretty much every map
|
||||
ElseIf change > 1.15 Then
|
||||
Return 0.425 'in between - this affects (mostly) 1/6 -> 1/4
|
||||
ElseIf change > 1.05 Then
|
||||
Return 0.15 '.9, small speed changes
|
||||
|
||||
*/
|
||||
|
||||
commonRhythms = new[]
|
||||
{
|
||||
new TaikoDifficultyHitObjectRhythm(1, 1, 0.1),
|
||||
new TaikoDifficultyHitObjectRhythm(2, 1, 0.3),
|
||||
new TaikoDifficultyHitObjectRhythm(1, 2, 0.5),
|
||||
new TaikoDifficultyHitObjectRhythm(3, 1, 0.3),
|
||||
new TaikoDifficultyHitObjectRhythm(1, 3, 0.35),
|
||||
new TaikoDifficultyHitObjectRhythm(3, 2, 0.6),
|
||||
new TaikoDifficultyHitObjectRhythm(2, 3, 0.4),
|
||||
new TaikoDifficultyHitObjectRhythm(5, 4, 0.5),
|
||||
new TaikoDifficultyHitObjectRhythm(4, 5, 0.7)
|
||||
};
|
||||
|
||||
for (int i = 0; i < commonRhythms.Length; i++)
|
||||
{
|
||||
commonRhythms[i].ID = i;
|
||||
}
|
||||
|
||||
constRhythmID = 0;
|
||||
constRhythm = commonRhythms[constRhythmID];
|
||||
}
|
||||
|
||||
private TaikoDifficultyHitObjectRhythm(int numerator, int denominator, double difficulty)
|
||||
{
|
||||
this.ratio = ((double)numerator) / ((double)denominator);
|
||||
this.Difficulty = difficulty;
|
||||
}
|
||||
|
||||
// Code is inefficient - we are searching exhaustively through the sorted list commonRhythms
|
||||
public TaikoDifficultyHitObjectRhythm GetClosest(double ratio)
|
||||
{
|
||||
TaikoDifficultyHitObjectRhythm closestRhythm = commonRhythms[0];
|
||||
double closestDistance = Double.MaxValue;
|
||||
|
||||
foreach (TaikoDifficultyHitObjectRhythm r in commonRhythms)
|
||||
{
|
||||
if (Math.Abs(r.ratio - ratio) < closestDistance)
|
||||
{
|
||||
closestRhythm = r;
|
||||
closestDistance = Math.Abs(r.ratio - ratio);
|
||||
}
|
||||
}
|
||||
|
||||
return closestRhythm;
|
||||
Ratio = numerator / (double)denominator;
|
||||
Difficulty = difficulty;
|
||||
IsRepeat = isRepeat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user