Skip to content

Commit

Permalink
add aim accuracy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunyoku committed Nov 18, 2024
1 parent 0d55769 commit 1db0d4f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ remove-manual-adjustments = { package = "akatsuki-pp", git = "https://github.com
fix-inconsistent-powers = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "773fc16a60546c92b501ad1782757ab897365227", features = [
"async_tokio",
] }
aim-accuracy-fix = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "ee4e33bdc3beff690eed9cda4c8b164a21643a7e" }
md5 = "0.7.0"
27 changes: 27 additions & 0 deletions src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::{
usecases,
};

use aim_accuracy_fix::Beatmap as AimAccuracyFixBeatmap;
use fix_inconsistent_powers::Beatmap as FixInconsistentPowersBeatmap;
use flashlight_hotfix::Beatmap as FlashlightHotfixBeatmap;
use improved_miss_penalty::Beatmap as ImprovedMissPenaltyBeatmap;
Expand Down Expand Up @@ -181,6 +182,31 @@ async fn calculate_fix_inconsistent_powers_pp(
Ok(pp)
}

async fn calculate_aim_accuracy_fix_pp(
score: &RippleScore,
context: Arc<Context>,
) -> anyhow::Result<f32> {
let beatmap_bytes =
usecases::beatmaps::fetch_beatmap_osu_file(score.beatmap_id, context).await?;
let beatmap = AimAccuracyFixBeatmap::from_bytes(&beatmap_bytes)?;

let result = aim_accuracy_fix::osu_2019::OsuPP::from_map(&beatmap)
.mods(score.mods as u32)
.combo(score.max_combo as u32)
.n300(score.count_300 as u32)
.n100(score.count_100 as u32)
.n50(score.count_50 as u32)
.misses(score.count_misses as u32)
.calculate();

let mut pp = round(result.pp as f32, 2);
if pp.is_infinite() || pp.is_nan() {
pp = 0.0;
}

Ok(pp)
}

async fn process_scores(
rework: &Rework,
scores: Vec<RippleScore>,
Expand All @@ -196,6 +222,7 @@ async fn process_scores(
23 => calculate_stream_nerf_speed_value_pp(score, context.clone()).await?,
24 => calculate_remove_manual_adjustments_pp(score, context.clone()).await?,
25 => calculate_fix_inconsistent_powers_pp(score, context.clone()).await?,
26 => calculate_aim_accuracy_fix_pp(score, context.clone()).await?,
_ => unreachable!(),
};

Expand Down

0 comments on commit 1db0d4f

Please sign in to comment.