convert map internally for gradual tko & mna

This commit is contained in:
Max
2022-10-28 00:42:13 +02:00
parent cd459091f4
commit 4e416badd0
4 changed files with 19 additions and 12 deletions
+3
View File
@@ -1,5 +1,8 @@
## Upcoming
- __Adjustments:__
- When passing an osu!std map to `TaikoGradualDifficultyAttributes` or `ManiaGradualDifficultyAttributes`, it now automatically converts the map internally. For osu!catch is was already happening trivially.
- __Fixes:__
- Fixed passed object count for taiko by ignoring non-circles.
+7 -5
View File
@@ -1,8 +1,10 @@
use std::borrow::Cow;
use crate::{
beatmap::BeatmapHitWindows,
parse::{HitObject, HitObjectKind},
util::FloatExt,
Beatmap, Mods,
Beatmap, GameMode, Mods,
};
use super::{
@@ -45,7 +47,7 @@ use super::{
#[derive(Clone, Debug)]
pub struct ManiaGradualDifficultyAttributes<'map> {
pub(crate) idx: usize,
map: &'map Beatmap,
map: Cow<'map, Beatmap>,
hit_window: f64,
strain: Strain,
diff_objects: Vec<ManiaDifficultyObject>,
@@ -56,6 +58,7 @@ pub struct ManiaGradualDifficultyAttributes<'map> {
impl<'map> ManiaGradualDifficultyAttributes<'map> {
/// Create a new difficulty attributes iterator for osu!mania maps.
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
let map = map.convert_mode(GameMode::Mania);
let total_columns = map.cs.round_even().max(1.0);
let clock_rate = mods.clock_rate();
let strain = Strain::new(total_columns as usize);
@@ -63,12 +66,11 @@ impl<'map> ManiaGradualDifficultyAttributes<'map> {
let BeatmapHitWindows { od: hit_window, .. } = map
.attributes()
.mods(mods)
// TODO: allow converts in gradual calc
.converted(false)
.converted(matches!(map, Cow::Owned(_)))
.clock_rate(clock_rate)
.hit_windows();
let mut params = ObjectParameters::new(map);
let mut params = ObjectParameters::new(map.as_ref());
let mut hit_objects = map.hit_objects.iter();
let first = match hit_objects.next() {
+1 -1
View File
@@ -515,7 +515,7 @@ pub struct OsuDifficultyAttributes {
/// The overall difficulty
pub od: f64,
/// The health drain rate.
pub hp: f64, // TODO: remove as it is not used for performance calculation
pub hp: f64,
/// The amount of circles.
pub n_circles: usize,
/// The amount of sliders.
+8 -6
View File
@@ -1,6 +1,6 @@
use std::{cell::RefCell, rc::Rc, vec::IntoIter};
use std::{borrow::Cow, cell::RefCell, rc::Rc, vec::IntoIter};
use crate::{beatmap::BeatmapHitWindows, taiko::rescale, Beatmap, Mods};
use crate::{beatmap::BeatmapHitWindows, taiko::rescale, Beatmap, GameMode, Mods};
use super::{
colours::ColourDifficultyPreprocessor,
@@ -47,12 +47,15 @@ pub struct TaikoGradualDifficultyAttributes {
lists: ObjectLists,
peaks: Peaks,
total_hits: usize,
is_convert: bool,
pub(crate) started: bool,
}
impl TaikoGradualDifficultyAttributes {
/// Create a new difficulty attributes iterator for osu!taiko maps.
pub fn new(map: &Beatmap, mods: u32) -> Self {
let map = map.convert_mode(GameMode::Taiko);
let is_convert = matches!(map, Cow::Owned(_));
let peaks = Peaks::new();
let clock_rate = mods.clock_rate();
@@ -79,6 +82,7 @@ impl TaikoGradualDifficultyAttributes {
peaks,
attrs,
total_hits: 0,
is_convert,
started: false,
};
}
@@ -132,6 +136,7 @@ impl TaikoGradualDifficultyAttributes {
peaks,
attrs,
total_hits,
is_convert,
started: false,
}
}
@@ -169,12 +174,9 @@ impl Iterator for TaikoGradualDifficultyAttributes {
let mut star_rating = rescale(combined_rating * 1.4);
// TODO: adjust once converts are available for gradual processing
let is_convert = false;
// * TODO: This is temporary measure as we don't detect abuse of multiple-input
// * playstyles of converts within the current system.
if is_convert {
if self.is_convert {
star_rating *= 0.925;
// * For maps with low colour variance and high stamina requirement,