fix mania hitwindow
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::{
|
|||||||
difficulty::{object::ManiaDifficultyObject, skills::strain::Strain},
|
difficulty::{object::ManiaDifficultyObject, skills::strain::Strain},
|
||||||
object::{ManiaObject, ObjectParams},
|
object::{ManiaObject, ObjectParams},
|
||||||
},
|
},
|
||||||
util::float_ext::FloatExt,
|
util::{float_ext::FloatExt, mods::Mods},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{attributes::ManiaDifficultyAttributes, convert::ManiaBeatmap};
|
use super::{attributes::ManiaDifficultyAttributes, convert::ManiaBeatmap};
|
||||||
@@ -18,16 +18,14 @@ pub fn difficulty(
|
|||||||
difficulty: &ModeDifficulty,
|
difficulty: &ModeDifficulty,
|
||||||
converted: &ManiaBeatmap<'_>,
|
converted: &ManiaBeatmap<'_>,
|
||||||
) -> ManiaDifficultyAttributes {
|
) -> ManiaDifficultyAttributes {
|
||||||
let hit_window = converted
|
|
||||||
.attributes()
|
|
||||||
.mods(difficulty.get_mods())
|
|
||||||
.clock_rate(difficulty.get_clock_rate())
|
|
||||||
.hit_windows()
|
|
||||||
.od;
|
|
||||||
|
|
||||||
let n_objects = converted.map.hit_objects.len() as u32;
|
let n_objects = converted.map.hit_objects.len() as u32;
|
||||||
let values = DifficultyValues::calculate(difficulty, converted);
|
let values = DifficultyValues::calculate(difficulty, converted);
|
||||||
|
|
||||||
|
let mods = difficulty.get_mods();
|
||||||
|
let clock_rate = difficulty.get_clock_rate();
|
||||||
|
let hit_window =
|
||||||
|
(f64::from((get_hit_window(converted, mods) * clock_rate) as i32) / clock_rate).ceil();
|
||||||
|
|
||||||
ManiaDifficultyAttributes {
|
ManiaDifficultyAttributes {
|
||||||
stars: values.strain.difficulty_value() * STAR_SCALING_FACTOR,
|
stars: values.strain.difficulty_value() * STAR_SCALING_FACTOR,
|
||||||
hit_window,
|
hit_window,
|
||||||
@@ -37,6 +35,32 @@ pub fn difficulty(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_hit_window(converted: &ManiaBeatmap<'_>, mods: u32) -> f64 {
|
||||||
|
fn apply_mod_adjustments(mut value: f64, mods: u32) -> f64 {
|
||||||
|
if mods.hr() {
|
||||||
|
value /= 1.4;
|
||||||
|
} else if mods.ez() {
|
||||||
|
value *= 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
value
|
||||||
|
}
|
||||||
|
|
||||||
|
let od = f64::from(converted.map.od);
|
||||||
|
|
||||||
|
if !converted.is_convert {
|
||||||
|
let od = ((10.0 - od).max(0.0)).min(10.0);
|
||||||
|
|
||||||
|
return apply_mod_adjustments(34.0 + 3.0 * od, mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
if od.round_even() > 4.0 {
|
||||||
|
return apply_mod_adjustments(34.0, mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_mod_adjustments(47.0, mods)
|
||||||
|
}
|
||||||
|
|
||||||
pub struct DifficultyValues {
|
pub struct DifficultyValues {
|
||||||
pub strain: Strain,
|
pub strain: Strain,
|
||||||
pub max_combo: u32,
|
pub max_combo: u32,
|
||||||
|
|||||||
Reference in New Issue
Block a user