-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30460 from Lawtrohux/t-speed-deviation
Implement stamina consideration for Mono (single-coloured) patterns.
- Loading branch information
Showing
5 changed files
with
56 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,55 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using osu.Game.Rulesets.Difficulty.Preprocessing; | ||
using osu.Game.Rulesets.Difficulty.Skills; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Rulesets.Taiko.Difficulty.Evaluators; | ||
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing; | ||
|
||
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills | ||
{ | ||
/// <summary> | ||
/// Calculates the stamina coefficient of taiko difficulty. | ||
/// </summary> | ||
public class Stamina : StrainDecaySkill | ||
public class Stamina : StrainSkill | ||
{ | ||
protected override double SkillMultiplier => 1.1; | ||
protected override double StrainDecayBase => 0.4; | ||
private double skillMultiplier => 1.1; | ||
private double strainDecayBase => 0.4; | ||
|
||
private readonly bool singleColourStamina; | ||
|
||
private double currentStrain; | ||
|
||
/// <summary> | ||
/// Creates a <see cref="Stamina"/> skill. | ||
/// </summary> | ||
/// <param name="mods">Mods for use in skill calculations.</param> | ||
public Stamina(Mod[] mods) | ||
/// <param name="singleColourStamina">Reads when Stamina is from a single coloured pattern.</param> | ||
public Stamina(Mod[] mods, bool singleColourStamina) | ||
: base(mods) | ||
{ | ||
this.singleColourStamina = singleColourStamina; | ||
} | ||
|
||
protected override double StrainValueOf(DifficultyHitObject current) | ||
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); | ||
|
||
protected override double StrainValueAt(DifficultyHitObject current) | ||
{ | ||
return StaminaEvaluator.EvaluateDifficultyOf(current); | ||
currentStrain *= strainDecay(current.DeltaTime); | ||
currentStrain += StaminaEvaluator.EvaluateDifficultyOf(current) * skillMultiplier; | ||
|
||
// Safely prevents previous strains from shifting as new notes are added. | ||
var currentObject = current as TaikoDifficultyHitObject; | ||
int index = currentObject?.Colour.MonoStreak?.HitObjects.IndexOf(currentObject) ?? 0; | ||
|
||
if (singleColourStamina) | ||
return currentStrain / (1 + Math.Exp(-(index - 10) / 2.0)); | ||
|
||
return currentStrain; | ||
} | ||
|
||
protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => singleColourStamina ? 0 : currentStrain * strainDecay(time - current.Previous(0).StartTime); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters