Use MathNet for miss penalty calculation, and use old penalty formula for Flashlight

This commit is contained in:
apollo-dw 2021-12-21 17:54:26 +00:00
parent bac4cfed50
commit 60e2a8ed4b
2 changed files with 11 additions and 7 deletions

View File

@ -9,6 +9,7 @@
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using MathNet.Numerics;
namespace osu.Game.Rulesets.Osu.Difficulty
{
@ -228,8 +229,9 @@ private double computeFlashlightValue()
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 *= calculateMissPenalty(effectiveMissCount);
flashlightValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
// Combo scaling.
if (Attributes.MaxCombo > 0)
@ -267,19 +269,17 @@ private int calculateEffectiveMissCount()
private double calculateMissPenalty(double missCount)
{
double leniency = 2.0;
double leniency = 4.3;
if (missCount > totalHits - leniency)
return 0;
double missApprox = erfInvApprox((totalHits - leniency - missCount) / totalHits);
double fcApprox = erfInvApprox((totalHits - leniency) / totalHits);
double missApprox = SpecialFunctions.ErfInv((totalHits - leniency - missCount) / totalHits);
double fcApprox = SpecialFunctions.ErfInv((totalHits - leniency) / totalHits);
return Math.Pow(missApprox / fcApprox, 1.5);
return Math.Pow(missApprox / fcApprox, 3.5);
}
private double logit(double x) => Math.Log(x / (1 - x));
private double erfInvApprox(double x) => (Math.Sqrt(Math.PI) / 4) * logit((x + 1) / 2);
private int totalHits => countGreat + countOk + countMeh + countMiss;
private int totalSuccessfulHits => countGreat + countOk + countMeh;
}

View File

@ -15,4 +15,8 @@
<ItemGroup Label="Project References">
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MathNet.Numerics" Version="4.7.0" />
</ItemGroup>
</Project>