Skip to content

Commit

Permalink
feat!: distinguish stable|lazer|lazer+classic
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxOhn committed Nov 14, 2024
1 parent 93f3756 commit 30054fe
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 171 deletions.
1 change: 1 addition & 0 deletions proptest-regressions/osu/performance/mod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ cc 2cba8a76243aac7233e9207a3162aaa1f08f933c0cb3a2ac79580ece3a7329fc # shrinks to
cc e93787ad8a849ec6d05750c8d09494b8f5a9fa785f843d9a8e2db986c0b32645 # shrinks to acc = 0.0, n300 = None, n100 = None, n50 = None, n_misses = Some(602), best_case = false
cc a53cb48861126aa63be54606f9a770db5eae95242c9a9d75cf1fd101cfb21729 # shrinks to lazer = true, acc = 0.5679586776392227, n_slider_ticks = None, n_slider_ends = None, n300 = None, n100 = None, n50 = Some(0), n_misses = None, best_case = false
cc cacb94cb2a61cf05e7083e332b378290a6267a499bf30821228bc0ae4dfe46f6 # shrinks to lazer = true, acc = 0.5270982297689498, n_slider_ticks = None, n_slider_ends = None, n300 = Some(70), n100 = None, n50 = None, n_misses = None, best_case = false
cc 5679a686382f641f1fa3407a6e19e1caa0adff27e42c397778a2d178361719a3 # shrinks to lazer = true, classic = false, acc = 0.4911232243285752, large_tick_hits = None, slider_end_hits = Some(0), n300 = None, n100 = None, n50 = None, n_misses = None, best_case = false
16 changes: 13 additions & 3 deletions src/any/performance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,19 @@ impl<'map> Performance<'map> {
}
}

