2020-05-11 13:50:02 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2020-05-11 13:50:02 +08:00
|
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
|
|
|
|
using osu.Game.Rulesets.Difficulty.Skills;
|
2021-02-06 12:06:16 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2020-05-11 13:50:02 +08:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
2020-06-08 15:30:26 +08:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
2020-05-11 13:50:02 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|
|
|
|
{
|
2020-08-23 01:34:16 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Calculates the stamina coefficient of taiko difficulty.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// The reference play style chosen uses two hands, with full alternating (the hand changes after every hit).
|
|
|
|
|
/// </remarks>
|
2021-08-17 06:14:29 +08:00
|
|
|
|
public class Stamina : StrainDecaySkill
|
2020-05-11 13:50:02 +08:00
|
|
|
|
{
|
|
|
|
|
protected override double SkillMultiplier => 1;
|
|
|
|
|
protected override double StrainDecayBase => 0.4;
|
|
|
|
|
|
2022-05-23 13:36:06 +08:00
|
|
|
|
private readonly SingleKeyStamina[] centreKeyStamina =
|
2022-05-10 16:17:40 +08:00
|
|
|
|
{
|
|
|
|
|
new SingleKeyStamina(),
|
2022-05-23 13:36:06 +08:00
|
|
|
|
new SingleKeyStamina()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private readonly SingleKeyStamina[] rimKeyStamina =
|
|
|
|
|
{
|
2022-05-10 16:17:40 +08:00
|
|
|
|
new SingleKeyStamina(),
|
|
|
|
|
new SingleKeyStamina()
|
|
|
|
|
};
|
2020-08-23 01:34:16 +08:00
|
|
|
|
|
2022-05-15 20:09:54 +08:00
|
|
|
|
/// <summary>
|
2022-05-23 13:36:06 +08:00
|
|
|
|
/// Current index into <see cref="centreKeyStamina" /> for a centre hit.
|
2022-05-15 20:09:54 +08:00
|
|
|
|
/// </summary>
|
2022-05-23 13:36:06 +08:00
|
|
|
|
private int centreKeyIndex;
|
2022-05-15 20:09:54 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-05-23 13:36:06 +08:00
|
|
|
|
/// Current index into <see cref="rimKeyStamina" /> for a rim hit.
|
2022-05-15 20:09:54 +08:00
|
|
|
|
/// </summary>
|
2022-05-23 13:36:06 +08:00
|
|
|
|
private int rimKeyIndex;
|
2020-05-11 13:50:02 +08:00
|
|
|
|
|
2020-08-23 01:34:16 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates a <see cref="Stamina"/> skill.
|
|
|
|
|
/// </summary>
|
2021-02-06 12:06:16 +08:00
|
|
|
|
/// <param name="mods">Mods for use in skill calculations.</param>
|
2022-05-10 16:17:40 +08:00
|
|
|
|
public Stamina(Mod[] mods)
|
2021-02-06 12:06:16 +08:00
|
|
|
|
: base(mods)
|
2020-05-11 13:50:02 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-15 20:09:54 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the next <see cref="SingleKeyStamina"/> to use for the given <see cref="TaikoDifficultyHitObject"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="current">The current <see cref="TaikoDifficultyHitObject"/>.</param>
|
2022-05-10 16:17:40 +08:00
|
|
|
|
private SingleKeyStamina getNextSingleKeyStamina(TaikoDifficultyHitObject current)
|
2020-05-11 13:50:02 +08:00
|
|
|
|
{
|
2022-05-15 20:09:54 +08:00
|
|
|
|
// Alternate key for the same color.
|
2022-05-10 16:17:40 +08:00
|
|
|
|
if (current.HitType == HitType.Centre)
|
2020-06-08 15:30:26 +08:00
|
|
|
|
{
|
2022-05-23 13:36:06 +08:00
|
|
|
|
centreKeyIndex = (centreKeyIndex + 1) % 2;
|
|
|
|
|
return centreKeyStamina[centreKeyIndex];
|
2020-06-08 15:30:26 +08:00
|
|
|
|
}
|
2020-05-11 13:50:02 +08:00
|
|
|
|
|
2022-05-23 13:36:06 +08:00
|
|
|
|
rimKeyIndex = (rimKeyIndex + 1) % 2;
|
|
|
|
|
return rimKeyStamina[rimKeyIndex];
|
2020-08-22 23:51:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-10 16:17:40 +08:00
|
|
|
|
protected override double StrainValueOf(DifficultyHitObject current)
|
2020-08-22 23:51:35 +08:00
|
|
|
|
{
|
2022-05-10 16:17:40 +08:00
|
|
|
|
if (!(current.BaseObject is Hit))
|
|
|
|
|
{
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current;
|
2022-05-15 20:09:54 +08:00
|
|
|
|
return getNextSingleKeyStamina(hitObject).StrainValueOf(hitObject);
|
2020-05-11 13:50:02 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|