mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 03:22:55 +08:00
Move opacity function to OsuDifficultyHitObject
This commit is contained in:
parent
fe83b8fc77
commit
afbec94124
@ -56,12 +56,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
|
||||
private readonly OsuHitObject lastLastObject;
|
||||
private readonly OsuHitObject lastObject;
|
||||
private readonly double clockRate;
|
||||
|
||||
public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double clockRate)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
this.lastLastObject = (OsuHitObject)lastLastObject;
|
||||
this.lastObject = (OsuHitObject)lastObject;
|
||||
this.clockRate = clockRate;
|
||||
|
||||
// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
||||
StrainTime = Math.Max(DeltaTime, min_delta_time);
|
||||
@ -69,6 +71,15 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
setDistances(clockRate);
|
||||
}
|
||||
|
||||
public double opacity(double ms, bool hidden)
|
||||
{
|
||||
double preemptTime = BaseObject.TimePreempt / clockRate;
|
||||
if (hidden)
|
||||
return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0);
|
||||
else
|
||||
return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0);
|
||||
}
|
||||
|
||||
private void setDistances(double clockRate)
|
||||
{
|
||||
// We don't need to calculate either angle or distance when one of the last->curr objects is a spinner
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
double stackNerf = Math.Min(1.0, (osuPrevious.JumpDistance / scalingFactor) / 25.0);
|
||||
|
||||
// Bonus based on how visible the object is.
|
||||
double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - opacity(cumulativeStrainTime, preemptTime, hidden));
|
||||
double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.opacity(cumulativeStrainTime, hidden));
|
||||
|
||||
result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime;
|
||||
}
|
||||
@ -87,14 +87,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
return result;
|
||||
}
|
||||
|
||||
private double opacity(double ms, double preemptTime, bool hidden)
|
||||
{
|
||||
if (hidden)
|
||||
return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0);
|
||||
else
|
||||
return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0);
|
||||
}
|
||||
|
||||
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
|
||||
|
||||
protected override double CalculateInitialStrain(double time) => currentStrain * strainDecay(time - Previous[0].StartTime);
|
||||
|
Loading…
Reference in New Issue
Block a user