rosu_pp/taiko/
attributes.rs

1use crate::taiko::performance::TaikoPerformance;
2
3/// The result of a difficulty calculation on an osu!taiko map.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct TaikoDifficultyAttributes {
6    /// The difficulty of the stamina skill.
7    pub stamina: f64,
8    /// The difficulty of the rhythm skill.
9    pub rhythm: f64,
10    /// The difficulty of the color skill.
11    pub color: f64,
12    /// The difficulty of the reading skill.
13    pub reading: f64,
14    /// The perceived hit window for an n300 inclusive of rate-adjusting mods (DT/HT/etc)
15    pub great_hit_window: f64,
16    /// The perceived hit window for an n100 inclusive of rate-adjusting mods (DT/HT/etc)
17    pub ok_hit_window: f64,
18    /// The ratio of stamina difficulty from mono-color (single color) streams to total
19    /// stamina difficulty.
20    pub mono_stamina_factor: f64,
21    /// The final star rating.
22    pub stars: f64,
23    /// The maximum combo.
24    pub max_combo: u32,
25    /// Whether the [`Beatmap`] was a convert i.e. an osu!standard map.
26    ///
27    /// [`Beatmap`]: crate::model::beatmap::Beatmap
28    pub is_convert: bool,
29}
30
31impl TaikoDifficultyAttributes {
32    /// Return the maximum combo.
33    pub const fn max_combo(&self) -> u32 {
34        self.max_combo
35    }
36
37    /// Whether the [`Beatmap`] was a convert i.e. an osu!standard map.
38    ///
39    /// [`Beatmap`]: crate::model::beatmap::Beatmap
40    pub const fn is_convert(&self) -> bool {
41        self.is_convert
42    }
43
44    /// Returns a builder for performance calculation.
45    pub fn performance<'a>(self) -> TaikoPerformance<'a> {
46        self.into()
47    }
48}
49
50/// The result of a performance calculation on an osu!taiko map.
51#[derive(Clone, Debug, Default, PartialEq)]
52pub struct TaikoPerformanceAttributes {
53    /// The difficulty attributes that were used for the performance calculation
54    pub difficulty: TaikoDifficultyAttributes,
55    /// The final performance points.
56    pub pp: f64,
57    /// The accuracy portion of the final pp.
58    pub pp_acc: f64,
59    /// The strain portion of the final pp.
60    pub pp_difficulty: f64,
61    /// Scaled miss count based on total hits.
62    pub effective_miss_count: f64,
63    /// Upper bound on the player's tap deviation.
64    pub estimated_unstable_rate: Option<f64>,
65}
66
67impl TaikoPerformanceAttributes {
68    /// Return the star value.
69    pub const fn stars(&self) -> f64 {
70        self.difficulty.stars
71    }
72
73    /// Return the performance point value.
74    pub const fn pp(&self) -> f64 {
75        self.pp
76    }
77
78    /// Return the maximum combo of the map.
79    pub const fn max_combo(&self) -> u32 {
80        self.difficulty.max_combo
81    }
82
83    /// Whether the [`Beatmap`] was a convert i.e. an osu!standard map.
84    ///
85    /// [`Beatmap`]: crate::model::beatmap::Beatmap
86    pub const fn is_convert(&self) -> bool {
87        self.difficulty.is_convert
88    }
89
90    /// Returns a builder for performance calculation.
91    pub fn performance<'a>(self) -> TaikoPerformance<'a> {
92        self.difficulty.into()
93    }
94}
95
96impl From<TaikoPerformanceAttributes> for TaikoDifficultyAttributes {
97    fn from(attributes: TaikoPerformanceAttributes) -> Self {
98        attributes.difficulty
99    }
100}