2018-04-13 17:19:50 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Judgements;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
|
using osu.Game.Rulesets.UI;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Scoring
|
|
|
|
|
{
|
|
|
|
|
internal class TaikoScoreProcessor : ScoreProcessor<TaikoHitObject>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The HP awarded by a <see cref="HitResult.Great"/> hit.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const double hp_hit_great = 0.03;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Taiko fails at the end of the map if the player has not half-filled their HP bar.
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected override bool DefaultFailCondition => JudgedHits == MaxHits && Health.Value <= 0.5;
|
|
|
|
|
|
2018-12-04 22:20:44 +08:00
|
|
|
|
private double hpMultiplier;
|
|
|
|
|
private double hpMissMultiplier;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
public TaikoScoreProcessor(RulesetContainer<TaikoHitObject> rulesetContainer)
|
|
|
|
|
: base(rulesetContainer)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-02 19:36:08 +08:00
|
|
|
|
protected override void ApplyBeatmap(Beatmap<TaikoHitObject> beatmap)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-08-02 19:36:08 +08:00
|
|
|
|
base.ApplyBeatmap(beatmap);
|
|
|
|
|
|
2018-12-04 22:20:44 +08:00
|
|
|
|
hpMultiplier = 0.01 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.5, 0.75, 0.98));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-12-04 22:20:44 +08:00
|
|
|
|
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 09:54:16 +08:00
|
|
|
|
protected override void ApplyResult(JudgementResult result)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-08-06 09:54:16 +08:00
|
|
|
|
base.ApplyResult(result);
|
2018-11-29 23:12:01 +08:00
|
|
|
|
|
2018-12-06 20:52:16 +08:00
|
|
|
|
double hpIncrease = result.Judgement.HealthIncreaseFor(result);
|
2018-11-29 09:56:19 +08:00
|
|
|
|
|
2018-12-06 20:52:16 +08:00
|
|
|
|
if (result.Type == HitResult.Miss)
|
|
|
|
|
hpIncrease *= hpMissMultiplier;
|
|
|
|
|
else
|
|
|
|
|
hpIncrease *= hpMultiplier;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-12-06 20:52:16 +08:00
|
|
|
|
Health.Value += hpIncrease;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Reset(bool storeResults)
|
|
|
|
|
{
|
|
|
|
|
base.Reset(storeResults);
|
|
|
|
|
|
|
|
|
|
Health.Value = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|