/// Specify the amount of hit slider ticks.
/// Specify the amount of "large tick" hits.
///
/// Only relevant for osu!standard.
pub fn n_slider_ticks(self, n_slider_ticks: u32) -> Self {
///
/// The meaning depends on the kind of score:
/// - if set on osu!stable, this value is irrelevant and can be `0`
/// - if set on osu!lazer *without* `CL`, this value is the amount of hit
/// slider ticks and repeats
/// - if set on osu!lazer *with* `CL`, this value is the amount of hit
/// slider heads, ticks, and repeats
pub fn large_tick_hits(self, large_tick_hits: u32) -> Self {
if let Self::Osu(osu) = self {
Self::Osu(osu.n_slider_ticks(n_slider_ticks))
Self::Osu(osu.large_tick_hits(large_tick_hits))
} else {
self
}
Expand All @@ -330,6 +337,9 @@ impl<'map> Performance<'map> {
/// Specify the amount of hit slider ends.
///
/// Only relevant for osu!standard.
///
/// osu! calls this value "slider tail hits" without the classic
/// mod and "small tick hits" with the classic mod.
pub fn n_slider_ends(self, n_slider_ends: u32) -> Self {
if let Self::Osu(osu) = self {
Self::Osu(osu.n_slider_ends(n_slider_ends))
Expand Down
23 changes: 14 additions & 9 deletions src/any/score_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ pub struct ScoreState {
///
/// Irrelevant for osu!mania.
pub max_combo: u32,
/// Amount of successfully hit slider ticks and repeats.
/// "Large tick" hits for osu!standard.
///
/// Only relevant for osu!standard in lazer.
pub slider_tick_hits: u32,
/// The meaning depends on the kind of score:
/// - if set on osu!stable, this field is irrelevant and can be `0`
/// - if set on osu!lazer *without* `CL`, this field is the amount of hit
/// slider ticks and repeats
/// - if set on osu!lazer *with* `CL`, this field is the amount of hit
/// slider heads, ticks, and repeats
pub osu_large_tick_hits: u32,
/// Amount of successfully hit slider ends.
///
/// Only relevant for osu!standard in lazer.
Expand All @@ -43,7 +48,7 @@ impl ScoreState {
pub const fn new() -> Self {
Self {
max_combo: 0,
slider_tick_hits: 0,
osu_large_tick_hits: 0,
slider_end_hits: 0,
n_geki: 0,
n_katu: 0,
Expand Down Expand Up @@ -76,7 +81,7 @@ impl From<ScoreState> for OsuScoreState {
fn from(state: ScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: state.slider_tick_hits,
large_tick_hits: state.osu_large_tick_hits,
slider_end_hits: state.slider_end_hits,
n300: state.n300,
n100: state.n100,
Expand Down Expand Up @@ -127,7 +132,7 @@ impl From<OsuScoreState> for ScoreState {
fn from(state: OsuScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: state.slider_tick_hits,
osu_large_tick_hits: state.large_tick_hits,
slider_end_hits: state.slider_end_hits,
n_geki: 0,
n_katu: 0,
Expand All @@ -143,7 +148,7 @@ impl From<TaikoScoreState> for ScoreState {
fn from(state: TaikoScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: 0,
osu_large_tick_hits: 0,
slider_end_hits: 0,
n_geki: 0,
n_katu: 0,
Expand All @@ -159,7 +164,7 @@ impl From<CatchScoreState> for ScoreState {
fn from(state: CatchScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: 0,
osu_large_tick_hits: 0,
slider_end_hits: 0,
n_geki: 0,
n_katu: state.tiny_droplet_misses,
Expand All @@ -175,7 +180,7 @@ impl From<ManiaScoreState> for ScoreState {
fn from(state: ManiaScoreState) -> Self {
Self {
max_combo: 0,
slider_tick_hits: 0,
osu_large_tick_hits: 0,
slider_end_hits: 0,
n_geki: state.n320,
n_katu: state.n200,
Expand Down
2 changes: 1 addition & 1 deletion src/catch/performance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ impl<'map> TryFrom<OsuPerformance<'map>> for CatchPerformance<'map> {
difficulty,
acc,
combo,
slider_tick_hits: _,
large_tick_hits: _,
slider_end_hits: _,
n300,
n100,
Expand Down
2 changes: 1 addition & 1 deletion src/mania/performance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ impl<'map> TryFrom<OsuPerformance<'map>> for ManiaPerformance<'map> {
difficulty,
acc,
combo: _,
slider_tick_hits: _,
large_tick_hits: _,
slider_end_hits: _,
n300,
n100,
Expand Down
7 changes: 3 additions & 4 deletions src/model/mods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ impl GameMods {
GameModsInner::Lazer(ref mods) => mods
.iter()
.find_map(|m| match m {
GameMod::ClassicOsu(classic) => Some(classic),
GameMod::ClassicOsu(cl) => Some(cl.no_slider_head_accuracy.unwrap_or(true)),
_ => None,
})
.map_or(!lazer, |classic| {
classic.no_slider_head_accuracy.unwrap_or(true)
}),
.unwrap_or(!lazer),
GameModsInner::Intermode(ref mods) => {
mods.contains(GameModIntermode::Classic) || !lazer
}
Expand Down Expand Up @@ -230,6 +228,7 @@ impl_has_mod! {
fl: + Flashlight ["Flashlight"],
so: + SpunOut ["SpunOut"],
bl: - Blinds ["Blinds"],
cl: - Classic ["Classic"],
tc: - Traceable ["Traceable"],
}

Expand Down
2 changes: 1 addition & 1 deletion src/osu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub use self::{
convert::OsuBeatmap,
difficulty::gradual::OsuGradualDifficulty,
performance::{gradual::OsuGradualPerformance, OsuPerformance},
score_state::OsuScoreState,
score_state::{OsuScoreOrigin, OsuScoreState},
strains::OsuStrains,
};

Expand Down
Loading

0 comments on commit 30054fe

Please sign in to comment.