feat: support osu_2019 for rx pp

This commit is contained in:
osu!Akatsuki Developer
2022-12-27 23:27:59 +00:00
parent 48390a9e16
commit 74f780897e
4 changed files with 346 additions and 4 deletions
+64 -1
View File
@@ -1,10 +1,13 @@
use akatsuki_pp::{
osu::OsuDifficultyAttributes, osu_2019::OsuPP, AnyPP, AnyStars, DifficultyAttributes, GameMode,
Mods, PerformanceAttributes,
};
use pyo3::{
exceptions::{PyTypeError, PyValueError},
pyclass, pymethods,
types::PyDict,
PyResult,
};
use akatsuki_pp::{AnyPP, AnyStars, DifficultyAttributes, GameMode};
use crate::{
beatmap::PyBeatmap, diff_attrs::PyDifficultyAttributes, error::KwargsError,
@@ -227,7 +230,67 @@ impl PyCalculator {
Ok(calc.calculate().into())
}
fn performance_2019(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> {
let mut calc = OsuPP::new(&map.inner);
set_calc! { calc, self:
mods,
combo,
n300,
n100,
n50,
passed_objects,
};
if let Some(n_misses) = self.n_misses {
calc = calc.misses(n_misses);
}
if let Some(acc) = self.acc {
calc = calc.accuracy(acc);
}
let attrs = calc.calculate();
let new_attrs = OsuPerformanceAttributes {
difficulty: OsuDifficultyAttributes {
aim: attrs.difficulty.aim_strain,
speed: attrs.difficulty.speed_strain,
flashlight: 0.0,
slider_factor: 0.0,
speed_note_count: 0.0,
ar: attrs.difficulty.ar,
od: attrs.difficulty.od,
hp: attrs.difficulty.hp,
n_circles: attrs.difficulty.n_circles,
n_sliders: attrs.difficulty.n_sliders,
n_spinners: attrs.difficulty.n_spinners,
stars: attrs.difficulty.stars,
max_combo: attrs.difficulty.max_combo,
},
pp: attrs.pp,
pp_acc: attrs.pp_acc,
pp_aim: attrs.pp_aim,
pp_flashlight: attrs.pp_flashlight,
pp_speed: attrs.pp_speed,
effective_miss_count: attrs.effective_miss_count,
};
Ok(PerformanceAttributes::Osu(attrs).into())
}
fn performance(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> {
// criteria:
// - is relax
// - is osu!standard
// or mode is not specified and map is osu!standard, as that will be the inferred mode
if self.mods.rx()
&& ((self.mode.is_none() && map.inner.mode == GameMode::Osu)
|| self.mode.contains(&GameMode::Osu))
{
return performance_2019(map);
}
let mut calc = AnyPP::new(&map.inner);
set_calc! { calc, self: