1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 11:53:21 +08:00

Add bonus based on opacity of hit objects

This commit is contained in:
MBmasher 2021-11-12 21:29:51 +11:00
parent a76247603f
commit 131e64e56c
3 changed files with 43 additions and 27 deletions

View File

@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
{
private const double difficulty_multiplier = 0.0675;
private double hitWindowGreat;
private double preempt;
public OsuDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
@ -34,11 +35,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
return new OsuDifficultyAttributes { Mods = mods, Skills = skills };
double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
double speedRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier;
double flashlightRating = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier;
double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1;
double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
double flashlightRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier;
if (mods.Any(h => h is OsuModRelax))
speedRating = 0.0;
@ -77,7 +75,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
AimStrain = aimRating,
SpeedStrain = speedRating,
FlashlightRating = flashlightRating,
SliderFactor = sliderFactor,
ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5,
OverallDifficulty = (80 - hitWindowGreat) / 6,
DrainRate = drainRate,
@ -110,12 +107,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty
hitWindowGreat = hitWindows.WindowFor(HitResult.Great) / clockRate;
preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate;
return new Skill[]
{
new Aim(mods, true),
new Aim(mods, false),
new Aim(mods),
new Speed(mods, hitWindowGreat),
new Flashlight(mods)
new Flashlight(mods, preempt)
};
}
@ -126,6 +124,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
new OsuModEasy(),
new OsuModHardRock(),
new OsuModFlashlight(),
new OsuModHidden(),
};
}
}

View File

@ -125,16 +125,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
aimValue *= 1.0 + 0.04 * (12.0 - Attributes.ApproachRate);
}
// We assume 15% of sliders in a map are difficult since there's no way to tell from the performance calculator.
double estimateDifficultSliders = Attributes.SliderCount * 0.15;
if (Attributes.SliderCount > 0)
{
double estimateSliderEndsDropped = Math.Clamp(Math.Min(countOk + countMeh + countMiss, Attributes.MaxCombo - scoreMaxCombo), 0, estimateDifficultSliders);
double sliderNerfFactor = (1 - Attributes.SliderFactor) * Math.Pow(1 - estimateSliderEndsDropped / estimateDifficultSliders, 3) + Attributes.SliderFactor;
aimValue *= sliderNerfFactor;
}
aimValue *= accuracy;
// It is important to also consider accuracy difficulty when doing that.
aimValue *= 0.98 + Math.Pow(Attributes.OverallDifficulty, 2) / 2500;
@ -234,10 +224,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
double flashlightValue = Math.Pow(rawFlashlight, 2.0) * 25.0;
// Add an additional bonus for HDFL.
if (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((double)effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));

View File

@ -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;
@ -14,16 +16,24 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
/// </summary>
public class Flashlight : OsuStrainSkill
{
public Flashlight(Mod[] mods)
public Flashlight(Mod[] mods, double preemptTime)
: base(mods)
{
this.mods = mods;
this.preemptTime = preemptTime;
}
private double skillMultiplier => 0.15;
private double skillMultiplier => 0.12;
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 Mod[] mods;
private bool hidden;
private double preemptTime;
private const double max_opacity_bonus = 0.4;
private double currentStrain;
private double strainValueOf(DifficultyHitObject current)
@ -31,6 +41,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
if (current.BaseObject is Spinner)
return 0;
hidden = mods.Any(m => m is OsuModHidden);
var osuCurrent = (OsuDifficultyHitObject)current;
var osuHitObject = (OsuHitObject)(osuCurrent.BaseObject);
@ -58,11 +70,30 @@ 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, (osuPrevious.JumpDistance / scalingFactor) / 25.0);
result += Math.Pow(0.8, i) * stackNerf * scalingFactor * jumpDistance / cumulativeStrainTime;
// Bonus based on how visible the object is.
double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - opacity(cumulativeStrainTime, preemptTime, hidden));
result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime;
}
}
return Math.Pow(smallDistNerf * result, 2.0);
result = Math.Pow(smallDistNerf * result, 2.0);
if (hidden) {
result *= 1.0 + max_opacity_bonus;
}
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);