1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Merge pull request #9528 from smoogipoo/fix-bonus-judgement-hp

This commit is contained in:
Dean Herbert 2020-07-12 00:55:12 +09:00 committed by GitHub
commit 213eb24831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 3 deletions

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Catch.Judgements
return 0; return 0;
case HitResult.Perfect: case HitResult.Perfect:
return 0.01; return DEFAULT_MAX_HEALTH_INCREASE * 0.75;
} }
} }

View File

@ -157,6 +157,24 @@ namespace osu.Game.Tests.Gameplay
assertHealthNotEqualTo(1); 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) private Beatmap createBeatmap(double startTime, double endTime, params BreakPeriod[] breaks)
{ {
var beatmap = new Beatmap var beatmap = new Beatmap
@ -197,8 +215,25 @@ namespace osu.Game.Tests.Gameplay
private class JudgeableHitObject : HitObject 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(); protected override HitWindows CreateHitWindows() => new HitWindows();
private class TestJudgement : Judgement
{
public override bool AffectsCombo { get; }
public TestJudgement(bool affectsCombo)
{
AffectsCombo = affectsCombo;
}
}
} }
} }
} }

View File

@ -114,7 +114,9 @@ namespace osu.Game.Rulesets.Scoring
protected override void ApplyResultInternal(JudgementResult result) protected override void ApplyResultInternal(JudgementResult result)
{ {
base.ApplyResultInternal(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) protected override void Reset(bool storeResults)