// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.Scoring { internal class ManiaScoreProcessor : ScoreProcessor { /// /// The hit HP multiplier at OD = 0. /// private const double hp_multiplier_min = 0.75; /// /// The hit HP multiplier at OD = 0. /// private const double hp_multiplier_mid = 0.85; /// /// The hit HP multiplier at OD = 0. /// private const double hp_multiplier_max = 1; /// /// The default BAD hit HP increase. /// private const double hp_increase_bad = 0.005; /// /// The default OK hit HP increase. /// private const double hp_increase_ok = 0.010; /// /// The default GOOD hit HP increase. /// private const double hp_increase_good = 0.035; /// /// The default tick hit HP increase. /// private const double hp_increase_tick = 0.040; /// /// The default GREAT hit HP increase. /// private const double hp_increase_great = 0.055; /// /// The default PERFECT hit HP increase. /// private const double hp_increase_perfect = 0.065; /// /// The MISS HP multiplier at OD = 0. /// private const double hp_multiplier_miss_min = 0.5; /// /// The MISS HP multiplier at OD = 5. /// private const double hp_multiplier_miss_mid = 0.75; /// /// The MISS HP multiplier at OD = 10. /// private const double hp_multiplier_miss_max = 1; /// /// The default MISS HP increase. /// private const double hp_increase_miss = -0.125; /// /// The MISS HP multiplier. This is multiplied to the miss hp increase. /// private double hpMissMultiplier = 1; /// /// The HIT HP multiplier. This is multiplied to hit hp increases. /// private double hpMultiplier = 1; public ManiaScoreProcessor() { } public ManiaScoreProcessor(DrawableRuleset rrawableRuleset) : base(rrawableRuleset) { } protected override void ApplyBeatmap(Beatmap beatmap) { base.ApplyBeatmap(beatmap); BeatmapDifficulty difficulty = beatmap.BeatmapInfo.BaseDifficulty; hpMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_min, hp_multiplier_mid, hp_multiplier_max); hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max); } protected override void SimulateAutoplay(Beatmap beatmap) { while (true) { base.SimulateAutoplay(beatmap); if (!HasFailed) break; hpMultiplier *= 1.01; hpMissMultiplier *= 0.98; Reset(false); } } protected override void ApplyResult(JudgementResult result) { base.ApplyResult(result); bool isTick = result.Judgement is HoldNoteTickJudgement; if (isTick) { if (result.IsHit) Health.Value += hpMultiplier * hp_increase_tick; } else { switch (result.Type) { case HitResult.Miss: Health.Value += hpMissMultiplier * hp_increase_miss; break; case HitResult.Meh: Health.Value += hpMultiplier * hp_increase_bad; break; case HitResult.Ok: Health.Value += hpMultiplier * hp_increase_ok; break; case HitResult.Good: Health.Value += hpMultiplier * hp_increase_good; break; case HitResult.Great: Health.Value += hpMultiplier * hp_increase_great; break; case HitResult.Perfect: Health.Value += hpMultiplier * hp_increase_perfect; break; } } } public override HitWindows CreateHitWindows() => new ManiaHitWindows(); } }