1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 12:45:09 +08:00

Replace IsKat with HitType

This commit is contained in:
smoogipoo 2020-08-13 01:35:56 +09:00
parent d2a03f1146
commit 5010d2044a
3 changed files with 49 additions and 57 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
using osu.Game.Rulesets.Taiko.Objects;
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
{ {
@ -17,10 +18,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
hitObjects = difficultyHitObjects; hitObjects = difficultyHitObjects;
findRolls(3); findRolls(3);
findRolls(4); findRolls(4);
findTlTap(0, true); findTlTap(0, HitType.Rim);
findTlTap(1, true); findTlTap(1, HitType.Rim);
findTlTap(0, false); findTlTap(0, HitType.Centre);
findTlTap(1, false); findTlTap(1, HitType.Centre);
} }
private void findRolls(int patternLength) private void findRolls(int patternLength)
@ -40,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
for (int j = 0; j < patternLength; j++) for (int j = 0; j < patternLength; j++)
{ {
if (history[j].IsKat != history[j + patternLength].IsKat) if (history[j].HitType != history[j + patternLength].HitType)
{ {
isRepeat = false; isRepeat = false;
} }
@ -63,13 +64,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
} }
} }
private void findTlTap(int parity, bool kat) private void findTlTap(int parity, HitType type)
{ {
int tlLength = -2; int tlLength = -2;
for (int i = parity; i < hitObjects.Count; i += 2) for (int i = parity; i < hitObjects.Count; i += 2)
{ {
if (kat == hitObjects[i].IsKat) if (hitObjects[i].HitType == type)
{ {
tlLength += 2; tlLength += 2;
} }

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
public class TaikoDifficultyHitObject : DifficultyHitObject public class TaikoDifficultyHitObject : DifficultyHitObject
{ {
public readonly TaikoDifficultyHitObjectRhythm Rhythm; public readonly TaikoDifficultyHitObjectRhythm Rhythm;
public readonly bool IsKat; public readonly HitType? HitType;
public bool StaminaCheese = false; public bool StaminaCheese = false;
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate; double prevLength = (lastObject.StartTime - lastLastObject.StartTime) / clockRate;
Rhythm = getClosestRhythm(DeltaTime / prevLength, commonRhythms); Rhythm = getClosestRhythm(DeltaTime / prevLength, commonRhythms);
IsKat = currentHit?.Type == HitType.Rim; HitType = currentHit?.Type;
ObjectIndex = objectIndex; ObjectIndex = objectIndex;
} }

View File

@ -12,26 +12,54 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
{ {
public class Colour : Skill public class Colour : Skill
{ {
private const int mono_history_max_length = 5;
protected override double SkillMultiplier => 1; protected override double SkillMultiplier => 1;
protected override double StrainDecayBase => 0.4; protected override double StrainDecayBase => 0.4;
private NoteColour prevNoteColour = NoteColour.None; private HitType? previousHitType;
private int currentMonoLength = 1; private int currentMonoLength = 1;
private readonly List<int> monoHistory = new List<int>(); private readonly List<int> monoHistory = new List<int>();
private const int mono_history_max_length = 5;
protected override double StrainValueOf(DifficultyHitObject current)
{
if (!(current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000))
{
previousHitType = null;
return 0.0;
}
var taikoCurrent = (TaikoDifficultyHitObject)current;
double objectStrain = 0.0;
if (taikoCurrent.HitType != null && previousHitType != null && taikoCurrent.HitType != previousHitType)
{
objectStrain = 1.0;
if (monoHistory.Count < 2)
objectStrain = 0.0;
else if ((monoHistory[^1] + currentMonoLength) % 2 == 0)
objectStrain *= sameParityPenalty();
objectStrain *= repetitionPenalties();
currentMonoLength = 1;
}
else
{
currentMonoLength += 1;
}
previousHitType = taikoCurrent.HitType;
return objectStrain;
}
private double sameParityPenalty() private double sameParityPenalty()
{ {
return 0.0; return 0.0;
} }
private double repetitionPenalty(int notesSince)
{
double n = notesSince;
return Math.Min(1.0, 0.032 * n);
}
private double repetitionPenalties() private double repetitionPenalties()
{ {
double penalty = 1.0; double penalty = 1.0;
@ -68,47 +96,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
return penalty; return penalty;
} }
protected override double StrainValueOf(DifficultyHitObject current) private double repetitionPenalty(int notesSince)
{ {
if (!(current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000)) double n = notesSince;
{ return Math.Min(1.0, 0.032 * n);
prevNoteColour = NoteColour.None;
return 0.0;
}
TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current;
double objectStrain = 0.0;
NoteColour noteColour = hitObject.IsKat ? NoteColour.Ka : NoteColour.Don;
if (noteColour == NoteColour.Don && prevNoteColour == NoteColour.Ka ||
noteColour == NoteColour.Ka && prevNoteColour == NoteColour.Don)
{
objectStrain = 1.0;
if (monoHistory.Count < 2)
objectStrain = 0.0;
else if ((monoHistory[^1] + currentMonoLength) % 2 == 0)
objectStrain *= sameParityPenalty();
objectStrain *= repetitionPenalties();
currentMonoLength = 1;
}
else
{
currentMonoLength += 1;
}
prevNoteColour = noteColour;
return objectStrain;
}
private enum NoteColour
{
Don,
Ka,
None
} }
} }
} }