fix incorrect difficulty value scaling

This commit is contained in:
tsunyoku
2024-06-01 00:43:09 +01:00
parent d61c4b6565
commit b96019f50a
5 changed files with 32 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "akatsuki-pp" name = "akatsuki-pp"
version = "1.0.0" version = "1.0.1"
authors = ["MaxOhn <ohn.m@hotmail.de>", "tsunyoku <tsunyoku@gmail.com>"] authors = ["MaxOhn <ohn.m@hotmail.de>", "tsunyoku <tsunyoku@gmail.com>"]
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
+10
View File
@@ -12,6 +12,7 @@ pub(crate) struct Aim {
pub(crate) strain_peaks: Vec<f64>, pub(crate) strain_peaks: Vec<f64>,
with_sliders: bool, with_sliders: bool,
object_strains: Vec<f64>, object_strains: Vec<f64>,
difficulty: f64,
} }
impl Aim { impl Aim {
@@ -26,6 +27,7 @@ impl Aim {
strain_peaks: Vec::new(), strain_peaks: Vec::new(),
with_sliders, with_sliders,
object_strains: Vec::new(), object_strains: Vec::new(),
difficulty: 0.0,
} }
} }
@@ -101,6 +103,14 @@ impl OsuStrainSkill for Aim {
fn strains(&self) -> &Vec<f64> { fn strains(&self) -> &Vec<f64> {
&self.object_strains &self.object_strains
} }
fn set_raw_difficulty_value(&mut self, value: f64) {
self.difficulty = value;
}
fn get_raw_difficulty_value(&self) -> f64 {
self.difficulty
}
} }
struct AimEvaluator; struct AimEvaluator;
+6
View File
@@ -114,6 +114,12 @@ impl OsuStrainSkill for Flashlight {
fn strains(&self) -> &Vec<f64> { fn strains(&self) -> &Vec<f64> {
HOLDING_VEC HOLDING_VEC
} }
fn set_raw_difficulty_value(&mut self, _value: f64) {}
fn get_raw_difficulty_value(&self) -> f64 {
0.0
}
} }
struct FlashlightEvaluator; struct FlashlightEvaluator;
+10
View File
@@ -14,6 +14,7 @@ pub(crate) struct Speed {
object_strains: Vec<f64>, object_strains: Vec<f64>,
hit_window: f64, hit_window: f64,
mods: u32, mods: u32,
difficulty: f64,
} }
impl Speed { impl Speed {
@@ -30,6 +31,7 @@ impl Speed {
object_strains: Vec::new(), object_strains: Vec::new(),
hit_window, hit_window,
mods, mods,
difficulty: 0.0,
} }
} }
@@ -125,6 +127,14 @@ impl OsuStrainSkill for Speed {
fn strains(&self) -> &Vec<f64> { fn strains(&self) -> &Vec<f64> {
&self.object_strains &self.object_strains
} }
fn set_raw_difficulty_value(&mut self, value: f64) {
self.difficulty = value;
}
fn get_raw_difficulty_value(&self) -> f64 {
self.difficulty
}
} }
struct SpeedEvaluator; struct SpeedEvaluator;
+5 -1
View File
@@ -123,13 +123,17 @@ pub(crate) trait OsuStrainSkill: StrainSkill + Sized {
weight *= Self::DECAY_WEIGHT; weight *= Self::DECAY_WEIGHT;
} }
self.set_raw_difficulty_value(difficulty);
difficulty * Self::DIFFICULTY_MULTIPLER difficulty * Self::DIFFICULTY_MULTIPLER
} }
fn strains(&self) -> &Vec<f64>; fn strains(&self) -> &Vec<f64>;
fn set_raw_difficulty_value(&mut self, value: f64);
fn get_raw_difficulty_value(&self) -> f64;
fn count_difficult_strains(&mut self) -> f64 { fn count_difficult_strains(&mut self) -> f64 {
let difficulty_value = OsuStrainSkill::difficulty_value(self); let difficulty_value = self.get_raw_difficulty_value();
if difficulty_value == 0.0 { if difficulty_value == 0.0 {
0.0 0.0
} else { } else {