mirror of
https://github.com/ppy/osu
synced 2025-02-23 22:27:13 +00:00
Implement break/gameplay start times
This commit is contained in:
parent
b348abcd07
commit
522847987b
@ -30,8 +30,6 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor();
|
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor();
|
||||||
|
|
||||||
public override HealthProcessor CreateHealthProcessor() => new CatchHealthProcessor();
|
|
||||||
|
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap, this);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap, this);
|
||||||
|
|
||||||
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new CatchBeatmapProcessor(beatmap);
|
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new CatchBeatmapProcessor(beatmap);
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
// 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 osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Scoring
|
|
||||||
{
|
|
||||||
public class CatchHealthProcessor : HealthProcessor
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor();
|
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor();
|
||||||
|
|
||||||
public override HealthProcessor CreateHealthProcessor() => new ManiaHealthProcessor();
|
|
||||||
|
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap, this);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap, this);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
// 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 osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Scoring
|
|
||||||
{
|
|
||||||
public class ManiaHealthProcessor : HealthProcessor
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
|
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
|
||||||
|
|
||||||
public override HealthProcessor CreateHealthProcessor() => new OsuHealthProcessor();
|
|
||||||
|
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap, this);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap, this);
|
||||||
|
|
||||||
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new OsuBeatmapProcessor(beatmap);
|
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new OsuBeatmapProcessor(beatmap);
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
// 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 osu.Game.Rulesets.Judgements;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Scoring
|
|
||||||
{
|
|
||||||
public class OsuHealthProcessor : HealthProcessor
|
|
||||||
{
|
|
||||||
protected override JudgementResult CreateResult(HitObject hitObject, Judgement judgement) => new OsuJudgementResult(hitObject, judgement);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
// 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 osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Scoring
|
|
||||||
{
|
|
||||||
public class TaikoHealthProcessor : HealthProcessor
|
|
||||||
{
|
|
||||||
/// <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;
|
|
||||||
|
|
||||||
protected override void Reset(bool storeResults)
|
|
||||||
{
|
|
||||||
base.Reset(storeResults);
|
|
||||||
|
|
||||||
Health.Value = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -30,8 +30,6 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor();
|
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor();
|
||||||
|
|
||||||
public override HealthProcessor CreateHealthProcessor() => new TaikoHealthProcessor();
|
|
||||||
|
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap, this);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap, this);
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Rulesets
|
|||||||
/// Creates a <see cref="HealthProcessor"/> for this <see cref="Ruleset"/>.
|
/// Creates a <see cref="HealthProcessor"/> for this <see cref="Ruleset"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The health processor.</returns>
|
/// <returns>The health processor.</returns>
|
||||||
public virtual HealthProcessor CreateHealthProcessor() => new HealthProcessor();
|
public virtual HealthProcessor CreateHealthProcessor(double gameplayStartTime) => new HealthProcessor(gameplayStartTime);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="IBeatmapConverter"/> to convert a <see cref="IBeatmap"/> to one that is applicable for this <see cref="Ruleset"/>.
|
/// Creates a <see cref="IBeatmapConverter"/> to convert a <see cref="IBeatmap"/> to one that is applicable for this <see cref="Ruleset"/>.
|
||||||
|
@ -39,14 +39,25 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
|
||||||
|
private readonly double gameplayStartTime;
|
||||||
|
|
||||||
|
private IBeatmap beatmap;
|
||||||
|
|
||||||
private List<(double time, double health)> healthIncreases;
|
private List<(double time, double health)> healthIncreases;
|
||||||
private double targetMinimumHealth;
|
private double targetMinimumHealth;
|
||||||
private double drainRate = 1;
|
private double drainRate = 1;
|
||||||
|
|
||||||
|
public HealthProcessor(double gameplayStartTime)
|
||||||
|
{
|
||||||
|
this.gameplayStartTime = gameplayStartTime;
|
||||||
|
}
|
||||||
|
|
||||||
public override void ApplyBeatmap(IBeatmap beatmap)
|
public override void ApplyBeatmap(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
|
||||||
healthIncreases = new List<(double time, double health)>();
|
healthIncreases = new List<(double time, double health)>();
|
||||||
targetMinimumHealth = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.95, 0.85, 0.65);
|
targetMinimumHealth = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.95, 0.6, 0.2);
|
||||||
|
|
||||||
base.ApplyBeatmap(beatmap);
|
base.ApplyBeatmap(beatmap);
|
||||||
|
|
||||||
@ -108,11 +119,24 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
{
|
{
|
||||||
double currentHealth = 1;
|
double currentHealth = 1;
|
||||||
double lowestHealth = 1;
|
double lowestHealth = 1;
|
||||||
|
int currentBreak = -1;
|
||||||
|
|
||||||
for (int i = 0; i < healthIncreases.Count; i++)
|
for (int i = 0; i < healthIncreases.Count; i++)
|
||||||
{
|
{
|
||||||
var lastTime = i > 0 ? healthIncreases[i - 1].time : 0;
|
double currentTime = healthIncreases[i].time;
|
||||||
|
double lastTime = i > 0 ? healthIncreases[i - 1].time : gameplayStartTime;
|
||||||
|
|
||||||
|
// Subtract any break time from the duration since the last object
|
||||||
|
if (beatmap.Breaks.Count > 0)
|
||||||
|
{
|
||||||
|
while (currentBreak + 1 < beatmap.Breaks.Count && beatmap.Breaks[currentBreak + 1].EndTime < currentTime)
|
||||||
|
currentBreak++;
|
||||||
|
|
||||||
|
if (currentBreak >= 0)
|
||||||
|
lastTime = Math.Max(lastTime, beatmap.Breaks[currentBreak].EndTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply health adjustments
|
||||||
currentHealth -= (healthIncreases[i].time - lastTime) * drainRate;
|
currentHealth -= (healthIncreases[i].time - lastTime) * drainRate;
|
||||||
lowestHealth = Math.Min(lowestHealth, currentHealth);
|
lowestHealth = Math.Min(lowestHealth, currentHealth);
|
||||||
currentHealth = Math.Min(1, currentHealth + healthIncreases[i].health);
|
currentHealth = Math.Min(1, currentHealth + healthIncreases[i].health);
|
||||||
|
@ -135,7 +135,7 @@ namespace osu.Game.Screens.Play
|
|||||||
ScoreProcessor.ApplyBeatmap(playableBeatmap);
|
ScoreProcessor.ApplyBeatmap(playableBeatmap);
|
||||||
ScoreProcessor.Mods.BindTo(Mods);
|
ScoreProcessor.Mods.BindTo(Mods);
|
||||||
|
|
||||||
HealthProcessor = ruleset.CreateHealthProcessor();
|
HealthProcessor = ruleset.CreateHealthProcessor(DrawableRuleset.GameplayStartTime);
|
||||||
HealthProcessor.ApplyBeatmap(playableBeatmap);
|
HealthProcessor.ApplyBeatmap(playableBeatmap);
|
||||||
|
|
||||||
if (!ScoreProcessor.Mode.Disabled)
|
if (!ScoreProcessor.Mode.Disabled)
|
||||||
|
Loading…
Reference in New Issue
Block a user