1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 02:32:55 +08:00

remove HP density

This commit is contained in:
Dan Balasescu 2023-12-23 23:36:15 +09:00
parent 881a91ed69
commit d1000b2e6c
No known key found for this signature in database
2 changed files with 3 additions and 41 deletions

View File

@ -17,8 +17,6 @@ namespace osu.Game.Rulesets.Osu.Scoring
{ {
} }
protected override int? GetDensityGroup(HitObject hitObject) => (hitObject as IHasComboInformation)?.ComboIndex;
protected override double GetHealthIncreaseFor(JudgementResult result) protected override double GetHealthIncreaseFor(JudgementResult result)
{ {
switch (result.Type) switch (result.Type)

View File

@ -62,7 +62,6 @@ namespace osu.Game.Rulesets.Scoring
protected readonly double DrainLenience; protected readonly double DrainLenience;
private readonly List<HealthIncrease> healthIncreases = new List<HealthIncrease>(); private readonly List<HealthIncrease> healthIncreases = new List<HealthIncrease>();
private readonly Dictionary<int, double> densityMultiplierByGroup = new Dictionary<int, double>();
private double gameplayEndTime; private double gameplayEndTime;
private double targetMinimumHealth; private double targetMinimumHealth;
@ -139,29 +138,14 @@ namespace osu.Game.Rulesets.Scoring
{ {
healthIncreases.Add(new HealthIncrease( healthIncreases.Add(new HealthIncrease(
result.HitObject.GetEndTime() + result.TimeOffset, result.HitObject.GetEndTime() + result.TimeOffset,
GetHealthIncreaseFor(result), GetHealthIncreaseFor(result)));
GetDensityGroup(result.HitObject)));
} }
} }
protected override double GetHealthIncreaseFor(JudgementResult result) => base.GetHealthIncreaseFor(result) * getDensityMultiplier(GetDensityGroup(result.HitObject));
private double getDensityMultiplier(int? group)
{
if (group == null)
return 1;
return densityMultiplierByGroup.TryGetValue(group.Value, out double multiplier) ? multiplier : 1;
}
protected virtual int? GetDensityGroup(HitObject hitObject) => null;
protected override void Reset(bool storeResults) protected override void Reset(bool storeResults)
{ {
base.Reset(storeResults); base.Reset(storeResults);
densityMultiplierByGroup.Clear();
if (storeResults) if (storeResults)
DrainRate = ComputeDrainRate(); DrainRate = ComputeDrainRate();
@ -173,24 +157,6 @@ namespace osu.Game.Rulesets.Scoring
if (healthIncreases.Count <= 1) if (healthIncreases.Count <= 1)
return 0; return 0;
// Normalise the health gain during sections with higher densities.
(int group, double avgIncrease)[] avgIncreasesByGroup = healthIncreases
.Where(i => i.Group != null)
.GroupBy(i => i.Group)
.Select(g => ((int)g.Key!, g.Sum(i => i.Amount) / (g.Max(i => i.Time) - g.Min(i => i.Time) + 1)))
.ToArray();
if (avgIncreasesByGroup.Length > 1)
{
double overallAverageIncrease = avgIncreasesByGroup.Average(g => g.avgIncrease);
foreach ((int group, double avgIncrease) in avgIncreasesByGroup)
{
// Reduce the health increase for groups that return more health than average.
densityMultiplierByGroup[group] = Math.Min(1, overallAverageIncrease / avgIncrease);
}
}
int adjustment = 1; int adjustment = 1;
double result = 1; double result = 1;
@ -216,12 +182,10 @@ namespace osu.Game.Rulesets.Scoring
currentBreak++; currentBreak++;
} }
double multiplier = getDensityMultiplier(healthIncreases[i].Group);
// Apply health adjustments // Apply health adjustments
currentHealth -= (currentTime - lastTime) * result; currentHealth -= (currentTime - lastTime) * result;
lowestHealth = Math.Min(lowestHealth, currentHealth); lowestHealth = Math.Min(lowestHealth, currentHealth);
currentHealth = Math.Min(1, currentHealth + healthIncreases[i].Amount * multiplier); currentHealth = Math.Min(1, currentHealth + healthIncreases[i].Amount);
// Common scenario for when the drain rate is definitely too harsh // Common scenario for when the drain rate is definitely too harsh
if (lowestHealth < 0) if (lowestHealth < 0)
@ -240,6 +204,6 @@ namespace osu.Game.Rulesets.Scoring
return result; return result;
} }
private record struct HealthIncrease(double Time, double Amount, int? Group); private record struct HealthIncrease(double Time, double Amount);
} }
} }