Enum rosu_pp::any::Performance
source · pub enum Performance<'map> {
Osu(OsuPerformance<'map>),
Taiko(TaikoPerformance<'map>),
Catch(CatchPerformance<'map>),
Mania(ManiaPerformance<'map>),
}
Expand description
Performance calculator on maps of any mode.
Variants§
Osu(OsuPerformance<'map>)
Taiko(TaikoPerformance<'map>)
Catch(CatchPerformance<'map>)
Mania(ManiaPerformance<'map>)
Implementations§
source§impl<'map> Performance<'map>
impl<'map> Performance<'map>
sourcepub fn new(map_or_attrs: impl IntoPerformance<'map>) -> Self
pub fn new(map_or_attrs: impl IntoPerformance<'map>) -> Self
Create a new performance calculator for any mode.
The argument map_or_attrs
must be either
- previously calculated attributes (
DifficultyAttributes
,PerformanceAttributes
, or mode-specific attributes likeTaikoDifficultyAttributes
,ManiaPerformanceAttributes
, …) - a beatmap (
Beatmap
orConverted<'_, M>
)
If a map is given, difficulty attributes will need to be calculated internally which is a costly operation. Hence, passing attributes should be prefered.
However, when passing previously calculated attributes, make sure they
have been calculated for the same map and Difficulty
settings.
Otherwise, the final attributes will be incorrect.
sourcepub fn calculate(self) -> PerformanceAttributes
pub fn calculate(self) -> PerformanceAttributes
Consume the performance calculator and calculate performance attributes for the given parameters.
sourcepub fn try_mode(self, mode: GameMode) -> Result<Self, Self>
pub fn try_mode(self, mode: GameMode) -> Result<Self, Self>
Attempt to convert the map to the specified mode.
Returns Err(self)
if the conversion is incompatible or no beatmap is
contained, i.e. if this Performance
was created through attributes
or Performance::generate_state
was called.
If the given mode should be ignored in case of an error, use
mode_or_ignore
instead.
sourcepub fn mode_or_ignore(self, mode: GameMode) -> Self
pub fn mode_or_ignore(self, mode: GameMode) -> Self
Attempt to convert the map to the specified mode.
If the conversion is incompatible or if the internal beatmap was already replaced with difficulty attributes, the map won’t be modified.
To see whether the given mode is incompatible or the internal beatmap
was replaced, use try_mode
instead.
sourcepub fn difficulty(self, difficulty: Difficulty) -> Self
pub fn difficulty(self, difficulty: Difficulty) -> Self
Use the specified settings of the given Difficulty
.
sourcepub fn passed_objects(self, passed_objects: u32) -> Self
pub fn passed_objects(self, passed_objects: u32) -> Self
Amount of passed objects for partial plays, e.g. a fail.
If you want to calculate the performance after every few objects,
instead of using Performance
multiple times with different
passed_objects
, you should use GradualPerformance
.
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 fn ar(self, ar: f32, with_mods: bool) -> Self
pub fn ar(self, ar: f32, with_mods: bool) -> Self
Override a beatmap’s set AR.
Only relevant for osu! and osu!catch.
with_mods
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 fn cs(self, cs: f32, with_mods: bool) -> Self
pub fn cs(self, cs: f32, with_mods: bool) -> Self
Override a beatmap’s set CS.
Only relevant for osu! and osu!catch.
with_mods
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 fn hp(self, hp: f32, with_mods: bool) -> Self
pub fn hp(self, hp: f32, with_mods: bool) -> Self
Override a beatmap’s set HP.
with_mods
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 fn od(self, od: f32, with_mods: bool) -> Self
pub fn od(self, od: f32, with_mods: bool) -> Self
Override a beatmap’s set OD.
with_mods
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 fn hardrock_offsets(self, hardrock_offsets: bool) -> Self
pub fn hardrock_offsets(self, hardrock_offsets: bool) -> Self
Adjust patterns as if the HR mod is enabled.
Only relevant for osu!catch.
sourcepub fn state(self, state: ScoreState) -> Self
pub fn state(self, state: ScoreState) -> Self
Provide parameters through a ScoreState
.
sourcepub fn combo(self, combo: u32) -> Self
pub fn combo(self, combo: u32) -> Self
Specify the max combo of the play.
Irrelevant for osu!mania.
sourcepub fn hitresult_priority(self, priority: HitResultPriority) -> Self
pub fn hitresult_priority(self, priority: HitResultPriority) -> Self
Specify how hitresults should be generated.
Defauls to HitResultPriority::BestCase
.
sourcepub fn n50(self, n50: u32) -> Self
pub fn n50(self, n50: u32) -> Self
Specify the amount of 50s of a play.
Irrelevant for osu!taiko.
sourcepub fn n_katu(self, n_katu: u32) -> Self
pub fn n_katu(self, n_katu: u32) -> Self
Specify the amount of katus of a play.
Only relevant for osu!catch for which it represents the amount of tiny droplet misses and osu!mania for which it repesents the amount of n200.
sourcepub fn n_geki(self, n_geki: u32) -> Self
pub fn n_geki(self, n_geki: u32) -> Self
Specify the amount of gekis of a play.
Only relevant for osu!mania for which it repesents the amount of n320.
sourcepub fn generate_state(&mut self) -> ScoreState
pub fn generate_state(&mut self) -> ScoreState
Create the ScoreState
that will be used for performance calculation.
Trait Implementations§
source§impl<'map> Clone for Performance<'map>
impl<'map> Clone for Performance<'map>
source§fn clone(&self) -> Performance<'map>
fn clone(&self) -> Performance<'map>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'map> Debug for Performance<'map>
impl<'map> Debug for Performance<'map>
source§impl<'a, T: IntoPerformance<'a>> From<T> for Performance<'a>
impl<'a, T: IntoPerformance<'a>> From<T> for Performance<'a>
source§impl<'map> PartialEq for Performance<'map>
impl<'map> PartialEq for Performance<'map>
source§fn eq(&self, other: &Performance<'map>) -> bool
fn eq(&self, other: &Performance<'map>) -> bool
self
and other
values to be equal, and is used
by ==
.