Skip to content

Commit

Permalink
fix incorrect difficulty value scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunyoku committed May 31, 2024
1 parent d61c4b6 commit b96019f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akatsuki-pp"
version = "1.0.0"
version = "1.0.1"
authors = ["MaxOhn <[email protected]>", "tsunyoku <[email protected]>"]
edition = "2018"
license = "MIT"
Expand Down
10 changes: 10 additions & 0 deletions src/osu/skills/aim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub(crate) struct Aim {
pub(crate) strain_peaks: Vec<f64>,
with_sliders: bool,
object_strains: Vec<f64>,
difficulty: f64,
}

impl Aim {
Expand All @@ -26,6 +27,7 @@ impl Aim {
strain_peaks: Vec::new(),
with_sliders,
object_strains: Vec::new(),
difficulty: 0.0,
}
}

Expand Down Expand Up @@ -101,6 +103,14 @@ impl OsuStrainSkill for Aim {
fn strains(&self) -> &Vec<f64> {
&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;
Expand Down
6 changes: 6 additions & 0 deletions src/osu/skills/flashlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ impl OsuStrainSkill for Flashlight {
fn strains(&self) -> &Vec<f64> {
HOLDING_VEC
}

fn set_raw_difficulty_value(&mut self, _value: f64) {}

fn get_raw_difficulty_value(&self) -> f64 {
0.0
}
}

struct FlashlightEvaluator;
Expand Down
10 changes: 10 additions & 0 deletions src/osu/skills/speed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub(crate) struct Speed {
object_strains: Vec<f64>,
hit_window: f64,
mods: u32,
difficulty: f64,
}

impl Speed {
Expand All @@ -30,6 +31,7 @@ impl Speed {
object_strains: Vec::new(),
hit_window,
mods,
difficulty: 0.0,
}
}

Expand Down Expand Up @@ -125,6 +127,14 @@ impl OsuStrainSkill for Speed {
fn strains(&self) -> &Vec<f64> {
&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;
Expand Down
6 changes: 5 additions & 1 deletion src/osu/skills/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,17 @@ pub(crate) trait OsuStrainSkill: StrainSkill + Sized {
weight *= Self::DECAY_WEIGHT;
}

self.set_raw_difficulty_value(difficulty);
difficulty * Self::DIFFICULTY_MULTIPLER
}

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 {
let difficulty_value = OsuStrainSkill::difficulty_value(self);
let difficulty_value = self.get_raw_difficulty_value();
if difficulty_value == 0.0 {
0.0
} else {
Expand Down

0 comments on commit b96019f

Please sign in to comment.