Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf4275c363 |
+1
-65
@@ -1,8 +1,4 @@
|
|||||||
use akatsuki_pp::{
|
use akatsuki_pp::{AnyPP, AnyStars, DifficultyAttributes, GameMode};
|
||||||
osu::{OsuDifficultyAttributes, OsuPerformanceAttributes},
|
|
||||||
osu_2019::OsuPP,
|
|
||||||
AnyPP, AnyStars, DifficultyAttributes, GameMode, Mods, PerformanceAttributes,
|
|
||||||
};
|
|
||||||
use pyo3::{
|
use pyo3::{
|
||||||
exceptions::{PyTypeError, PyValueError},
|
exceptions::{PyTypeError, PyValueError},
|
||||||
pyclass, pymethods,
|
pyclass, pymethods,
|
||||||
@@ -231,67 +227,7 @@ impl PyCalculator {
|
|||||||
Ok(calc.calculate().into())
|
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 as f32);
|
|
||||||
}
|
|
||||||
|
|
||||||
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(new_attrs).into())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn performance(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> {
|
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.is_some() && self.mods.unwrap().rx())
|
|
||||||
&& ((self.mode.is_none() && map.inner.mode == GameMode::Osu)
|
|
||||||
|| self.mode == Some(GameMode::Osu))
|
|
||||||
{
|
|
||||||
return self.performance_2019(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut calc = AnyPP::new(&map.inner);
|
let mut calc = AnyPP::new(&map.inner);
|
||||||
|
|
||||||
set_calc! { calc, self:
|
set_calc! { calc, self:
|
||||||
|
|||||||
+5
-1
@@ -1,10 +1,10 @@
|
|||||||
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
|
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
|
||||||
|
|
||||||
use pyo3::{pyclass, pymethods};
|
|
||||||
use akatsuki_pp::{
|
use akatsuki_pp::{
|
||||||
catch::CatchDifficultyAttributes, mania::ManiaDifficultyAttributes,
|
catch::CatchDifficultyAttributes, mania::ManiaDifficultyAttributes,
|
||||||
osu::OsuDifficultyAttributes, taiko::TaikoDifficultyAttributes, DifficultyAttributes,
|
osu::OsuDifficultyAttributes, taiko::TaikoDifficultyAttributes, DifficultyAttributes,
|
||||||
};
|
};
|
||||||
|
use pyo3::{pyclass, pymethods};
|
||||||
|
|
||||||
#[pyclass(name = "DifficultyAttributes")]
|
#[pyclass(name = "DifficultyAttributes")]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -91,6 +91,8 @@ impl Debug for BorrowedDifficultyAttributes<'_> {
|
|||||||
n_spinners,
|
n_spinners,
|
||||||
stars,
|
stars,
|
||||||
max_combo,
|
max_combo,
|
||||||
|
aim_difficult_strain_count,
|
||||||
|
speed_difficult_strain_count,
|
||||||
} = attrs;
|
} = attrs;
|
||||||
|
|
||||||
debug.field("mode", &0_u8);
|
debug.field("mode", &0_u8);
|
||||||
@@ -109,6 +111,8 @@ impl Debug for BorrowedDifficultyAttributes<'_> {
|
|||||||
n_spinners,
|
n_spinners,
|
||||||
stars,
|
stars,
|
||||||
max_combo,
|
max_combo,
|
||||||
|
aim_difficult_strain_count,
|
||||||
|
speed_difficult_strain_count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::Taiko(attrs) => {
|
Self::Taiko(attrs) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user