pub struct Difficulty { /* private fields */ }Expand description
Difficulty calculator on maps of any mode.
§Example
use rosu_pp::{Beatmap, Difficulty, any::DifficultyAttributes};
let map = Beatmap::from_path("./resources/2118524.osu").unwrap();
let attrs: DifficultyAttributes = Difficulty::new()
.mods(8 + 1024) // HDFL
.calculate(&map);Implementations§
Source§impl Difficulty
impl Difficulty
Sourcepub fn inspect(self) -> InspectDifficulty
pub fn inspect(self) -> InspectDifficulty
Turn this Difficulty into a InspectDifficulty to inspect its
configured values.
Sourcepub fn mods(self, mods: impl Into<GameMods>) -> Self
pub fn mods(self, mods: impl Into<GameMods>) -> Self
Specify mods.
Accepted types are
Sourcepub const fn passed_objects(self, passed_objects: u32) -> Self
pub const fn passed_objects(self, passed_objects: u32) -> Self
Amount of passed objects for partial plays, e.g. a fail.
Sourcepub fn clock_rate(self, clock_rate: f64) -> Self
pub fn clock_rate(self, clock_rate: f64) -> Self
Adjust the clock rate used in the calculation.
If none is specified, it will take the clock rate based on the mods i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
| Minimum | Maximum |
|---|---|
| 0.01 | 100 |
Sourcepub const fn ar(self, ar: f32, fixed: bool) -> Self
pub const fn ar(self, ar: f32, fixed: bool) -> Self
Override a beatmap’s set AR.
Only relevant for osu! and osu!catch.
fixed determines if the given value should be used before or after
accounting for mods, e.g. on true the value will be used as is and on
false it will be modified based on the mods.
| Minimum | Maximum |
|---|---|
| -20 | 20 |
Sourcepub const fn cs(self, cs: f32, fixed: bool) -> Self
pub const fn cs(self, cs: f32, fixed: bool) -> Self
Override a beatmap’s set CS.
Only relevant for osu! and osu!catch.
fixed determines if the given value should be used before or after
accounting for mods, e.g. on true the value will be used as is and on
false it will be modified based on the mods.
| Minimum | Maximum |
|---|---|
| -20 | 20 |
Sourcepub const fn hp(self, hp: f32, fixed: bool) -> Self
pub const fn hp(self, hp: f32, fixed: bool) -> Self
Override a beatmap’s set HP.
fixed determines if the given value should be used before or after
accounting for mods, e.g. on true the value will be used as is and on
false it will be modified based on the mods.
| Minimum | Maximum |
|---|---|
| -20 | 20 |
Sourcepub const fn od(self, od: f32, fixed: bool) -> Self
pub const fn od(self, od: f32, fixed: bool) -> Self
Override a beatmap’s set OD.
fixed determines if the given value should be used before or after
accounting for mods, e.g. on true the value will be used as is and on
false it will be modified based on the mods.
| Minimum | Maximum |
|---|---|
| -20 | 20 |
Sourcepub const fn hardrock_offsets(self, hardrock_offsets: bool) -> Self
pub const fn hardrock_offsets(self, hardrock_offsets: bool) -> Self
Adjust patterns as if the HR mod is enabled.
Only relevant for osu!catch.
Sourcepub const fn lazer(self, lazer: bool) -> Self
pub const fn lazer(self, lazer: bool) -> Self
Whether the calculated attributes belong to an osu!lazer or osu!stable score.
Defaults to true.
Sourcepub fn calculate(&self, map: &Beatmap) -> DifficultyAttributes
pub fn calculate(&self, map: &Beatmap) -> DifficultyAttributes
Perform the difficulty calculation.
Sourcepub fn checked_calculate(
&self,
map: &Beatmap,
) -> Result<DifficultyAttributes, TooSuspicious>
pub fn checked_calculate( &self, map: &Beatmap, ) -> Result<DifficultyAttributes, TooSuspicious>
Perform the difficulty calculation after verifying the map is not suspicious.
Sourcepub fn calculate_for_mode<M: IGameMode>(
&self,
map: &Beatmap,
) -> Result<M::DifficultyAttributes, ConvertError>
pub fn calculate_for_mode<M: IGameMode>( &self, map: &Beatmap, ) -> Result<M::DifficultyAttributes, ConvertError>
Perform the difficulty calculation for a specific IGameMode.
Sourcepub fn checked_calculate_for_mode<M: IGameMode>(
&self,
map: &Beatmap,
) -> Result<M::DifficultyAttributes, CalculateError>
pub fn checked_calculate_for_mode<M: IGameMode>( &self, map: &Beatmap, ) -> Result<M::DifficultyAttributes, CalculateError>
Same as Difficulty::calculate_for_mode but verifies that the
Beatmap is not too suspicious for further calculation.
Sourcepub fn strains(&self, map: &Beatmap) -> Strains
pub fn strains(&self, map: &Beatmap) -> Strains
Perform the difficulty calculation but instead of evaluating the skill strains, return them as is.
Suitable to plot the difficulty of a map over time.
Sourcepub fn checked_strains(&self, map: &Beatmap) -> Result<Strains, TooSuspicious>
pub fn checked_strains(&self, map: &Beatmap) -> Result<Strains, TooSuspicious>
Perform the strain calculation after verifying the map is not suspicious.
See Difficulty::strains.
Sourcepub fn strains_for_mode<M: IGameMode>(
&self,
map: &Beatmap,
) -> Result<M::Strains, ConvertError>
pub fn strains_for_mode<M: IGameMode>( &self, map: &Beatmap, ) -> Result<M::Strains, ConvertError>
Perform the strain calculation for a specific IGameMode.
Sourcepub fn gradual_difficulty(self, map: &Beatmap) -> GradualDifficulty ⓘ
pub fn gradual_difficulty(self, map: &Beatmap) -> GradualDifficulty ⓘ
Create a gradual difficulty calculator for a Beatmap.
Sourcepub fn checked_gradual_difficulty(
self,
map: &Beatmap,
) -> Result<GradualDifficulty, TooSuspicious>
pub fn checked_gradual_difficulty( self, map: &Beatmap, ) -> Result<GradualDifficulty, TooSuspicious>
Same as Difficulty::gradual_difficulty but verifies that the map is
not suspicious.
Sourcepub fn gradual_difficulty_for_mode<M: IGameMode>(
self,
map: &Beatmap,
) -> Result<M::GradualDifficulty, ConvertError>
pub fn gradual_difficulty_for_mode<M: IGameMode>( self, map: &Beatmap, ) -> Result<M::GradualDifficulty, ConvertError>
Sourcepub fn gradual_performance(self, map: &Beatmap) -> GradualPerformance
pub fn gradual_performance(self, map: &Beatmap) -> GradualPerformance
Create a gradual performance calculator for a Beatmap.
Sourcepub fn checked_gradual_performance(
self,
map: &Beatmap,
) -> Result<GradualPerformance, TooSuspicious>
pub fn checked_gradual_performance( self, map: &Beatmap, ) -> Result<GradualPerformance, TooSuspicious>
Same as Difficulty::gradual_performance but verifies that the map is
not suspicious.
Sourcepub fn gradual_performance_for_mode<M: IGameMode>(
self,
map: &Beatmap,
) -> Result<M::GradualPerformance, ConvertError>
pub fn gradual_performance_for_mode<M: IGameMode>( self, map: &Beatmap, ) -> Result<M::GradualPerformance, ConvertError>
Trait Implementations§
Source§impl Clone for Difficulty
impl Clone for Difficulty
Source§fn clone(&self) -> Difficulty
fn clone(&self) -> Difficulty
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more