Skip to content

Commit 3a1bbf9

Browse files
authored
Merge pull request #33502 from smoogipoo/fix-simplified-rhythm
Fix simplified rhythm mod not working on some beatmaps
2 parents 99f57d2 + 558aacf commit 3a1bbf9

File tree

2 files changed

+95
-4
lines changed

2 files changed

+95
-4
lines changed

osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModSimplifiedRhythm.cs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,96 @@ public void TestOneEighthConversion() => CreateModTest(new ModTestData
148148
},
149149
PassCondition = () => Player.ScoreProcessor.Combo.Value == 8 && Player.ScoreProcessor.Accuracy.Value == 1
150150
});
151+
152+
/// <summary>
153+
/// Regression tests a case of 1/3rd conversion where there are exactly div-3 number of hitobjects.
154+
/// </summary>
155+
[Test]
156+
public void TestOnlyOneThirdConversion()
157+
{
158+
CreateModTest(new ModTestData
159+
{
160+
Mod = new TaikoModSimplifiedRhythm
161+
{
162+
OneThirdConversion = { Value = true },
163+
},
164+
Autoplay = false,
165+
CreateBeatmap = () => new Beatmap
166+
{
167+
HitObjects = new List<HitObject>
168+
{
169+
new Hit { StartTime = 1000, Type = HitType.Centre },
170+
new Hit { StartTime = 1333, Type = HitType.Centre }, // mod removes this
171+
new Hit { StartTime = 1666, Type = HitType.Centre }, // mod moves this to 1500
172+
new Hit { StartTime = 2000, Type = HitType.Centre },
173+
new Hit { StartTime = 2333, Type = HitType.Centre }, // mod removes this
174+
new Hit { StartTime = 2666, Type = HitType.Centre }, // mod moves this to 2500
175+
},
176+
},
177+
ReplayFrames = new List<ReplayFrame>
178+
{
179+
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
180+
new TaikoReplayFrame(1200),
181+
new TaikoReplayFrame(1500, TaikoAction.LeftCentre),
182+
new TaikoReplayFrame(1700),
183+
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
184+
new TaikoReplayFrame(2200),
185+
new TaikoReplayFrame(2500, TaikoAction.LeftCentre),
186+
new TaikoReplayFrame(2700),
187+
},
188+
PassCondition = () => Player.ScoreProcessor.Combo.Value == 4 && Player.ScoreProcessor.Accuracy.Value == 1
189+
});
190+
}
191+
192+
/// <summary>
193+
/// Regression tests a case of 1/6th conversion where there are exactly div-6 number of hitobjects.
194+
/// </summary>
195+
[Test]
196+
public void TestOnlyOneSixthConversion() => CreateModTest(new ModTestData
197+
{
198+
Mod = new TaikoModSimplifiedRhythm
199+
{
200+
OneSixthConversion = { Value = true }
201+
},
202+
Autoplay = false,
203+
CreateBeatmap = () => new Beatmap
204+
{
205+
HitObjects = new List<HitObject>
206+
{
207+
new Hit { StartTime = 1000, Type = HitType.Centre },
208+
new Hit { StartTime = 1166, Type = HitType.Centre }, // mod removes this
209+
new Hit { StartTime = 1333, Type = HitType.Centre }, // mod moves this to 1250
210+
new Hit { StartTime = 1500, Type = HitType.Centre },
211+
new Hit { StartTime = 1666, Type = HitType.Centre }, // mod removes this
212+
new Hit { StartTime = 1833, Type = HitType.Centre }, // mod moves this to 1750
213+
new Hit { StartTime = 2000, Type = HitType.Centre },
214+
new Hit { StartTime = 2166, Type = HitType.Centre }, // mod removes this
215+
new Hit { StartTime = 2333, Type = HitType.Centre }, // mod moves this to 2250
216+
new Hit { StartTime = 2500, Type = HitType.Centre },
217+
new Hit { StartTime = 2666, Type = HitType.Centre }, // mod removes this
218+
new Hit { StartTime = 2833, Type = HitType.Centre }, // mod moves this to 2750
219+
},
220+
},
221+
ReplayFrames = new List<ReplayFrame>
222+
{
223+
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
224+
new TaikoReplayFrame(1200),
225+
new TaikoReplayFrame(1250, TaikoAction.LeftCentre),
226+
new TaikoReplayFrame(1450),
227+
new TaikoReplayFrame(1500, TaikoAction.LeftCentre),
228+
new TaikoReplayFrame(1600),
229+
new TaikoReplayFrame(1750, TaikoAction.LeftCentre),
230+
new TaikoReplayFrame(1800),
231+
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
232+
new TaikoReplayFrame(2200),
233+
new TaikoReplayFrame(2250, TaikoAction.LeftCentre),
234+
new TaikoReplayFrame(2450),
235+
new TaikoReplayFrame(2500, TaikoAction.LeftCentre),
236+
new TaikoReplayFrame(2600),
237+
new TaikoReplayFrame(2750, TaikoAction.LeftCentre),
238+
new TaikoReplayFrame(2800),
239+
},
240+
PassCondition = () => Player.ScoreProcessor.Combo.Value == 8 && Player.ScoreProcessor.Accuracy.Value == 1
241+
});
151242
}
152243
}

osu.Game.Rulesets.Taiko/Mods/TaikoModSimplifiedRhythm.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void ApplyToBeatmap(IBeatmap beatmap)
3737
var taikoBeatmap = (TaikoBeatmap)beatmap;
3838
var controlPointInfo = taikoBeatmap.ControlPointInfo;
3939

40-
Hit[] hits = taikoBeatmap.HitObjects.Where(obj => obj is Hit).Cast<Hit>().ToArray();
40+
Hit[] hits = taikoBeatmap.HitObjects.OfType<Hit>().ToArray();
4141

4242
if (hits.Length == 0)
4343
return;
@@ -61,10 +61,10 @@ public void ApplyToBeatmap(IBeatmap beatmap)
6161
if (inPattern)
6262
{
6363
// pattern continues
64-
if (snapValue == baseRhythm) continue;
64+
if (snapValue == baseRhythm)
65+
continue;
6566

6667
inPattern = false;
67-
6868
processPattern(i);
6969
}
7070
else
@@ -108,7 +108,7 @@ void processPattern(int patternEndIndex)
108108
if (indexInPattern % 3 == 1)
109109
taikoBeatmap.HitObjects.Remove(hits[j]);
110110
else if (indexInPattern % 3 == 2)
111-
hits[j].StartTime = hits[j + 1].StartTime - controlPointInfo.TimingPointAt(hits[j].StartTime).BeatLength / adjustedRhythm;
111+
hits[j].StartTime = hits[j - 2].StartTime + controlPointInfo.TimingPointAt(hits[j].StartTime).BeatLength / adjustedRhythm;
112112

113113
break;
114114
}

0 commit comments

Comments
 (0)