Use frost's miss count penalty

This commit is contained in:
apollo-dw 2021-12-16 18:37:57 +00:00
parent 489aa43b1b
commit bac4cfed50
1 changed files with 18 additions and 3 deletions

View File

@ -102,7 +102,7 @@ private double computeAimValue()
aimValue *= lengthBonus;
if (effectiveMissCount > 0)
aimValue *= Math.Pow(0.96, effectiveMissCount);
aimValue *= calculateMissPenalty(effectiveMissCount);
double approachRateFactor = 0.0;
if (Attributes.ApproachRate > 10.33)
@ -147,7 +147,7 @@ private double computeSpeedValue()
speedValue *= lengthBonus;
if (effectiveMissCount > 0)
speedValue *= Math.Pow(0.96, effectiveMissCount);
speedValue *= calculateMissPenalty(effectiveMissCount);
double approachRateFactor = 0.0;
if (Attributes.ApproachRate > 10.33)
@ -229,7 +229,7 @@ private double computeFlashlightValue()
flashlightValue *= 1.3;
if (effectiveMissCount > 0)
flashlightValue *= Math.Pow(0.96, effectiveMissCount);
flashlightValue *= calculateMissPenalty(effectiveMissCount);
// Combo scaling.
if (Attributes.MaxCombo > 0)
@ -265,6 +265,21 @@ private int calculateEffectiveMissCount()
return Math.Max(countMiss, (int)Math.Floor(comboBasedMissCount));
}
private double calculateMissPenalty(double missCount)
{
double leniency = 2.0;
if (missCount > totalHits - leniency)
return 0;
double missApprox = erfInvApprox((totalHits - leniency - missCount) / totalHits);
double fcApprox = erfInvApprox((totalHits - leniency) / totalHits);
return Math.Pow(missApprox / fcApprox, 1.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;
}