removed old column calculation for mania difficulty calc

This commit is contained in:
MaxOhn
2022-07-06 16:05:24 +02:00
parent 970f9ff69f
commit 288575fb7b
2 changed files with 197 additions and 240 deletions
+2 -24
View File
@@ -6,7 +6,7 @@ use std::{
use crate::{ use crate::{
mania::{strain::Strain, SECTION_LEN}, mania::{strain::Strain, SECTION_LEN},
parse::HitObject, parse::HitObject,
Beatmap, GameMode, Mods, Beatmap, Mods,
}; };
use super::{DifficultyHitObject, ManiaDifficultyAttributes, STAR_SCALING_FACTOR}; use super::{DifficultyHitObject, ManiaDifficultyAttributes, STAR_SCALING_FACTOR};
@@ -53,29 +53,7 @@ pub struct ManiaGradualDifficultyAttributes<'map> {
impl<'map> ManiaGradualDifficultyAttributes<'map> { impl<'map> ManiaGradualDifficultyAttributes<'map> {
/// Create a new difficulty attributes iterator for osu!mania maps. /// Create a new difficulty attributes iterator for osu!mania maps.
pub fn new(map: &'map Beatmap, mods: impl Mods) -> Self { pub fn new(map: &'map Beatmap, mods: impl Mods) -> Self {
let rounded_cs = map.cs.round(); let columns = map.cs.round().max(1.0) as u8;
let columns = match map.mode {
GameMode::Mania => rounded_cs.max(1.0) as u8,
GameMode::Osu => {
let rounded_od = map.od.round();
let n_objects = map.n_circles + map.n_sliders + map.n_spinners;
let slider_or_spinner_ratio = (n_objects - map.n_circles) as f32 / n_objects as f32;
if slider_or_spinner_ratio < 0.2 {
7
} else if slider_or_spinner_ratio < 0.3 || rounded_cs >= 5.0 {
6 + (rounded_od > 5.0) as u8
} else if slider_or_spinner_ratio > 0.6 {
4 + (rounded_od > 4.0) as u8
} else {
(rounded_od as u8 + 1).max(4).min(7)
}
}
other => panic!("can not calculate mania difficulty on a {:?} map", other),
};
let clock_rate = mods.clock_rate(); let clock_rate = mods.clock_rate();
let strain = Strain::new(columns); let strain = Strain::new(columns);
let columns = columns as f32; let columns = columns as f32;
+1 -22
View File
@@ -137,28 +137,7 @@ fn calculate_strain(params: ManiaStars<'_>) -> Strain {
} = params; } = params;
let take = passed_objects.unwrap_or(map.hit_objects.len()); let take = passed_objects.unwrap_or(map.hit_objects.len());
let rounded_cs = map.cs.round(); let columns = map.cs.round().max(1.0) as u8;
let columns = match map.mode {
GameMode::Mania => rounded_cs.max(1.0) as u8,
GameMode::Osu => {
let rounded_od = map.od.round();
let n_objects = map.n_circles + map.n_sliders + map.n_spinners;
let slider_or_spinner_ratio = (n_objects - map.n_circles) as f32 / n_objects as f32;
if slider_or_spinner_ratio < 0.2 {
7
} else if slider_or_spinner_ratio < 0.3 || rounded_cs >= 5.0 {
6 + (rounded_od > 5.0) as u8
} else if slider_or_spinner_ratio > 0.6 {
4 + (rounded_od > 4.0) as u8
} else {
(rounded_od as u8 + 1).max(4).min(7)
}
}
other => panic!("can not calculate mania difficulty on a {:?} map", other),
};
let clock_rate = clock_rate.unwrap_or_else(|| mods.clock_rate()); let clock_rate = clock_rate.unwrap_or_else(|| mods.clock_rate());
let mut strain = Strain::new(columns); let mut strain = Strain::new(columns);