// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing; using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Difficulty.Skills { /// /// Calculates the stamina coefficient of taiko difficulty. /// /// /// The reference play style chosen uses two hands, with full alternating (the hand changes after every hit). /// public class Stamina : StrainDecaySkill { protected override double SkillMultiplier => 1; protected override double StrainDecayBase => 0.4; private readonly SingleKeyStamina[] centreKeyStamina = { new SingleKeyStamina(), new SingleKeyStamina() }; private readonly SingleKeyStamina[] rimKeyStamina = { new SingleKeyStamina(), new SingleKeyStamina() }; /// /// Current index into for a centre hit. /// private int centreKeyIndex; /// /// Current index into for a rim hit. /// private int rimKeyIndex; /// /// Creates a skill. /// /// Mods for use in skill calculations. public Stamina(Mod[] mods) : base(mods) { } /// /// Get the next to use for the given . /// /// The current . private SingleKeyStamina getNextSingleKeyStamina(TaikoDifficultyHitObject current) { // Alternate key for the same color. if (current.HitType == HitType.Centre) { centreKeyIndex = (centreKeyIndex + 1) % 2; return centreKeyStamina[centreKeyIndex]; } rimKeyIndex = (rimKeyIndex + 1) % 2; return rimKeyStamina[rimKeyIndex]; } protected override double StrainValueOf(DifficultyHitObject current) { if (!(current.BaseObject is Hit)) { return 0.0; } TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current; return getNextSingleKeyStamina(hitObject).StrainValueOf(hitObject); } } }