1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 11:12:59 +08:00

Refactor Skill.Process() to not require calling base.Process()

This commit is contained in:
Samuel Cattini-Schultz 2021-04-05 22:14:37 +10:00
parent 57983ae61f
commit 5bdd15f746
3 changed files with 9 additions and 8 deletions

View File

@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Difficulty
{ {
foreach (var skill in skills) foreach (var skill in skills)
{ {
skill.Process(hitObject); skill.ProcessInternal(hitObject);
} }
} }

View File

@ -30,14 +30,17 @@ namespace osu.Game.Rulesets.Difficulty.Skills
this.mods = mods; this.mods = mods;
} }
internal void ProcessInternal(DifficultyHitObject current)
{
Process(current);
Previous.Push(current);
}
/// <summary> /// <summary>
/// Process a <see cref="DifficultyHitObject"/>. /// Process a <see cref="DifficultyHitObject"/>.
/// </summary> /// </summary>
/// <param name="current">The <see cref="DifficultyHitObject"/> to process.</param> /// <param name="current">The <see cref="DifficultyHitObject"/> to process.</param>
public virtual void Process(DifficultyHitObject current) protected abstract void Process(DifficultyHitObject current);
{
Previous.Push(current);
}
/// <summary> /// <summary>
/// Returns the calculated difficulty value representing all <see cref="DifficultyHitObject"/>s that have been processed up to this point. /// Returns the calculated difficulty value representing all <see cref="DifficultyHitObject"/>s that have been processed up to this point.

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills
/// <summary> /// <summary>
/// Process a <see cref="DifficultyHitObject"/> and update current strain values accordingly. /// Process a <see cref="DifficultyHitObject"/> and update current strain values accordingly.
/// </summary> /// </summary>
public sealed override void Process(DifficultyHitObject current) protected sealed override void Process(DifficultyHitObject current)
{ {
// The first object doesn't generate a strain, so we begin with an incremented section end // The first object doesn't generate a strain, so we begin with an incremented section end
if (Previous.Count == 0) if (Previous.Count == 0)
@ -72,8 +72,6 @@ namespace osu.Game.Rulesets.Difficulty.Skills
CurrentStrain += StrainValueOf(current) * SkillMultiplier; CurrentStrain += StrainValueOf(current) * SkillMultiplier;
currentSectionPeak = Math.Max(CurrentStrain, currentSectionPeak); currentSectionPeak = Math.Max(CurrentStrain, currentSectionPeak);
base.Process(current);
} }
/// <summary> /// <summary>