mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Fix bonus requirement not considering number of normal ticks
This commit is contained in:
parent
859155dda1
commit
05c9f0f9cc
@ -43,7 +43,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
AddUntilStep("Pitch starts low", () => getSpinningSample().Frequency.Value < 0.8);
|
||||
AddUntilStep("Pitch increases", () => getSpinningSample().Frequency.Value > 0.8);
|
||||
|
||||
PausableSkinnableSound getSpinningSample() => drawableSpinner.ChildrenOfType<PausableSkinnableSound>().FirstOrDefault(s => s.Samples.Any(i => i.LookupNames.Any(l => l.Contains("spinnerspin"))));
|
||||
PausableSkinnableSound getSpinningSample() =>
|
||||
drawableSpinner.ChildrenOfType<PausableSkinnableSound>().FirstOrDefault(s => s.Samples.Any(i => i.LookupNames.Any(l => l.Contains("spinnerspin"))));
|
||||
}
|
||||
|
||||
[TestCase(false)]
|
||||
@ -64,6 +65,39 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
AddUntilStep("Short spinner implicitly completes", () => drawableSpinner.Progress == 1);
|
||||
}
|
||||
|
||||
[TestCase(0, 4, 6)]
|
||||
[TestCase(5, 7, 10)]
|
||||
[TestCase(10, 11, 8)]
|
||||
public void TestSpinnerSpinRequirements(int od, int normalTicks, int bonusTicks)
|
||||
{
|
||||
Spinner spinner = null;
|
||||
|
||||
AddStep("add spinner", () => SetContents(_ =>
|
||||
{
|
||||
spinner = new Spinner
|
||||
{
|
||||
StartTime = Time.Current,
|
||||
EndTime = Time.Current + 3000,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
}
|
||||
};
|
||||
|
||||
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { OverallDifficulty = od });
|
||||
|
||||
return drawableSpinner = new TestDrawableSpinner(spinner, true)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Depth = depthIndex++,
|
||||
Scale = new Vector2(0.75f)
|
||||
};
|
||||
}));
|
||||
|
||||
AddAssert("number of normal ticks matches", () => spinner.SpinsRequired, () => Is.EqualTo(normalTicks));
|
||||
AddAssert("number of bonus ticks matches", () => spinner.MaximumBonusSpins, () => Is.EqualTo(bonusTicks));
|
||||
}
|
||||
|
||||
private Drawable testSingle(float circleSize, bool auto = false, double length = 3000)
|
||||
{
|
||||
const double delay = 2000;
|
||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
double secondsDuration = Duration / 1000;
|
||||
|
||||
SpinsRequired = (int)(minRps * secondsDuration);
|
||||
MaximumBonusSpins = (int)(maxRps * secondsDuration) - bonus_spins_gap;
|
||||
MaximumBonusSpins = Math.Max(0, (int)(maxRps * secondsDuration) - SpinsRequired - bonus_spins_gap);
|
||||
}
|
||||
|
||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||
|
Loading…
Reference in New Issue
Block a user