mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Merge branch 'master' into editor-readability
This commit is contained in:
commit
51744e428f
@ -122,6 +122,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
new OsuModEasy(),
|
||||
new OsuModHardRock(),
|
||||
new OsuModFlashlight(),
|
||||
new MultiMod(new OsuModFlashlight(), new OsuModHidden())
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -219,9 +219,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
|
||||
double flashlightValue = Math.Pow(rawFlashlight, 2.0) * 25.0;
|
||||
|
||||
if (score.Mods.Any(h => h is OsuModHidden))
|
||||
flashlightValue *= 1.3;
|
||||
|
||||
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
||||
if (effectiveMissCount > 0)
|
||||
flashlightValue *= 0.97 * Math.Pow(1 - Math.Pow(effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osuTK;
|
||||
|
||||
@ -85,6 +86,35 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
setDistances(clockRate);
|
||||
}
|
||||
|
||||
public double OpacityAt(double time, bool hidden)
|
||||
{
|
||||
if (time > BaseObject.StartTime)
|
||||
{
|
||||
// Consider a hitobject as being invisible when its start time is passed.
|
||||
// In reality the hitobject will be visible beyond its start time up until its hittable window has passed,
|
||||
// but this is an approximation and such a case is unlikely to be hit where this function is used.
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double fadeInStartTime = BaseObject.StartTime - BaseObject.TimePreempt;
|
||||
double fadeInDuration = BaseObject.TimeFadeIn;
|
||||
|
||||
if (hidden)
|
||||
{
|
||||
// Taken from OsuModHidden.
|
||||
double fadeOutStartTime = BaseObject.StartTime - BaseObject.TimePreempt + BaseObject.TimeFadeIn;
|
||||
double fadeOutDuration = BaseObject.TimePreempt * OsuModHidden.FADE_OUT_DURATION_MULTIPLIER;
|
||||
|
||||
return Math.Min
|
||||
(
|
||||
Math.Clamp((time - fadeInStartTime) / fadeInDuration, 0.0, 1.0),
|
||||
1.0 - Math.Clamp((time - fadeOutStartTime) / fadeOutDuration, 0.0, 1.0)
|
||||
);
|
||||
}
|
||||
|
||||
return Math.Clamp((time - fadeInStartTime) / fadeInDuration, 0.0, 1.0);
|
||||
}
|
||||
|
||||
private void setDistances(double clockRate)
|
||||
{
|
||||
if (BaseObject is Slider currentSlider)
|
||||
|
@ -2,8 +2,10 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
|
||||
@ -17,13 +19,19 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
public Flashlight(Mod[] mods)
|
||||
: base(mods)
|
||||
{
|
||||
hidden = mods.Any(m => m is OsuModHidden);
|
||||
}
|
||||
|
||||
private double skillMultiplier => 0.07;
|
||||
private double skillMultiplier => 0.05;
|
||||
private double strainDecayBase => 0.15;
|
||||
protected override double DecayWeight => 1.0;
|
||||
protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations.
|
||||
|
||||
private readonly bool hidden;
|
||||
|
||||
private const double max_opacity_bonus = 0.4;
|
||||
private const double hidden_bonus = 0.2;
|
||||
|
||||
private double currentStrain;
|
||||
|
||||
private double strainValueOf(DifficultyHitObject current)
|
||||
@ -61,13 +69,22 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
// We also want to nerf stacks so that only the first object of the stack is accounted for.
|
||||
double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0);
|
||||
|
||||
result += stackNerf * scalingFactor * jumpDistance / cumulativeStrainTime;
|
||||
// Bonus based on how visible the object is.
|
||||
double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.OpacityAt(currentHitObject.StartTime, hidden));
|
||||
|
||||
result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime;
|
||||
}
|
||||
|
||||
lastObj = currentObj;
|
||||
}
|
||||
|
||||
return Math.Pow(smallDistNerf * result, 2.0);
|
||||
result = Math.Pow(smallDistNerf * result, 2.0);
|
||||
|
||||
// Additional bonus for Hidden due to there being no approach circles.
|
||||
if (hidden)
|
||||
result *= 1.0 + hidden_bonus;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
|
||||
|
@ -27,8 +27,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSpinIn) };
|
||||
|
||||
private const double fade_in_duration_multiplier = 0.4;
|
||||
private const double fade_out_duration_multiplier = 0.3;
|
||||
public const double FADE_IN_DURATION_MULTIPLIER = 0.4;
|
||||
public const double FADE_OUT_DURATION_MULTIPLIER = 0.3;
|
||||
|
||||
protected override bool IsFirstAdjustableObject(HitObject hitObject) => !(hitObject is Spinner || hitObject is SpinnerTick);
|
||||
|
||||
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
static void applyFadeInAdjustment(OsuHitObject osuObject)
|
||||
{
|
||||
osuObject.TimeFadeIn = osuObject.TimePreempt * fade_in_duration_multiplier;
|
||||
osuObject.TimeFadeIn = osuObject.TimePreempt * FADE_IN_DURATION_MULTIPLIER;
|
||||
foreach (var nested in osuObject.NestedHitObjects.OfType<OsuHitObject>())
|
||||
applyFadeInAdjustment(nested);
|
||||
}
|
||||
@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
static (double fadeStartTime, double fadeDuration) getParameters(OsuHitObject hitObject)
|
||||
{
|
||||
double fadeOutStartTime = hitObject.StartTime - hitObject.TimePreempt + hitObject.TimeFadeIn;
|
||||
double fadeOutDuration = hitObject.TimePreempt * fade_out_duration_multiplier;
|
||||
double fadeOutDuration = hitObject.TimePreempt * FADE_OUT_DURATION_MULTIPLIER;
|
||||
|
||||
// new duration from completed fade in to end (before fading out)
|
||||
double longFadeDuration = hitObject.GetEndTime() - fadeOutStartTime;
|
||||
|
@ -195,16 +195,16 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
|
||||
public void UpdateProgress(double completionProgress)
|
||||
{
|
||||
var newPos = drawableSlider.HitObject.CurvePositionAt(completionProgress);
|
||||
Position = drawableSlider.HitObject.CurvePositionAt(completionProgress);
|
||||
|
||||
var diff = lastPosition.HasValue ? lastPosition.Value - newPos : newPos - drawableSlider.HitObject.CurvePositionAt(completionProgress + 0.01f);
|
||||
if (diff == Vector2.Zero)
|
||||
var diff = lastPosition.HasValue ? lastPosition.Value - Position : Position - drawableSlider.HitObject.CurvePositionAt(completionProgress + 0.01f);
|
||||
|
||||
// Ensure the value is substantially high enough to allow for Atan2 to get a valid angle.
|
||||
if (diff.LengthFast < 0.01f)
|
||||
return;
|
||||
|
||||
Position = newPos;
|
||||
ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI);
|
||||
|
||||
lastPosition = newPos;
|
||||
lastPosition = Position;
|
||||
}
|
||||
|
||||
private class FollowCircleContainer : CircularContainer
|
||||
|
@ -448,7 +448,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// <summary>
|
||||
/// Reapplies the current <see cref="ArmedState"/>.
|
||||
/// </summary>
|
||||
protected void RefreshStateTransforms() => updateState(State.Value, true);
|
||||
public void RefreshStateTransforms() => updateState(State.Value, true);
|
||||
|
||||
/// <summary>
|
||||
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.
|
||||
|
Loading…
Reference in New Issue
Block a user