reordering
This commit is contained in:
+36
-36
@@ -39,14 +39,14 @@ use crate::{
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum GradualDifficultyAttributes<'map> {
|
pub enum GradualDifficultyAttributes<'map> {
|
||||||
/// Gradual osu!catch difficulty attributes.
|
|
||||||
Catch(CatchGradualDifficultyAttributes<'map>),
|
|
||||||
/// Gradual osu!mania difficulty attributes.
|
|
||||||
Mania(ManiaGradualDifficultyAttributes<'map>),
|
|
||||||
/// Gradual osu!standard difficulty attributes.
|
/// Gradual osu!standard difficulty attributes.
|
||||||
Osu(OsuGradualDifficultyAttributes),
|
Osu(OsuGradualDifficultyAttributes),
|
||||||
/// Gradual osu!taiko difficulty attributes.
|
/// Gradual osu!taiko difficulty attributes.
|
||||||
Taiko(TaikoGradualDifficultyAttributes),
|
Taiko(TaikoGradualDifficultyAttributes),
|
||||||
|
/// Gradual osu!catch difficulty attributes.
|
||||||
|
Catch(CatchGradualDifficultyAttributes<'map>),
|
||||||
|
/// Gradual osu!mania difficulty attributes.
|
||||||
|
Mania(ManiaGradualDifficultyAttributes<'map>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'map> GradualDifficultyAttributes<'map> {
|
impl<'map> GradualDifficultyAttributes<'map> {
|
||||||
@@ -67,20 +67,20 @@ impl Iterator for GradualDifficultyAttributes<'_> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
match self {
|
match self {
|
||||||
GradualDifficultyAttributes::Catch(f) => f.next().map(DifficultyAttributes::Catch),
|
|
||||||
GradualDifficultyAttributes::Mania(m) => m.next().map(DifficultyAttributes::Mania),
|
|
||||||
GradualDifficultyAttributes::Osu(o) => o.next().map(DifficultyAttributes::Osu),
|
GradualDifficultyAttributes::Osu(o) => o.next().map(DifficultyAttributes::Osu),
|
||||||
GradualDifficultyAttributes::Taiko(t) => t.next().map(DifficultyAttributes::Taiko),
|
GradualDifficultyAttributes::Taiko(t) => t.next().map(DifficultyAttributes::Taiko),
|
||||||
|
GradualDifficultyAttributes::Catch(f) => f.next().map(DifficultyAttributes::Catch),
|
||||||
|
GradualDifficultyAttributes::Mania(m) => m.next().map(DifficultyAttributes::Mania),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
match self {
|
match self {
|
||||||
GradualDifficultyAttributes::Catch(f) => f.size_hint(),
|
|
||||||
GradualDifficultyAttributes::Mania(m) => m.size_hint(),
|
|
||||||
GradualDifficultyAttributes::Osu(o) => o.size_hint(),
|
GradualDifficultyAttributes::Osu(o) => o.size_hint(),
|
||||||
GradualDifficultyAttributes::Taiko(t) => t.size_hint(),
|
GradualDifficultyAttributes::Taiko(t) => t.size_hint(),
|
||||||
|
GradualDifficultyAttributes::Catch(f) => f.size_hint(),
|
||||||
|
GradualDifficultyAttributes::Mania(m) => m.size_hint(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,20 +120,6 @@ impl ScoreState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ScoreState> for CatchScoreState {
|
|
||||||
#[inline]
|
|
||||||
fn from(state: ScoreState) -> Self {
|
|
||||||
Self {
|
|
||||||
max_combo: state.max_combo,
|
|
||||||
n_fruits: state.n300,
|
|
||||||
n_droplets: state.n100,
|
|
||||||
n_tiny_droplets: state.n50,
|
|
||||||
n_tiny_droplet_misses: state.n_katu,
|
|
||||||
n_misses: state.n_misses,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ScoreState> for OsuScoreState {
|
impl From<ScoreState> for OsuScoreState {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(state: ScoreState) -> Self {
|
fn from(state: ScoreState) -> Self {
|
||||||
@@ -159,6 +145,20 @@ impl From<ScoreState> for TaikoScoreState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<ScoreState> for CatchScoreState {
|
||||||
|
#[inline]
|
||||||
|
fn from(state: ScoreState) -> Self {
|
||||||
|
Self {
|
||||||
|
max_combo: state.max_combo,
|
||||||
|
n_fruits: state.n300,
|
||||||
|
n_droplets: state.n100,
|
||||||
|
n_tiny_droplets: state.n50,
|
||||||
|
n_tiny_droplet_misses: state.n_katu,
|
||||||
|
n_misses: state.n_misses,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<ScoreState> for ManiaScoreState {
|
impl From<ScoreState> for ManiaScoreState {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(state: ScoreState) -> Self {
|
fn from(state: ScoreState) -> Self {
|
||||||
@@ -188,10 +188,10 @@ impl From<ScoreState> for ManiaScoreState {
|
|||||||
///
|
///
|
||||||
/// Alternatively, you can match on the map's mode yourself and use the gradual
|
/// Alternatively, you can match on the map's mode yourself and use the gradual
|
||||||
/// performance attribute struct for the corresponding mode, i.e.
|
/// performance attribute struct for the corresponding mode, i.e.
|
||||||
/// [`CatchGradualPerformanceAttributes`],
|
/// [`OsuGradualPerformanceAttributes`],
|
||||||
/// [`ManiaGradualPerformanceAttributes`],
|
/// [`TaikoGradualPerformanceAttributes`],
|
||||||
/// [`OsuGradualPerformanceAttributes`], or
|
/// [`CatchGradualPerformanceAttributes`], or
|
||||||
/// [`TaikoGradualPerformanceAttributes`].
|
/// [`ManiaGradualPerformanceAttributes`].
|
||||||
///
|
///
|
||||||
/// If you only want to calculate difficulty attributes use
|
/// If you only want to calculate difficulty attributes use
|
||||||
/// [`GradualDifficultyAttributes`](crate::GradualDifficultyAttributes) instead.
|
/// [`GradualDifficultyAttributes`](crate::GradualDifficultyAttributes) instead.
|
||||||
@@ -270,14 +270,14 @@ impl From<ScoreState> for ManiaScoreState {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum GradualPerformanceAttributes<'map> {
|
pub enum GradualPerformanceAttributes<'map> {
|
||||||
/// Gradual osu!catch performance attributes.
|
|
||||||
Catch(CatchGradualPerformanceAttributes<'map>),
|
|
||||||
/// Gradual osu!mania performance attributes.
|
|
||||||
Mania(ManiaGradualPerformanceAttributes<'map>),
|
|
||||||
/// Gradual osu!standard performance attributes.
|
/// Gradual osu!standard performance attributes.
|
||||||
Osu(OsuGradualPerformanceAttributes<'map>),
|
Osu(OsuGradualPerformanceAttributes<'map>),
|
||||||
/// Gradual osu!taiko performance attributes.
|
/// Gradual osu!taiko performance attributes.
|
||||||
Taiko(TaikoGradualPerformanceAttributes<'map>),
|
Taiko(TaikoGradualPerformanceAttributes<'map>),
|
||||||
|
/// Gradual osu!catch performance attributes.
|
||||||
|
Catch(CatchGradualPerformanceAttributes<'map>),
|
||||||
|
/// Gradual osu!mania performance attributes.
|
||||||
|
Mania(ManiaGradualPerformanceAttributes<'map>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'map> GradualPerformanceAttributes<'map> {
|
impl<'map> GradualPerformanceAttributes<'map> {
|
||||||
@@ -309,18 +309,18 @@ impl<'map> GradualPerformanceAttributes<'map> {
|
|||||||
n: usize,
|
n: usize,
|
||||||
) -> Option<PerformanceAttributes> {
|
) -> Option<PerformanceAttributes> {
|
||||||
match self {
|
match self {
|
||||||
GradualPerformanceAttributes::Catch(f) => f
|
|
||||||
.process_next_n_objects(state.into(), n)
|
|
||||||
.map(PerformanceAttributes::Catch),
|
|
||||||
GradualPerformanceAttributes::Mania(m) => m
|
|
||||||
.process_next_n_objects(state.into(), n)
|
|
||||||
.map(PerformanceAttributes::Mania),
|
|
||||||
GradualPerformanceAttributes::Osu(o) => o
|
GradualPerformanceAttributes::Osu(o) => o
|
||||||
.process_next_n_objects(state.into(), n)
|
.process_next_n_objects(state.into(), n)
|
||||||
.map(PerformanceAttributes::Osu),
|
.map(PerformanceAttributes::Osu),
|
||||||
GradualPerformanceAttributes::Taiko(t) => t
|
GradualPerformanceAttributes::Taiko(t) => t
|
||||||
.process_next_n_objects(state.into(), n)
|
.process_next_n_objects(state.into(), n)
|
||||||
.map(PerformanceAttributes::Taiko),
|
.map(PerformanceAttributes::Taiko),
|
||||||
|
GradualPerformanceAttributes::Catch(f) => f
|
||||||
|
.process_next_n_objects(state.into(), n)
|
||||||
|
.map(PerformanceAttributes::Catch),
|
||||||
|
GradualPerformanceAttributes::Mania(m) => m
|
||||||
|
.process_next_n_objects(state.into(), n)
|
||||||
|
.map(PerformanceAttributes::Mania),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+63
-63
@@ -256,9 +256,9 @@ impl BeatmapExt for Beatmap {
|
|||||||
fn stars(&self) -> AnyStars<'_> {
|
fn stars(&self) -> AnyStars<'_> {
|
||||||
match self.mode {
|
match self.mode {
|
||||||
GameMode::Osu => AnyStars::Osu(OsuStars::new(self)),
|
GameMode::Osu => AnyStars::Osu(OsuStars::new(self)),
|
||||||
GameMode::Mania => AnyStars::Mania(ManiaStars::new(self)),
|
|
||||||
GameMode::Taiko => AnyStars::Taiko(TaikoStars::new(self)),
|
GameMode::Taiko => AnyStars::Taiko(TaikoStars::new(self)),
|
||||||
GameMode::Catch => AnyStars::Catch(CatchStars::new(self)),
|
GameMode::Catch => AnyStars::Catch(CatchStars::new(self)),
|
||||||
|
GameMode::Mania => AnyStars::Mania(ManiaStars::new(self)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,15 +266,15 @@ impl BeatmapExt for Beatmap {
|
|||||||
fn max_pp(&self, mods: u32) -> PerformanceAttributes {
|
fn max_pp(&self, mods: u32) -> PerformanceAttributes {
|
||||||
match self.mode {
|
match self.mode {
|
||||||
GameMode::Osu => PerformanceAttributes::Osu(OsuPP::new(self).mods(mods).calculate()),
|
GameMode::Osu => PerformanceAttributes::Osu(OsuPP::new(self).mods(mods).calculate()),
|
||||||
GameMode::Mania => {
|
|
||||||
PerformanceAttributes::Mania(ManiaPP::new(self).mods(mods).calculate())
|
|
||||||
}
|
|
||||||
GameMode::Taiko => {
|
GameMode::Taiko => {
|
||||||
PerformanceAttributes::Taiko(TaikoPP::new(self).mods(mods).calculate())
|
PerformanceAttributes::Taiko(TaikoPP::new(self).mods(mods).calculate())
|
||||||
}
|
}
|
||||||
GameMode::Catch => {
|
GameMode::Catch => {
|
||||||
PerformanceAttributes::Catch(CatchPP::new(self).mods(mods).calculate())
|
PerformanceAttributes::Catch(CatchPP::new(self).mods(mods).calculate())
|
||||||
}
|
}
|
||||||
|
GameMode::Mania => {
|
||||||
|
PerformanceAttributes::Mania(ManiaPP::new(self).mods(mods).calculate())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,9 +287,9 @@ impl BeatmapExt for Beatmap {
|
|||||||
fn strains(&self, mods: u32) -> Strains {
|
fn strains(&self, mods: u32) -> Strains {
|
||||||
match self.mode {
|
match self.mode {
|
||||||
GameMode::Osu => Strains::Osu(OsuStars::new(self).mods(mods).strains()),
|
GameMode::Osu => Strains::Osu(OsuStars::new(self).mods(mods).strains()),
|
||||||
GameMode::Mania => Strains::Mania(ManiaStars::new(self).mods(mods).strains()),
|
|
||||||
GameMode::Taiko => Strains::Taiko(TaikoStars::new(self).mods(mods).strains()),
|
GameMode::Taiko => Strains::Taiko(TaikoStars::new(self).mods(mods).strains()),
|
||||||
GameMode::Catch => Strains::Catch(CatchStars::new(self).mods(mods).strains()),
|
GameMode::Catch => Strains::Catch(CatchStars::new(self).mods(mods).strains()),
|
||||||
|
GameMode::Mania => Strains::Mania(ManiaStars::new(self).mods(mods).strains()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,14 +308,14 @@ impl BeatmapExt for Beatmap {
|
|||||||
/// Suitable to plot the difficulty of a map over time.
|
/// Suitable to plot the difficulty of a map over time.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Strains {
|
pub enum Strains {
|
||||||
/// osu!catch strain values.
|
|
||||||
Catch(catch::CatchStrains),
|
|
||||||
/// osu!mania strain values.
|
|
||||||
Mania(mania::ManiaStrains),
|
|
||||||
/// osu!standard strain values.
|
/// osu!standard strain values.
|
||||||
Osu(osu::OsuStrains),
|
Osu(osu::OsuStrains),
|
||||||
/// osu!taiko strain values.
|
/// osu!taiko strain values.
|
||||||
Taiko(taiko::TaikoStrains),
|
Taiko(taiko::TaikoStrains),
|
||||||
|
/// osu!catch strain values.
|
||||||
|
Catch(catch::CatchStrains),
|
||||||
|
/// osu!mania strain values.
|
||||||
|
Mania(mania::ManiaStrains),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Strains {
|
impl Strains {
|
||||||
@@ -323,10 +323,10 @@ impl Strains {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn section_len(&self) -> f64 {
|
pub fn section_len(&self) -> f64 {
|
||||||
match self {
|
match self {
|
||||||
Strains::Catch(strains) => strains.section_len,
|
|
||||||
Strains::Mania(strains) => strains.section_len,
|
|
||||||
Strains::Osu(strains) => strains.section_len,
|
Strains::Osu(strains) => strains.section_len,
|
||||||
Strains::Taiko(strains) => strains.section_len,
|
Strains::Taiko(strains) => strains.section_len,
|
||||||
|
Strains::Catch(strains) => strains.section_len,
|
||||||
|
Strains::Mania(strains) => strains.section_len,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,10 +335,10 @@ impl Strains {
|
|||||||
#[allow(clippy::len_without_is_empty)]
|
#[allow(clippy::len_without_is_empty)]
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
Strains::Catch(strains) => strains.len(),
|
|
||||||
Strains::Mania(strains) => strains.len(),
|
|
||||||
Strains::Osu(strains) => strains.len(),
|
Strains::Osu(strains) => strains.len(),
|
||||||
Strains::Taiko(strains) => strains.len(),
|
Strains::Taiko(strains) => strains.len(),
|
||||||
|
Strains::Catch(strains) => strains.len(),
|
||||||
|
Strains::Mania(strains) => strains.len(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -346,14 +346,14 @@ impl Strains {
|
|||||||
/// The result of a difficulty calculation based on the mode.
|
/// The result of a difficulty calculation based on the mode.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum DifficultyAttributes {
|
pub enum DifficultyAttributes {
|
||||||
/// osu!catch difficulty calculation result.
|
|
||||||
Catch(catch::CatchDifficultyAttributes),
|
|
||||||
/// osu!mania difficulty calculation result.
|
|
||||||
Mania(mania::ManiaDifficultyAttributes),
|
|
||||||
/// osu!standard difficulty calculation result.
|
/// osu!standard difficulty calculation result.
|
||||||
Osu(osu::OsuDifficultyAttributes),
|
Osu(osu::OsuDifficultyAttributes),
|
||||||
/// osu!taiko difficulty calculation result.
|
/// osu!taiko difficulty calculation result.
|
||||||
Taiko(taiko::TaikoDifficultyAttributes),
|
Taiko(taiko::TaikoDifficultyAttributes),
|
||||||
|
/// osu!catch difficulty calculation result.
|
||||||
|
Catch(catch::CatchDifficultyAttributes),
|
||||||
|
/// osu!mania difficulty calculation result.
|
||||||
|
Mania(mania::ManiaDifficultyAttributes),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DifficultyAttributes {
|
impl DifficultyAttributes {
|
||||||
@@ -361,10 +361,10 @@ impl DifficultyAttributes {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn stars(&self) -> f64 {
|
pub fn stars(&self) -> f64 {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(attrs) => attrs.stars,
|
|
||||||
Self::Mania(attrs) => attrs.stars,
|
|
||||||
Self::Osu(attrs) => attrs.stars,
|
Self::Osu(attrs) => attrs.stars,
|
||||||
Self::Taiko(attrs) => attrs.stars,
|
Self::Taiko(attrs) => attrs.stars,
|
||||||
|
Self::Catch(attrs) => attrs.stars,
|
||||||
|
Self::Mania(attrs) => attrs.stars,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,28 +372,14 @@ impl DifficultyAttributes {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn max_combo(&self) -> usize {
|
pub fn max_combo(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(attrs) => attrs.max_combo(),
|
|
||||||
Self::Mania(attrs) => attrs.max_combo,
|
|
||||||
Self::Osu(attrs) => attrs.max_combo,
|
Self::Osu(attrs) => attrs.max_combo,
|
||||||
Self::Taiko(attrs) => attrs.max_combo,
|
Self::Taiko(attrs) => attrs.max_combo,
|
||||||
|
Self::Catch(attrs) => attrs.max_combo(),
|
||||||
|
Self::Mania(attrs) => attrs.max_combo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<catch::CatchDifficultyAttributes> for DifficultyAttributes {
|
|
||||||
#[inline]
|
|
||||||
fn from(attributes: catch::CatchDifficultyAttributes) -> Self {
|
|
||||||
Self::Catch(attributes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<mania::ManiaDifficultyAttributes> for DifficultyAttributes {
|
|
||||||
#[inline]
|
|
||||||
fn from(attributes: mania::ManiaDifficultyAttributes) -> Self {
|
|
||||||
Self::Mania(attributes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<osu::OsuDifficultyAttributes> for DifficultyAttributes {
|
impl From<osu::OsuDifficultyAttributes> for DifficultyAttributes {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(attributes: osu::OsuDifficultyAttributes) -> Self {
|
fn from(attributes: osu::OsuDifficultyAttributes) -> Self {
|
||||||
@@ -408,17 +394,31 @@ impl From<taiko::TaikoDifficultyAttributes> for DifficultyAttributes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<catch::CatchDifficultyAttributes> for DifficultyAttributes {
|
||||||
|
#[inline]
|
||||||
|
fn from(attributes: catch::CatchDifficultyAttributes) -> Self {
|
||||||
|
Self::Catch(attributes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<mania::ManiaDifficultyAttributes> for DifficultyAttributes {
|
||||||
|
#[inline]
|
||||||
|
fn from(attributes: mania::ManiaDifficultyAttributes) -> Self {
|
||||||
|
Self::Mania(attributes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The result of a performance calculation based on the mode.
|
/// The result of a performance calculation based on the mode.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum PerformanceAttributes {
|
pub enum PerformanceAttributes {
|
||||||
/// osu!catch performance calculation result.
|
|
||||||
Catch(catch::CatchPerformanceAttributes),
|
|
||||||
/// osu!mania performance calculation result.
|
|
||||||
Mania(mania::ManiaPerformanceAttributes),
|
|
||||||
/// osu!standard performance calculation result.
|
/// osu!standard performance calculation result.
|
||||||
Osu(osu::OsuPerformanceAttributes),
|
Osu(osu::OsuPerformanceAttributes),
|
||||||
/// osu!taiko performance calculation result.
|
/// osu!taiko performance calculation result.
|
||||||
Taiko(taiko::TaikoPerformanceAttributes),
|
Taiko(taiko::TaikoPerformanceAttributes),
|
||||||
|
/// osu!catch performance calculation result.
|
||||||
|
Catch(catch::CatchPerformanceAttributes),
|
||||||
|
/// osu!mania performance calculation result.
|
||||||
|
Mania(mania::ManiaPerformanceAttributes),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PerformanceAttributes {
|
impl PerformanceAttributes {
|
||||||
@@ -426,10 +426,10 @@ impl PerformanceAttributes {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn pp(&self) -> f64 {
|
pub fn pp(&self) -> f64 {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(attrs) => attrs.pp,
|
|
||||||
Self::Mania(attrs) => attrs.pp,
|
|
||||||
Self::Osu(attrs) => attrs.pp,
|
Self::Osu(attrs) => attrs.pp,
|
||||||
Self::Taiko(attrs) => attrs.pp,
|
Self::Taiko(attrs) => attrs.pp,
|
||||||
|
Self::Catch(attrs) => attrs.pp,
|
||||||
|
Self::Mania(attrs) => attrs.pp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,10 +437,10 @@ impl PerformanceAttributes {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn stars(&self) -> f64 {
|
pub fn stars(&self) -> f64 {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(attrs) => attrs.stars(),
|
|
||||||
Self::Mania(attrs) => attrs.stars(),
|
|
||||||
Self::Osu(attrs) => attrs.stars(),
|
Self::Osu(attrs) => attrs.stars(),
|
||||||
Self::Taiko(attrs) => attrs.stars(),
|
Self::Taiko(attrs) => attrs.stars(),
|
||||||
|
Self::Catch(attrs) => attrs.stars(),
|
||||||
|
Self::Mania(attrs) => attrs.stars(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,10 +448,10 @@ impl PerformanceAttributes {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn difficulty_attributes(&self) -> DifficultyAttributes {
|
pub fn difficulty_attributes(&self) -> DifficultyAttributes {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(attrs) => DifficultyAttributes::Catch(attrs.difficulty.clone()),
|
|
||||||
Self::Mania(attrs) => DifficultyAttributes::Mania(attrs.difficulty),
|
|
||||||
Self::Osu(attrs) => DifficultyAttributes::Osu(attrs.difficulty.clone()),
|
Self::Osu(attrs) => DifficultyAttributes::Osu(attrs.difficulty.clone()),
|
||||||
Self::Taiko(attrs) => DifficultyAttributes::Taiko(attrs.difficulty.clone()),
|
Self::Taiko(attrs) => DifficultyAttributes::Taiko(attrs.difficulty.clone()),
|
||||||
|
Self::Catch(attrs) => DifficultyAttributes::Catch(attrs.difficulty.clone()),
|
||||||
|
Self::Mania(attrs) => DifficultyAttributes::Mania(attrs.difficulty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,10 +459,10 @@ impl PerformanceAttributes {
|
|||||||
/// The maximum combo of the map.
|
/// The maximum combo of the map.
|
||||||
pub fn max_combo(&self) -> usize {
|
pub fn max_combo(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(attrs) => attrs.difficulty.max_combo(),
|
|
||||||
Self::Mania(attrs) => attrs.difficulty.max_combo,
|
|
||||||
Self::Osu(attrs) => attrs.difficulty.max_combo,
|
Self::Osu(attrs) => attrs.difficulty.max_combo,
|
||||||
Self::Taiko(attrs) => attrs.difficulty.max_combo,
|
Self::Taiko(attrs) => attrs.difficulty.max_combo,
|
||||||
|
Self::Catch(attrs) => attrs.difficulty.max_combo(),
|
||||||
|
Self::Mania(attrs) => attrs.difficulty.max_combo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,28 +471,14 @@ impl From<PerformanceAttributes> for DifficultyAttributes {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn from(attributes: PerformanceAttributes) -> Self {
|
fn from(attributes: PerformanceAttributes) -> Self {
|
||||||
match attributes {
|
match attributes {
|
||||||
PerformanceAttributes::Catch(attrs) => Self::Catch(attrs.difficulty),
|
|
||||||
PerformanceAttributes::Mania(attrs) => Self::Mania(attrs.difficulty),
|
|
||||||
PerformanceAttributes::Osu(attrs) => Self::Osu(attrs.difficulty),
|
PerformanceAttributes::Osu(attrs) => Self::Osu(attrs.difficulty),
|
||||||
PerformanceAttributes::Taiko(attrs) => Self::Taiko(attrs.difficulty),
|
PerformanceAttributes::Taiko(attrs) => Self::Taiko(attrs.difficulty),
|
||||||
|
PerformanceAttributes::Catch(attrs) => Self::Catch(attrs.difficulty),
|
||||||
|
PerformanceAttributes::Mania(attrs) => Self::Mania(attrs.difficulty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<catch::CatchPerformanceAttributes> for PerformanceAttributes {
|
|
||||||
#[inline]
|
|
||||||
fn from(attributes: catch::CatchPerformanceAttributes) -> Self {
|
|
||||||
Self::Catch(attributes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<mania::ManiaPerformanceAttributes> for PerformanceAttributes {
|
|
||||||
#[inline]
|
|
||||||
fn from(attributes: mania::ManiaPerformanceAttributes) -> Self {
|
|
||||||
Self::Mania(attributes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<osu::OsuPerformanceAttributes> for PerformanceAttributes {
|
impl From<osu::OsuPerformanceAttributes> for PerformanceAttributes {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(attributes: osu::OsuPerformanceAttributes) -> Self {
|
fn from(attributes: osu::OsuPerformanceAttributes) -> Self {
|
||||||
@@ -507,5 +493,19 @@ impl From<taiko::TaikoPerformanceAttributes> for PerformanceAttributes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<catch::CatchPerformanceAttributes> for PerformanceAttributes {
|
||||||
|
#[inline]
|
||||||
|
fn from(attributes: catch::CatchPerformanceAttributes) -> Self {
|
||||||
|
Self::Catch(attributes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<mania::ManiaPerformanceAttributes> for PerformanceAttributes {
|
||||||
|
#[inline]
|
||||||
|
fn from(attributes: mania::ManiaPerformanceAttributes) -> Self {
|
||||||
|
Self::Mania(attributes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "async_tokio", feature = "async_std"))]
|
#[cfg(all(feature = "async_tokio", feature = "async_std"))]
|
||||||
compile_error!("Only one of the features `async_tokio` and `async_std` should be enabled");
|
compile_error!("Only one of the features `async_tokio` and `async_std` should be enabled");
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ use crate::{
|
|||||||
#[allow(clippy::upper_case_acronyms)]
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum AnyPP<'map> {
|
pub enum AnyPP<'map> {
|
||||||
/// osu!catch performance calculator
|
|
||||||
Catch(CatchPP<'map>),
|
|
||||||
/// osu!mania performance calculator
|
|
||||||
Mania(ManiaPP<'map>),
|
|
||||||
/// osu!standard performance calculator
|
/// osu!standard performance calculator
|
||||||
Osu(OsuPP<'map>),
|
Osu(OsuPP<'map>),
|
||||||
/// osu!taiko performance calculator
|
/// osu!taiko performance calculator
|
||||||
Taiko(TaikoPP<'map>),
|
Taiko(TaikoPP<'map>),
|
||||||
|
/// osu!catch performance calculator
|
||||||
|
Catch(CatchPP<'map>),
|
||||||
|
/// osu!mania performance calculator
|
||||||
|
Mania(ManiaPP<'map>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'map> AnyPP<'map> {
|
impl<'map> AnyPP<'map> {
|
||||||
@@ -53,10 +53,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(map: &'map Beatmap) -> Self {
|
pub fn new(map: &'map Beatmap) -> Self {
|
||||||
match map.mode {
|
match map.mode {
|
||||||
GameMode::Catch => Self::Catch(CatchPP::new(map)),
|
|
||||||
GameMode::Mania => Self::Mania(ManiaPP::new(map)),
|
|
||||||
GameMode::Osu => Self::Osu(OsuPP::new(map)),
|
GameMode::Osu => Self::Osu(OsuPP::new(map)),
|
||||||
GameMode::Taiko => Self::Taiko(TaikoPP::new(map)),
|
GameMode::Taiko => Self::Taiko(TaikoPP::new(map)),
|
||||||
|
GameMode::Catch => Self::Catch(CatchPP::new(map)),
|
||||||
|
GameMode::Mania => Self::Mania(ManiaPP::new(map)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,10 +65,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn calculate(self) -> PerformanceAttributes {
|
pub fn calculate(self) -> PerformanceAttributes {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => PerformanceAttributes::Catch(f.calculate()),
|
|
||||||
Self::Mania(m) => PerformanceAttributes::Mania(m.calculate()),
|
|
||||||
Self::Osu(o) => PerformanceAttributes::Osu(o.calculate()),
|
Self::Osu(o) => PerformanceAttributes::Osu(o.calculate()),
|
||||||
Self::Taiko(t) => PerformanceAttributes::Taiko(t.calculate()),
|
Self::Taiko(t) => PerformanceAttributes::Taiko(t.calculate()),
|
||||||
|
Self::Catch(f) => PerformanceAttributes::Catch(f.calculate()),
|
||||||
|
Self::Mania(m) => PerformanceAttributes::Mania(m.calculate()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,10 +78,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn attributes(self, attributes: impl AttributeProvider) -> Self {
|
pub fn attributes(self, attributes: impl AttributeProvider) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.attributes(attributes.attributes())),
|
|
||||||
Self::Mania(m) => Self::Mania(m.attributes(attributes.attributes())),
|
|
||||||
Self::Osu(o) => Self::Osu(o.attributes(attributes.attributes())),
|
Self::Osu(o) => Self::Osu(o.attributes(attributes.attributes())),
|
||||||
Self::Taiko(t) => Self::Taiko(t.attributes(attributes.attributes())),
|
Self::Taiko(t) => Self::Taiko(t.attributes(attributes.attributes())),
|
||||||
|
Self::Catch(f) => Self::Catch(f.attributes(attributes.attributes())),
|
||||||
|
Self::Mania(m) => Self::Mania(m.attributes(attributes.attributes())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,10 +105,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn mods(self, mods: u32) -> Self {
|
pub fn mods(self, mods: u32) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.mods(mods)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.mods(mods)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.mods(mods)),
|
Self::Osu(o) => Self::Osu(o.mods(mods)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.mods(mods)),
|
Self::Taiko(t) => Self::Taiko(t.mods(mods)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.mods(mods)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.mods(mods)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,10 +120,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn passed_objects(self, passed_objects: usize) -> Self {
|
pub fn passed_objects(self, passed_objects: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.passed_objects(passed_objects)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.passed_objects(passed_objects)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.passed_objects(passed_objects)),
|
Self::Osu(o) => Self::Osu(o.passed_objects(passed_objects)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.passed_objects(passed_objects)),
|
Self::Taiko(t) => Self::Taiko(t.passed_objects(passed_objects)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.passed_objects(passed_objects)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.passed_objects(passed_objects)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,10 +133,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn clock_rate(self, clock_rate: f64) -> Self {
|
pub fn clock_rate(self, clock_rate: f64) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.clock_rate(clock_rate)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.clock_rate(clock_rate)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.clock_rate(clock_rate)),
|
Self::Osu(o) => Self::Osu(o.clock_rate(clock_rate)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.clock_rate(clock_rate)),
|
Self::Taiko(t) => Self::Taiko(t.clock_rate(clock_rate)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.clock_rate(clock_rate)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.clock_rate(clock_rate)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,10 +144,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn state(self, state: ScoreState) -> Self {
|
pub fn state(self, state: ScoreState) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.state(state.into())),
|
|
||||||
Self::Mania(m) => Self::Mania(m.state(state.into())),
|
|
||||||
Self::Osu(o) => Self::Osu(o.state(state.into())),
|
Self::Osu(o) => Self::Osu(o.state(state.into())),
|
||||||
Self::Taiko(t) => Self::Taiko(t.state(state.into())),
|
Self::Taiko(t) => Self::Taiko(t.state(state.into())),
|
||||||
|
Self::Catch(f) => Self::Catch(f.state(state.into())),
|
||||||
|
Self::Mania(m) => Self::Mania(m.state(state.into())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,10 +155,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn accuracy(self, acc: f64) -> Self {
|
pub fn accuracy(self, acc: f64) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.accuracy(acc)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.accuracy(acc)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.accuracy(acc)),
|
Self::Osu(o) => Self::Osu(o.accuracy(acc)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.accuracy(acc)),
|
Self::Taiko(t) => Self::Taiko(t.accuracy(acc)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.accuracy(acc)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.accuracy(acc)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,10 +166,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn n_misses(self, n_misses: usize) -> Self {
|
pub fn n_misses(self, n_misses: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.misses(n_misses)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.n_misses(n_misses)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.n_misses(n_misses)),
|
Self::Osu(o) => Self::Osu(o.n_misses(n_misses)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.n_misses(n_misses)),
|
Self::Taiko(t) => Self::Taiko(t.n_misses(n_misses)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.misses(n_misses)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.n_misses(n_misses)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,10 +179,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn combo(self, combo: usize) -> Self {
|
pub fn combo(self, combo: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.combo(combo)),
|
|
||||||
Self::Mania(_) => self,
|
|
||||||
Self::Osu(o) => Self::Osu(o.combo(combo)),
|
Self::Osu(o) => Self::Osu(o.combo(combo)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.combo(combo)),
|
Self::Taiko(t) => Self::Taiko(t.combo(combo)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.combo(combo)),
|
||||||
|
Self::Mania(_) => self,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,10 +190,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn n300(self, n300: usize) -> Self {
|
pub fn n300(self, n300: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.fruits(n300)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.n300(n300)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.n300(n300)),
|
Self::Osu(o) => Self::Osu(o.n300(n300)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.n300(n300)),
|
Self::Taiko(t) => Self::Taiko(t.n300(n300)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.fruits(n300)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.n300(n300)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,10 +201,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn n100(self, n100: usize) -> Self {
|
pub fn n100(self, n100: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.droplets(n100)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.n100(n100)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.n100(n100)),
|
Self::Osu(o) => Self::Osu(o.n100(n100)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.n100(n100)),
|
Self::Taiko(t) => Self::Taiko(t.n100(n100)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.droplets(n100)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.n100(n100)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,10 +214,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn n50(self, n50: usize) -> Self {
|
pub fn n50(self, n50: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.tiny_droplets(n50)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.n50(n50)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.n50(n50)),
|
Self::Osu(o) => Self::Osu(o.n50(n50)),
|
||||||
Self::Taiko(_) => self,
|
Self::Taiko(_) => self,
|
||||||
|
Self::Catch(f) => Self::Catch(f.tiny_droplets(n50)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.n50(n50)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,10 +229,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn n_katu(self, n_katu: usize) -> Self {
|
pub fn n_katu(self, n_katu: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.tiny_droplet_misses(n_katu)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.n200(n_katu)),
|
|
||||||
Self::Osu(_) => self,
|
Self::Osu(_) => self,
|
||||||
Self::Taiko(_) => self,
|
Self::Taiko(_) => self,
|
||||||
|
Self::Catch(f) => Self::Catch(f.tiny_droplet_misses(n_katu)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.n200(n_katu)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,10 +243,10 @@ impl<'map> AnyPP<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn n_geki(self, n_geki: usize) -> Self {
|
pub fn n_geki(self, n_geki: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Mania(m) => Self::Mania(m.n320(n_geki)),
|
|
||||||
Self::Osu(_) => self,
|
Self::Osu(_) => self,
|
||||||
Self::Taiko(_) => self,
|
Self::Taiko(_) => self,
|
||||||
Self::Catch(_) => self,
|
Self::Catch(_) => self,
|
||||||
|
Self::Mania(m) => Self::Mania(m.n320(n_geki)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,10 +284,10 @@ impl AttributeProvider for PerformanceAttributes {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn attributes(self) -> DifficultyAttributes {
|
fn attributes(self) -> DifficultyAttributes {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(attrs) => DifficultyAttributes::Catch(attrs.difficulty),
|
|
||||||
Self::Mania(attrs) => DifficultyAttributes::Mania(attrs.difficulty),
|
|
||||||
Self::Osu(attrs) => DifficultyAttributes::Osu(attrs.difficulty),
|
Self::Osu(attrs) => DifficultyAttributes::Osu(attrs.difficulty),
|
||||||
Self::Taiko(attrs) => DifficultyAttributes::Taiko(attrs.difficulty),
|
Self::Taiko(attrs) => DifficultyAttributes::Taiko(attrs.difficulty),
|
||||||
|
Self::Catch(attrs) => DifficultyAttributes::Catch(attrs.difficulty),
|
||||||
|
Self::Mania(attrs) => DifficultyAttributes::Mania(attrs.difficulty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-16
@@ -22,14 +22,14 @@ use crate::{
|
|||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum AnyStars<'map> {
|
pub enum AnyStars<'map> {
|
||||||
/// osu!catch difficulty calculator
|
|
||||||
Catch(CatchStars<'map>),
|
|
||||||
/// osu!mania difficulty calculator
|
|
||||||
Mania(ManiaStars<'map>),
|
|
||||||
/// osu!standard difficulty calculator
|
/// osu!standard difficulty calculator
|
||||||
Osu(OsuStars<'map>),
|
Osu(OsuStars<'map>),
|
||||||
/// osu!taiko difficulty calculator
|
/// osu!taiko difficulty calculator
|
||||||
Taiko(TaikoStars<'map>),
|
Taiko(TaikoStars<'map>),
|
||||||
|
/// osu!catch difficulty calculator
|
||||||
|
Catch(CatchStars<'map>),
|
||||||
|
/// osu!mania difficulty calculator
|
||||||
|
Mania(ManiaStars<'map>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'map> AnyStars<'map> {
|
impl<'map> AnyStars<'map> {
|
||||||
@@ -37,10 +37,10 @@ impl<'map> AnyStars<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(map: &'map Beatmap) -> Self {
|
pub fn new(map: &'map Beatmap) -> Self {
|
||||||
match map.mode {
|
match map.mode {
|
||||||
GameMode::Catch => Self::Catch(CatchStars::new(map)),
|
|
||||||
GameMode::Mania => Self::Mania(ManiaStars::new(map)),
|
|
||||||
GameMode::Osu => Self::Osu(OsuStars::new(map)),
|
GameMode::Osu => Self::Osu(OsuStars::new(map)),
|
||||||
GameMode::Taiko => Self::Taiko(TaikoStars::new(map)),
|
GameMode::Taiko => Self::Taiko(TaikoStars::new(map)),
|
||||||
|
GameMode::Catch => Self::Catch(CatchStars::new(map)),
|
||||||
|
GameMode::Mania => Self::Mania(ManiaStars::new(map)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,10 +64,10 @@ impl<'map> AnyStars<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn mods(self, mods: u32) -> Self {
|
pub fn mods(self, mods: u32) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.mods(mods)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.mods(mods)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.mods(mods)),
|
Self::Osu(o) => Self::Osu(o.mods(mods)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.mods(mods)),
|
Self::Taiko(t) => Self::Taiko(t.mods(mods)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.mods(mods)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.mods(mods)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,10 +79,10 @@ impl<'map> AnyStars<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn passed_objects(self, passed_objects: usize) -> Self {
|
pub fn passed_objects(self, passed_objects: usize) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.passed_objects(passed_objects)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.passed_objects(passed_objects)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.passed_objects(passed_objects)),
|
Self::Osu(o) => Self::Osu(o.passed_objects(passed_objects)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.passed_objects(passed_objects)),
|
Self::Taiko(t) => Self::Taiko(t.passed_objects(passed_objects)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.passed_objects(passed_objects)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.passed_objects(passed_objects)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,10 +92,10 @@ impl<'map> AnyStars<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn clock_rate(self, clock_rate: f64) -> Self {
|
pub fn clock_rate(self, clock_rate: f64) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Self::Catch(f.clock_rate(clock_rate)),
|
|
||||||
Self::Mania(m) => Self::Mania(m.clock_rate(clock_rate)),
|
|
||||||
Self::Osu(o) => Self::Osu(o.clock_rate(clock_rate)),
|
Self::Osu(o) => Self::Osu(o.clock_rate(clock_rate)),
|
||||||
Self::Taiko(t) => Self::Taiko(t.clock_rate(clock_rate)),
|
Self::Taiko(t) => Self::Taiko(t.clock_rate(clock_rate)),
|
||||||
|
Self::Catch(f) => Self::Catch(f.clock_rate(clock_rate)),
|
||||||
|
Self::Mania(m) => Self::Mania(m.clock_rate(clock_rate)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,10 +104,10 @@ impl<'map> AnyStars<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn calculate(self) -> DifficultyAttributes {
|
pub fn calculate(self) -> DifficultyAttributes {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => DifficultyAttributes::Catch(f.calculate()),
|
|
||||||
Self::Mania(m) => DifficultyAttributes::Mania(m.calculate()),
|
|
||||||
Self::Osu(o) => DifficultyAttributes::Osu(o.calculate()),
|
Self::Osu(o) => DifficultyAttributes::Osu(o.calculate()),
|
||||||
Self::Taiko(t) => DifficultyAttributes::Taiko(t.calculate()),
|
Self::Taiko(t) => DifficultyAttributes::Taiko(t.calculate()),
|
||||||
|
Self::Catch(f) => DifficultyAttributes::Catch(f.calculate()),
|
||||||
|
Self::Mania(m) => DifficultyAttributes::Mania(m.calculate()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,10 +118,10 @@ impl<'map> AnyStars<'map> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn strains(self) -> Strains {
|
pub fn strains(self) -> Strains {
|
||||||
match self {
|
match self {
|
||||||
Self::Catch(f) => Strains::Catch(f.strains()),
|
|
||||||
Self::Mania(m) => Strains::Mania(m.strains()),
|
|
||||||
Self::Osu(o) => Strains::Osu(o.strains()),
|
Self::Osu(o) => Strains::Osu(o.strains()),
|
||||||
Self::Taiko(t) => Strains::Taiko(t.strains()),
|
Self::Taiko(t) => Strains::Taiko(t.strains()),
|
||||||
|
Self::Catch(f) => Strains::Catch(f.strains()),
|
||||||
|
Self::Mania(m) => Strains::Mania(m.strains()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user