11
// Copyright (c) ppy Pty Ltd <[email protected] >. Licensed under the MIT Licence. 22// See the LICENCE file in the repository root for full licence text.
33
4- using System . Linq ;
4+ using System ;
5+ using osu . Game . Beatmaps ;
56using osu . Game . Rulesets . Scoring ;
67
78namespace osu . Game . Rulesets . Mania . Scoring
89{
910 public class ManiaHitWindows : HitWindows
1011 {
12+ private static readonly DifficultyRange perfect_window_range = new DifficultyRange ( 22.4D , 19.4D , 13.9D ) ;
13+ private static readonly DifficultyRange great_window_range = new DifficultyRange ( 64 , 49 , 34 ) ;
14+ private static readonly DifficultyRange good_window_range = new DifficultyRange ( 97 , 82 , 67 ) ;
15+ private static readonly DifficultyRange ok_window_range = new DifficultyRange ( 127 , 112 , 97 ) ;
16+ private static readonly DifficultyRange meh_window_range = new DifficultyRange ( 151 , 136 , 121 ) ;
17+ private static readonly DifficultyRange miss_window_range = new DifficultyRange ( 188 , 173 , 158 ) ;
18+
1119 private readonly double multiplier ;
1220
21+ private double perfect ;
22+ private double great ;
23+ private double good ;
24+ private double ok ;
25+ private double meh ;
26+ private double miss ;
27+
1328 public ManiaHitWindows ( )
1429 : this ( 1 )
1530 {
@@ -36,11 +51,41 @@ public override bool IsHitResultAllowed(HitResult result)
3651 return false ;
3752 }
3853
39- protected override DifficultyRange [ ] GetRanges ( ) => base . GetRanges ( ) . Select ( r =>
40- new DifficultyRange (
41- r . Result ,
42- r . Min * multiplier ,
43- r . Average * multiplier ,
44- r . Max * multiplier ) ) . ToArray ( ) ;
54+ public override void SetDifficulty ( double difficulty )
55+ {
56+ perfect = IBeatmapDifficultyInfo . DifficultyRange ( difficulty , perfect_window_range ) * multiplier ;
57+ great = IBeatmapDifficultyInfo . DifficultyRange ( difficulty , great_window_range ) * multiplier ;
58+ good = IBeatmapDifficultyInfo . DifficultyRange ( difficulty , good_window_range ) * multiplier ;
59+ ok = IBeatmapDifficultyInfo . DifficultyRange ( difficulty , ok_window_range ) * multiplier ;
60+ meh = IBeatmapDifficultyInfo . DifficultyRange ( difficulty , meh_window_range ) * multiplier ;
61+ miss = IBeatmapDifficultyInfo . DifficultyRange ( difficulty , miss_window_range ) * multiplier ;
62+ }
63+
64+ public override double WindowFor ( HitResult result )
65+ {
66+ switch ( result )
67+ {
68+ case HitResult . Perfect :
69+ return perfect ;
70+
71+ case HitResult . Great :
72+ return great ;
73+
74+ case HitResult . Good :
75+ return good ;
76+
77+ case HitResult . Ok :
78+ return ok ;
79+
80+ case HitResult . Meh :
81+ return meh ;
82+
83+ case HitResult . Miss :
84+ return miss ;
85+
86+ default :
87+ throw new ArgumentOutOfRangeException ( nameof ( result ) , result , null ) ;
88+ }
89+ }
4590 }
4691}
0 commit comments