mirror of https://github.com/ppy/osu
Fix bonus judgements being required toward HP
This commit is contained in:
parent
d8b92cc585
commit
acfb6eecc6
|
@ -157,6 +157,24 @@ public void TestHealthRemovedOnRevert()
|
|||
assertHealthNotEqualTo(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBonusObjectsExcludedFromDrain()
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
{
|
||||
BeatmapInfo = { BaseDifficulty = { DrainRate = 10 } },
|
||||
};
|
||||
|
||||
beatmap.HitObjects.Add(new JudgeableHitObject { StartTime = 0 });
|
||||
for (double time = 0; time < 5000; time += 100)
|
||||
beatmap.HitObjects.Add(new JudgeableHitObject(false) { StartTime = time });
|
||||
beatmap.HitObjects.Add(new JudgeableHitObject { StartTime = 5000 });
|
||||
|
||||
createProcessor(beatmap);
|
||||
setTime(4900); // Get close to the second combo-affecting object
|
||||
assertHealthNotEqualTo(0);
|
||||
}
|
||||
|
||||
private Beatmap createBeatmap(double startTime, double endTime, params BreakPeriod[] breaks)
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
|
@ -197,8 +215,25 @@ private void assertHealthNotEqualTo(double value)
|
|||
|
||||
private class JudgeableHitObject : HitObject
|
||||
{
|
||||
public override Judgement CreateJudgement() => new Judgement();
|
||||
private readonly bool affectsCombo;
|
||||
|
||||
public JudgeableHitObject(bool affectsCombo = true)
|
||||
{
|
||||
this.affectsCombo = affectsCombo;
|
||||
}
|
||||
|
||||
public override Judgement CreateJudgement() => new TestJudgement(affectsCombo);
|
||||
protected override HitWindows CreateHitWindows() => new HitWindows();
|
||||
|
||||
private class TestJudgement : Judgement
|
||||
{
|
||||
public override bool AffectsCombo { get; }
|
||||
|
||||
public TestJudgement(bool affectsCombo)
|
||||
{
|
||||
AffectsCombo = affectsCombo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,9 @@ public override void ApplyBeatmap(IBeatmap beatmap)
|
|||
protected override void ApplyResultInternal(JudgementResult result)
|
||||
{
|
||||
base.ApplyResultInternal(result);
|
||||
healthIncreases.Add((result.HitObject.GetEndTime() + result.TimeOffset, GetHealthIncreaseFor(result)));
|
||||
|
||||
if (!result.Judgement.IsBonus)
|
||||
healthIncreases.Add((result.HitObject.GetEndTime() + result.TimeOffset, GetHealthIncreaseFor(result)));
|
||||
}
|
||||
|
||||
protected override void Reset(bool storeResults)
|
||||
|
|
Loading…
Reference in New Issue