1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:47:24 +08:00

Merge pull request #9330 from smoogipoo/reduce-mania-hp-drain

Reduce mania's HP drain by 20%
This commit is contained in:
Dean Herbert 2020-06-21 19:58:15 +09:00 committed by GitHub
commit 26f049ab16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -44,6 +44,8 @@ namespace osu.Game.Rulesets.Mania
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor();
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new DrainingHealthProcessor(drainStartTime, 0.2);
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap, this);
public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new ManiaPerformanceCalculator(this, beatmap, score);

View File

@ -44,6 +44,7 @@ namespace osu.Game.Rulesets.Scoring
private double gameplayEndTime;
private readonly double drainStartTime;
private readonly double drainLenience;
private readonly List<(double time, double health)> healthIncreases = new List<(double, double)>();
private double targetMinimumHealth;
@ -55,9 +56,14 @@ namespace osu.Game.Rulesets.Scoring
/// Creates a new <see cref="DrainingHealthProcessor"/>.
/// </summary>
/// <param name="drainStartTime">The time after which draining should begin.</param>
public DrainingHealthProcessor(double drainStartTime)
/// <param name="drainLenience">A lenience to apply to the default drain rate.<br />
/// A value of 0 uses the default drain rate.<br />
/// A value of 0.5 halves the drain rate.<br />
/// A value of 1 completely removes drain.</param>
public DrainingHealthProcessor(double drainStartTime, double drainLenience = 0)
{
this.drainStartTime = drainStartTime;
this.drainLenience = drainLenience;
}
protected override void Update()
@ -96,6 +102,12 @@ namespace osu.Game.Rulesets.Scoring
targetMinimumHealth = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, min_health_target, mid_health_target, max_health_target);
// Add back a portion of the amount of HP to be drained, depending on the lenience requested.
targetMinimumHealth += drainLenience * (1 - targetMinimumHealth);
// Ensure the target HP is within an acceptable range.
targetMinimumHealth = Math.Clamp(targetMinimumHealth, 0, 1);
base.ApplyBeatmap(beatmap);
}