refactor!: add n_objects to mania diff attrs

This commit is contained in:
MaxOhn
2023-12-29 09:00:28 +01:00
parent 841eb914b0
commit 1213525246
3 changed files with 28 additions and 0 deletions
+16
View File
@@ -131,12 +131,14 @@ impl<'map> ManiaStars<'map> {
.clock_rate(clock_rate)
.hit_windows();
let n_objects = self.map.hit_objects.len();
let ManiaResult { strain, max_combo } = calculate_result(self);
ManiaDifficultyAttributes {
stars: strain.difficulty_value() * STAR_SCALING_FACTOR,
hit_window,
max_combo,
n_objects,
}
}
@@ -233,6 +235,8 @@ pub struct ManiaDifficultyAttributes {
pub stars: f64,
/// The perceived hit window for an n300 inclusive of rate-adjusting mods (DT/HT/etc).
pub hit_window: f64,
/// The amount of hitobjects in the map.
pub n_objects: usize,
/// The maximum achievable combo.
pub max_combo: usize,
}
@@ -243,6 +247,12 @@ impl ManiaDifficultyAttributes {
pub fn max_combo(&self) -> usize {
self.max_combo
}
/// Return the amount of hitobjects.
#[inline]
pub fn n_objects(&self) -> usize {
self.n_objects
}
}
/// The result of a performance calculation on an osu!mania map.
@@ -274,6 +284,12 @@ impl ManiaPerformanceAttributes {
pub fn max_combo(&self) -> usize {
self.difficulty.max_combo
}
/// Return the amount of hitobjects.
#[inline]
pub fn n_objects(&self) -> usize {
self.difficulty.n_objects
}
}
impl From<ManiaPerformanceAttributes> for ManiaDifficultyAttributes {
+11
View File
@@ -589,6 +589,12 @@ impl OsuDifficultyAttributes {
pub fn max_combo(&self) -> usize {
self.max_combo
}
/// Return the amount of hitobjects.
#[inline]
pub fn n_objects(&self) -> usize {
self.n_circles + self.n_sliders + self.n_spinners
}
}
/// The result of a performance calculation on an osu!standard map.
@@ -628,6 +634,11 @@ impl OsuPerformanceAttributes {
pub fn max_combo(&self) -> usize {
self.difficulty.max_combo
}
/// Return the amount of hitobjects.
#[inline]
pub fn n_objects(&self) -> usize {
self.difficulty.n_objects()
}
}
impl From<OsuPerformanceAttributes> for OsuDifficultyAttributes {
+1
View File
@@ -64,5 +64,6 @@ impl_mode! {
stars: 3.441830819988125,
hit_window: 40.0,
max_combo: 956,
n_objects: 594,
};
}