1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 06:37:43 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Scoring/CatchHealthProcessor.cs
Bartłomiej Dach 2c0a5b7ef5
Fix missing tiny droplet not triggering fail with perfect on
Stable does this:

    46cd3a10af/osu!/GameplayElements/HitObjectManagerFruits.cs#L98-L102

I'd rather not say what I think about it doing that, since it's likely
to be unpublishable, but to approximate that, just make it so that
only the "default fail condition" is beholden to the weird ebbs
and flows of what the ruleset wants. This appears to fix the problem
case and I'm hoping it doesn't break something else but I'm like 50/50
on it happening anyway at this point. Just gotta add tests add nauseam.
2024-02-14 14:21:48 +01:00

72 lines
2.6 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Scoring
{
public partial class CatchHealthProcessor : LegacyDrainingHealthProcessor
{
public CatchHealthProcessor(double drainStartTime)
: base(drainStartTime)
{
}
protected override IEnumerable<HitObject> EnumerateTopLevelHitObjects() => EnumerateHitObjects(Beatmap).Where(h => h is Fruit || h is Droplet || h is Banana);
protected override IEnumerable<HitObject> EnumerateNestedHitObjects(HitObject hitObject) => Enumerable.Empty<HitObject>();
protected override bool CheckDefaultFailCondition(JudgementResult result)
{
// matches stable.
// see: https://github.com/peppy/osu-stable-reference/blob/46cd3a10af7cc6cc96f4eba92ef1812dc8c3a27e/osu!/GameModes/Play/Rulesets/Ruleset.cs#L967
// the above early-return skips the failure check at the end of the same method:
// https://github.com/peppy/osu-stable-reference/blob/46cd3a10af7cc6cc96f4eba92ef1812dc8c3a27e/osu!/GameModes/Play/Rulesets/Ruleset.cs#L1232
// making it impossible to fail on a tiny droplet regardless of result.
if (result.Type == HitResult.SmallTickMiss)
return false;
return base.CheckDefaultFailCondition(result);
}
protected override double GetHealthIncreaseFor(HitObject hitObject, HitResult result)
{
double increase = 0;
switch (result)
{
case HitResult.SmallTickMiss:
return 0;
case HitResult.LargeTickMiss:
case HitResult.Miss:
return IBeatmapDifficultyInfo.DifficultyRange(Beatmap.Difficulty.DrainRate, -0.03, -0.125, -0.2);
case HitResult.SmallTickHit:
increase = 0.0015;
break;
case HitResult.LargeTickHit:
increase = 0.015;
break;
case HitResult.Great:
increase = 0.03;
break;
case HitResult.LargeBonus:
increase = 0.0025;
break;
}
return HpMultiplierNormal * increase;
}
}
}