Make Rulesets.Mania use the new judgement result structure

This commit is contained in:
smoogipoo
2018-08-02 20:36:54 +09:00
parent 4548d2c87f
commit 807794d512
12 changed files with 39 additions and 85 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Judgements;
@ -97,31 +96,20 @@ namespace osu.Game.Rulesets.Mania.Scoring
{
}
protected override void SimulateAutoplay(Beatmap<ManiaHitObject> beatmap)
protected override void ApplyBeatmap(Beatmap<ManiaHitObject> 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<ManiaHitObject> beatmap)
{
while (true)
{
foreach (var obj in beatmap.HitObjects)
{
var holdNote = obj as HoldNote;
if (holdNote != null)
{
// Head
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
// Ticks
int tickCount = holdNote.NestedHitObjects.OfType<HoldNoteTick>().Count();
for (int i = 0; i < tickCount; i++)
AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect });
}
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
}
base.SimulateAutoplay(beatmap);
if (!HasFailed)
break;
@ -133,20 +121,20 @@ namespace osu.Game.Rulesets.Mania.Scoring
}
}
protected override void OnNewJudgement(Judgement judgement)
protected override void OnNewJudgement(JudgementResult result)
{
base.OnNewJudgement(judgement);
base.OnNewJudgement(result);
bool isTick = judgement is HoldNoteTickJudgement;
bool isTick = result.Judgement is HoldNoteTickJudgement;
if (isTick)
{
if (judgement.IsHit)
if (result.IsHit)
Health.Value += hpMultiplier * hp_increase_tick;
}
else
{
switch (judgement.Result)
switch (result.Type)
{
case HitResult.Miss:
Health.Value += hpMissMultiplier * hp_increase_miss;