Skip to content

Commit

Permalink
feat!: adjust osu!standard hitresult generation
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxOhn committed Oct 13, 2024
1 parent f646cba commit f72ff79
Show file tree
Hide file tree
Showing 11 changed files with 297 additions and 32 deletions.
2 changes: 2 additions & 0 deletions proptest-regressions/osu/performance/mod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ cc e5a861f6c665dd09e46423e71d7596edf98897d4130d3144aa6f5be580f31a8b # shrinks to
cc 2cd5c105bcca0b4255afccc15bee3894b06bd20ac3f5c5d3b785f7e0ef99df46 # shrinks to acc = 0.0, combo = None, n300 = Some(0), n100 = None, n50 = Some(479), n_misses = Some(123), best_case = false
cc 2cba8a76243aac7233e9207a3162aaa1f08f933c0cb3a2ac79580ece3a7329fc # shrinks to acc = 0.0, n300 = Some(0), n100 = Some(0), n50 = Some(0), n_misses = None, best_case = false
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
20 changes: 20 additions & 0 deletions src/any/score_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ pub struct ScoreState {
///
/// Irrelevant for osu!mania.
pub max_combo: u32,
/// Amount of successfully hit slider ticks and repeats.
///
/// Only relevant for osu!standard in lazer.
pub slider_tick_hits: u32,
/// Amount of successfully hit slider ends.
///
/// Only relevant for osu!standard in lazer.
pub slider_end_hits: u32,
/// Amount of current gekis (n320 for osu!mania).
pub n_geki: u32,
/// Amount of current katus (tiny droplet misses for osu!catch / n200 for
Expand All @@ -35,6 +43,8 @@ impl ScoreState {
pub const fn new() -> Self {
Self {
max_combo: 0,
slider_tick_hits: 0,
slider_end_hits: 0,
n_geki: 0,
n_katu: 0,
n300: 0,
Expand Down Expand Up @@ -66,6 +76,8 @@ impl From<ScoreState> for OsuScoreState {
fn from(state: ScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: state.slider_tick_hits,
slider_end_hits: state.slider_end_hits,
n300: state.n300,
n100: state.n100,
n50: state.n50,
Expand Down Expand Up @@ -115,6 +127,8 @@ impl From<OsuScoreState> for ScoreState {
fn from(state: OsuScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: state.slider_tick_hits,
slider_end_hits: state.slider_end_hits,
n_geki: 0,
n_katu: 0,
n300: state.n300,
Expand All @@ -129,6 +143,8 @@ impl From<TaikoScoreState> for ScoreState {
fn from(state: TaikoScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: 0,
slider_end_hits: 0,
n_geki: 0,
n_katu: 0,
n300: state.n300,
Expand All @@ -143,6 +159,8 @@ impl From<CatchScoreState> for ScoreState {
fn from(state: CatchScoreState) -> Self {
Self {
max_combo: state.max_combo,
slider_tick_hits: 0,
slider_end_hits: 0,
n_geki: 0,
n_katu: state.tiny_droplet_misses,
n300: state.fruits,
Expand All @@ -157,6 +175,8 @@ impl From<ManiaScoreState> for ScoreState {
fn from(state: ManiaScoreState) -> Self {
Self {
max_combo: 0,
slider_tick_hits: 0,
slider_end_hits: 0,
n_geki: state.n320,
n_katu: state.n200,
n300: state.n300,
Expand Down
2 changes: 2 additions & 0 deletions src/catch/performance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ impl<'map> TryFrom<OsuPerformance<'map>> for CatchPerformance<'map> {
difficulty,
acc,
combo,
slider_tick_hits: _,
slider_end_hits: _,
n300,
n100,
n50,
Expand Down
2 changes: 2 additions & 0 deletions src/mania/performance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,8 @@ impl<'map> TryFrom<OsuPerformance<'map>> for ManiaPerformance<'map> {
difficulty,
acc,
combo: _,
slider_tick_hits: _,
slider_end_hits: _,
n300,
n100,
n50,
Expand Down
2 changes: 2 additions & 0 deletions src/osu/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub struct OsuDifficultyAttributes {
pub n_circles: u32,
/// The amount of sliders.
pub n_sliders: u32,
/// The amount of slider ticks and repeat points.
pub n_slider_ticks: u32,
/// The amount of spinners.
pub n_spinners: u32,
/// The final star rating
Expand Down
11 changes: 11 additions & 0 deletions src/osu/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ pub fn convert_objects(
OsuObjectKind::Slider(ref slider) => {
attrs.n_sliders += 1;
attrs.max_combo += slider.nested_objects.len() as u32;

attrs.n_slider_ticks += slider
.nested_objects
.iter()
.filter(|nested| {
matches!(
nested.kind,
NestedSliderObjectKind::Tick | NestedSliderObjectKind::Repeat
)
})
.count() as u32;
}
OsuObjectKind::Spinner(_) => attrs.n_spinners += 1,
}
Expand Down
Loading

0 comments on commit f72ff79

Please sign in to comment.