mirror of https://github.com/ppy/osu
Refactor key indexing
This commit is contained in:
parent
63a3829768
commit
6cfe35360a
|
@ -20,26 +20,27 @@ public class Stamina : StrainDecaySkill
|
||||||
protected override double SkillMultiplier => 1;
|
protected override double SkillMultiplier => 1;
|
||||||
protected override double StrainDecayBase => 0.4;
|
protected override double StrainDecayBase => 0.4;
|
||||||
|
|
||||||
/// <summary>
|
private readonly SingleKeyStamina[] centreKeyStamina =
|
||||||
/// Stamina of each individual keys, calculated based on repetition speed.
|
|
||||||
/// </summary>
|
|
||||||
private readonly SingleKeyStamina[] keyStamina =
|
|
||||||
{
|
{
|
||||||
new SingleKeyStamina(),
|
new SingleKeyStamina(),
|
||||||
new SingleKeyStamina(),
|
new SingleKeyStamina()
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly SingleKeyStamina[] rimKeyStamina =
|
||||||
|
{
|
||||||
new SingleKeyStamina(),
|
new SingleKeyStamina(),
|
||||||
new SingleKeyStamina()
|
new SingleKeyStamina()
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current index to <see cref="keyStamina" /> for a don hit.
|
/// Current index into <see cref="centreKeyStamina" /> for a centre hit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int donIndex = 1;
|
private int centreKeyIndex;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current index to <see cref="keyStamina" /> for a kat hit.
|
/// Current index into <see cref="rimKeyStamina" /> for a rim hit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int katIndex = 3;
|
private int rimKeyIndex;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="Stamina"/> skill.
|
/// Creates a <see cref="Stamina"/> skill.
|
||||||
|
@ -59,12 +60,12 @@ private SingleKeyStamina getNextSingleKeyStamina(TaikoDifficultyHitObject curren
|
||||||
// Alternate key for the same color.
|
// Alternate key for the same color.
|
||||||
if (current.HitType == HitType.Centre)
|
if (current.HitType == HitType.Centre)
|
||||||
{
|
{
|
||||||
donIndex = donIndex == 0 ? 1 : 0;
|
centreKeyIndex = (centreKeyIndex + 1) % 2;
|
||||||
return keyStamina[donIndex];
|
return centreKeyStamina[centreKeyIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
katIndex = katIndex == 2 ? 3 : 2;
|
rimKeyIndex = (rimKeyIndex + 1) % 2;
|
||||||
return keyStamina[katIndex];
|
return rimKeyStamina[rimKeyIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override double StrainValueOf(DifficultyHitObject current)
|
protected override double StrainValueOf(DifficultyHitObject current)
|
||||||
|
|
Loading…
Reference in New Issue