reordering
This commit is contained in:
+36
-36
@@ -39,14 +39,14 @@ use crate::{
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
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.
|
||||
Osu(OsuGradualDifficultyAttributes),
|
||||
/// Gradual osu!taiko difficulty attributes.
|
||||
Taiko(TaikoGradualDifficultyAttributes),
|
||||
/// Gradual osu!catch difficulty attributes.
|
||||
Catch(CatchGradualDifficultyAttributes<'map>),
|
||||
/// Gradual osu!mania difficulty attributes.
|
||||
Mania(ManiaGradualDifficultyAttributes<'map>),
|
||||
}
|
||||
|
||||
impl<'map> GradualDifficultyAttributes<'map> {
|
||||
@@ -67,20 +67,20 @@ impl Iterator for GradualDifficultyAttributes<'_> {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
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::Taiko(t) => t.next().map(DifficultyAttributes::Taiko),
|
||||
GradualDifficultyAttributes::Catch(f) => f.next().map(DifficultyAttributes::Catch),
|
||||
GradualDifficultyAttributes::Mania(m) => m.next().map(DifficultyAttributes::Mania),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
match self {
|
||||
GradualDifficultyAttributes::Catch(f) => f.size_hint(),
|
||||
GradualDifficultyAttributes::Mania(m) => m.size_hint(),
|
||||
GradualDifficultyAttributes::Osu(o) => o.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 {
|
||||
#[inline]
|
||||
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 {
|
||||
#[inline]
|
||||
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
|
||||
/// performance attribute struct for the corresponding mode, i.e.
|
||||
/// [`CatchGradualPerformanceAttributes`],
|
||||
/// [`ManiaGradualPerformanceAttributes`],
|
||||
/// [`OsuGradualPerformanceAttributes`], or
|
||||
/// [`TaikoGradualPerformanceAttributes`].
|
||||
/// [`OsuGradualPerformanceAttributes`],
|
||||
/// [`TaikoGradualPerformanceAttributes`],
|
||||
/// [`CatchGradualPerformanceAttributes`], or
|
||||
/// [`ManiaGradualPerformanceAttributes`].
|
||||
///
|
||||
/// If you only want to calculate difficulty attributes use
|
||||
/// [`GradualDifficultyAttributes`](crate::GradualDifficultyAttributes) instead.
|
||||
@@ -270,14 +270,14 @@ impl From<ScoreState> for ManiaScoreState {
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
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.
|
||||
Osu(OsuGradualPerformanceAttributes<'map>),
|
||||
/// Gradual osu!taiko performance attributes.
|
||||
Taiko(TaikoGradualPerformanceAttributes<'map>),
|
||||
/// Gradual osu!catch performance attributes.
|
||||
Catch(CatchGradualPerformanceAttributes<'map>),
|
||||
/// Gradual osu!mania performance attributes.
|
||||
Mania(ManiaGradualPerformanceAttributes<'map>),
|
||||
}
|
||||
|
||||
impl<'map> GradualPerformanceAttributes<'map> {
|
||||
@@ -309,18 +309,18 @@ impl<'map> GradualPerformanceAttributes<'map> {
|
||||
n: usize,
|
||||
) -> Option<PerformanceAttributes> {
|
||||
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
|
||||
.process_next_n_objects(state.into(), n)
|
||||
.map(PerformanceAttributes::Osu),
|
||||
GradualPerformanceAttributes::Taiko(t) => t
|
||||
.process_next_n_objects(state.into(), n)
|
||||
.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<'_> {
|
||||
match self.mode {
|
||||
GameMode::Osu => AnyStars::Osu(OsuStars::new(self)),
|
||||
GameMode::Mania => AnyStars::Mania(ManiaStars::new(self)),
|
||||
GameMode::Taiko => AnyStars::Taiko(TaikoStars::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 {
|
||||
match self.mode {
|
||||
GameMode::Osu => PerformanceAttributes::Osu(OsuPP::new(self).mods(mods).calculate()),
|
||||
GameMode::Mania => {
|
||||
PerformanceAttributes::Mania(ManiaPP::new(self).mods(mods).calculate())
|
||||
}
|
||||
GameMode::Taiko => {
|
||||
PerformanceAttributes::Taiko(TaikoPP::new(self).mods(mods).calculate())
|
||||
}
|
||||
GameMode::Catch => {
|
||||
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 {
|
||||
match self.mode {
|
||||
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::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.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Strains {
|
||||
/// osu!catch strain values.
|
||||
Catch(catch::CatchStrains),
|
||||
/// osu!mania strain values.
|
||||
Mania(mania::ManiaStrains),
|
||||
/// osu!standard strain values.
|
||||
Osu(osu::OsuStrains),
|
||||
/// osu!taiko strain values.
|
||||
Taiko(taiko::TaikoStrains),
|
||||
/// osu!catch strain values.
|
||||
Catch(catch::CatchStrains),
|
||||
/// osu!mania strain values.
|
||||
Mania(mania::ManiaStrains),
|
||||
}
|
||||
|
||||
impl Strains {
|
||||
@@ -323,10 +323,10 @@ impl Strains {
|
||||
#[inline]
|
||||
pub fn section_len(&self) -> f64 {
|
||||
match self {
|
||||
Strains::Catch(strains) => strains.section_len,
|
||||
Strains::Mania(strains) => strains.section_len,
|
||||
Strains::Osu(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)]
|
||||
pub fn len(&self) -> usize {
|
||||
match self {
|
||||
Strains::Catch(strains) => strains.len(),
|
||||
Strains::Mania(strains) => strains.len(),
|
||||
Strains::Osu(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.
|
||||
#[derive(Clone, Debug)]
|
||||
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(osu::OsuDifficultyAttributes),
|
||||
/// osu!taiko difficulty calculation result.
|
||||
Taiko(taiko::TaikoDifficultyAttributes),
|
||||
/// osu!catch difficulty calculation result.
|
||||
Catch(catch::CatchDifficultyAttributes),
|
||||
/// osu!mania difficulty calculation result.
|
||||
Mania(mania::ManiaDifficultyAttributes),
|
||||
}
|
||||
|
||||
impl DifficultyAttributes {
|
||||
@@ -361,10 +361,10 @@ impl DifficultyAttributes {
|
||||
#[inline]
|
||||
pub fn stars(&self) -> f64 {
|
||||
match self {
|
||||
Self::Catch(attrs) => attrs.stars,
|
||||
Self::Mania(attrs) => attrs.stars,
|
||||
Self::Osu(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]
|
||||
pub fn max_combo(&self) -> usize {
|
||||
match self {
|
||||
Self::Catch(attrs) => attrs.max_combo(),
|
||||
Self::Mania(attrs) => attrs.max_combo,
|
||||
Self::Osu(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 {
|
||||
#[inline]
|
||||
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.
|
||||
#[derive(Clone, Debug)]
|
||||
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(osu::OsuPerformanceAttributes),
|
||||
/// osu!taiko performance calculation result.
|
||||
Taiko(taiko::TaikoPerformanceAttributes),
|
||||
/// osu!catch performance calculation result.
|
||||
Catch(catch::CatchPerformanceAttributes),
|
||||
/// osu!mania performance calculation result.
|
||||
Mania(mania::ManiaPerformanceAttributes),
|
||||
}
|
||||
|
||||
impl PerformanceAttributes {
|
||||
@@ -426,10 +426,10 @@ impl PerformanceAttributes {
|
||||
#[inline]
|
||||
pub fn pp(&self) -> f64 {
|
||||
match self {
|
||||
Self::Catch(attrs) => attrs.pp,
|
||||
Self::Mania(attrs) => attrs.pp,
|
||||
Self::Osu(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]
|
||||
pub fn stars(&self) -> f64 {
|
||||
match self {
|
||||
Self::Catch(attrs) => attrs.stars(),
|
||||
Self::Mania(attrs) => attrs.stars(),
|
||||
Self::Osu(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]
|
||||
pub fn difficulty_attributes(&self) -> DifficultyAttributes {
|
||||
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::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.
|
||||
pub fn max_combo(&self) -> usize {
|
||||
match self {
|
||||
Self::Catch(attrs) => attrs.difficulty.max_combo(),
|
||||
Self::Mania(attrs) => attrs.difficulty.max_combo,
|
||||
Self::Osu(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]
|
||||
fn from(attributes: PerformanceAttributes) -> Self {
|
||||
match attributes {
|
||||
PerformanceAttributes::Catch(attrs) => Self::Catch(attrs.difficulty),
|
||||
PerformanceAttributes::Mania(attrs) => Self::Mania(attrs.difficulty),
|
||||
PerformanceAttributes::Osu(attrs) => Self::Osu(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 {
|
||||
#[inline]
|
||||
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"))]
|
||||
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)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum AnyPP<'map> {
|
||||
/// osu!catch performance calculator
|
||||
Catch(CatchPP<'map>),
|
||||
/// osu!mania performance calculator
|
||||
Mania(ManiaPP<'map>),
|
||||
/// osu!standard performance calculator
|
||||
Osu(OsuPP<'map>),
|
||||
/// osu!taiko performance calculator
|
||||
Taiko(TaikoPP<'map>),
|
||||
/// osu!catch performance calculator
|
||||
Catch(CatchPP<'map>),
|
||||
/// osu!mania performance calculator
|
||||
Mania(ManiaPP<'map>),
|
||||
}
|
||||
|
||||
impl<'map> AnyPP<'map> {
|
||||
@@ -53,10 +53,10 @@ impl<'map> AnyPP<'map> {
|
||||
#[inline]
|
||||
pub fn new(map: &'map Beatmap) -> Self {
|
||||
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::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]
|
||||
pub fn calculate(self) -> PerformanceAttributes {
|
||||
match self {
|
||||
Self::Catch(f) => PerformanceAttributes::Catch(f.calculate()),
|
||||
Self::Mania(m) => PerformanceAttributes::Mania(m.calculate()),
|
||||
Self::Osu(o) => PerformanceAttributes::Osu(o.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]
|
||||
pub fn attributes(self, attributes: impl AttributeProvider) -> 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::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]
|
||||
pub fn mods(self, mods: u32) -> 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::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]
|
||||
pub fn passed_objects(self, passed_objects: usize) -> 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::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]
|
||||
pub fn clock_rate(self, clock_rate: f64) -> 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::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]
|
||||
pub fn state(self, state: ScoreState) -> 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::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]
|
||||
pub fn accuracy(self, acc: f64) -> 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::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]
|
||||
pub fn n_misses(self, n_misses: usize) -> 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::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]
|
||||
pub fn combo(self, combo: usize) -> Self {
|
||||
match self {
|
||||
Self::Catch(f) => Self::Catch(f.combo(combo)),
|
||||
Self::Mania(_) => self,
|
||||
Self::Osu(o) => Self::Osu(o.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]
|
||||
pub fn n300(self, n300: usize) -> 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::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]
|
||||
pub fn n100(self, n100: usize) -> 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::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]
|
||||
pub fn n50(self, n50: usize) -> 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::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]
|
||||
pub fn n_katu(self, n_katu: usize) -> 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::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]
|
||||
pub fn n_geki(self, n_geki: usize) -> Self {
|
||||
match self {
|
||||
Self::Mania(m) => Self::Mania(m.n320(n_geki)),
|
||||
Self::Osu(_) => self,
|
||||
Self::Taiko(_) => self,
|
||||
Self::Catch(_) => self,
|
||||
Self::Mania(m) => Self::Mania(m.n320(n_geki)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,10 +284,10 @@ impl AttributeProvider for PerformanceAttributes {
|
||||
#[inline]
|
||||
fn attributes(self) -> DifficultyAttributes {
|
||||
match self {
|
||||
Self::Catch(attrs) => DifficultyAttributes::Catch(attrs.difficulty),
|
||||
Self::Mania(attrs) => DifficultyAttributes::Mania(attrs.difficulty),
|
||||
Self::Osu(attrs) => DifficultyAttributes::Osu(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)]
|
||||
pub enum AnyStars<'map> {
|
||||
/// osu!catch difficulty calculator
|
||||
Catch(CatchStars<'map>),
|
||||
/// osu!mania difficulty calculator
|
||||
Mania(ManiaStars<'map>),
|
||||
/// osu!standard difficulty calculator
|
||||
Osu(OsuStars<'map>),
|
||||
/// osu!taiko difficulty calculator
|
||||
Taiko(TaikoStars<'map>),
|
||||
/// osu!catch difficulty calculator
|
||||
Catch(CatchStars<'map>),
|
||||
/// osu!mania difficulty calculator
|
||||
Mania(ManiaStars<'map>),
|
||||
}
|
||||
|
||||
impl<'map> AnyStars<'map> {
|
||||
@@ -37,10 +37,10 @@ impl<'map> AnyStars<'map> {
|
||||
#[inline]
|
||||
pub fn new(map: &'map Beatmap) -> Self {
|
||||
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::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]
|
||||
pub fn mods(self, mods: u32) -> 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::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]
|
||||
pub fn passed_objects(self, passed_objects: usize) -> 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::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]
|
||||
pub fn clock_rate(self, clock_rate: f64) -> 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::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]
|
||||
pub fn calculate(self) -> DifficultyAttributes {
|
||||
match self {
|
||||
Self::Catch(f) => DifficultyAttributes::Catch(f.calculate()),
|
||||
Self::Mania(m) => DifficultyAttributes::Mania(m.calculate()),
|
||||
Self::Osu(o) => DifficultyAttributes::Osu(o.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]
|
||||
pub fn strains(self) -> Strains {
|
||||
match self {
|
||||
Self::Catch(f) => Strains::Catch(f.strains()),
|
||||
Self::Mania(m) => Strains::Mania(m.strains()),
|
||||
Self::Osu(o) => Strains::Osu(o.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