handle underflow for acc percentage

This commit is contained in:
Max
2022-10-31 12:37:09 +01:00
parent 4423efa1ca
commit 7ded74b54e
2 changed files with 12 additions and 12 deletions
+3 -2
View File
@@ -4,8 +4,9 @@
- When passing an osu!std map to `TaikoGradualDifficultyAttributes` or `ManiaGradualDifficultyAttributes`, it now automatically converts the map internally. For osu!catch is was already happening trivially.
- __Fixes:__
- Fixed passed object count for taiko by ignoring non-circles.
- Fixed a niche panic on UTF-16 encoded maps ([#18])
- Fixed passed object count for taiko by ignoring non-circles
- Fixed a niche panic on UTF-16 encoded maps. ([#18])
- Fixed an occasional underflow when calculating accuracy pp
# v0.9.1 (2022-10-26)
+9 -10
View File
@@ -596,20 +596,19 @@ impl OsuPpInner {
// * of the calculation we focus on hitting the timing hit window.
let amount_hit_objects_with_acc = self.attrs.n_circles;
let mut better_acc_percentage = if amount_hit_objects_with_acc > 0 {
((self.state.n300 - (self.state.total_hits() - amount_hit_objects_with_acc)) * 6
+ self.state.n100 * 2
+ self.state.n50) as f64
/ (amount_hit_objects_with_acc * 6) as f64
let better_acc_percentage = if amount_hit_objects_with_acc > 0 {
let sub = self.state.total_hits() - amount_hit_objects_with_acc;
if self.state.n300 < sub {
0.0
} else {
((self.state.n300 - sub) * 6 + self.state.n100 * 2 + self.state.n50) as f64
/ (amount_hit_objects_with_acc * 6) as f64
}
} else {
0.0
};
// * It is possible to reach a negative accuracy with this formula. Cap it at zero - zero points.
if better_acc_percentage < 0.0 {
better_acc_percentage = 0.0;
}
// * Lots of arbitrary values from testing.
// * Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution.
let mut acc_value = 1.52163_f64.powf(self.attrs.od) * better_acc_percentage.powi(24) * 2.83;