Make hp work + cleanup

This commit is contained in:
smoogipoo 2019-04-22 17:51:43 +09:00
parent 144e6012dc
commit 4edb17a88a
6 changed files with 17 additions and 61 deletions

View File

@ -26,12 +26,10 @@ namespace osu.Game.Rulesets.Catch.Scoring
hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate;
}
protected override double HpFactorFor(Judgement judgement, HitResult result)
protected override double HpFactorFor(JudgementResult result)
{
switch (result)
switch (result.Type)
{
case HitResult.Miss when judgement.IsBonus:
return 0;
case HitResult.Miss:
return hpDrainRate;
default:

View File

@ -3,7 +3,6 @@
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
@ -28,36 +27,6 @@ namespace osu.Game.Rulesets.Mania.Scoring
/// </summary>
private const double hp_multiplier_max = 1;
/// <summary>
/// The default BAD hit HP increase.
/// </summary>
private const double hp_increase_bad = 0.005;
/// <summary>
/// The default OK hit HP increase.
/// </summary>
private const double hp_increase_ok = 0.010;
/// <summary>
/// The default GOOD hit HP increase.
/// </summary>
private const double hp_increase_good = 0.035;
/// <summary>
/// The default tick hit HP increase.
/// </summary>
private const double hp_increase_tick = 0.040;
/// <summary>
/// The default GREAT hit HP increase.
/// </summary>
private const double hp_increase_great = 0.055;
/// <summary>
/// The default PERFECT hit HP increase.
/// </summary>
private const double hp_increase_perfect = 0.065;
/// <summary>
/// The MISS HP multiplier at OD = 0.
/// </summary>
@ -73,11 +42,6 @@ namespace osu.Game.Rulesets.Mania.Scoring
/// </summary>
private const double hp_multiplier_miss_max = 1;
/// <summary>
/// The default MISS HP increase.
/// </summary>
private const double hp_increase_miss = -0.125;
/// <summary>
/// The MISS HP multiplier. This is multiplied to the miss hp increase.
/// </summary>
@ -88,10 +52,6 @@ namespace osu.Game.Rulesets.Mania.Scoring
/// </summary>
private double hpMultiplier = 1;
public ManiaScoreProcessor()
{
}
public ManiaScoreProcessor(DrawableRuleset<ManiaHitObject> drawableRuleset)
: base(drawableRuleset)
{
@ -122,8 +82,8 @@ namespace osu.Game.Rulesets.Mania.Scoring
}
}
protected override double HpFactorFor(Judgement judgement, HitResult result)
=> result == HitResult.Miss ? hpMissMultiplier : hpMultiplier;
protected override double HpFactorFor(JudgementResult result)
=> result.Type == HitResult.Miss ? hpMissMultiplier : hpMultiplier;
public override HitWindows CreateHitWindows() => new ManiaHitWindows();
}

View File

@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.Osu.Scoring
comboResultCounts.Clear();
}
private const double harshness = 0.01;
protected override void ApplyResult(JudgementResult result)
{
base.ApplyResult(result);
@ -49,9 +47,9 @@ namespace osu.Game.Rulesets.Osu.Scoring
comboResultCounts[osuResult.ComboType] = comboResultCounts.GetOrDefault(osuResult.ComboType) + 1;
}
protected override double HpFactorFor(Judgement judgement, HitResult result)
protected override double HpFactorFor(JudgementResult result)
{
switch (result)
switch (result.Type)
{
case HitResult.Great:
return 10.2 - hpDrainRate;

View File

@ -46,8 +46,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120);
}
protected override double HpFactorFor(Judgement judgement, HitResult result)
=> result == HitResult.Miss ? hpMissMultiplier : hpMultiplier;
protected override double HpFactorFor(JudgementResult result)
=> result.Type == HitResult.Miss ? hpMissMultiplier : hpMultiplier;
protected override void Reset(bool storeResults)
{

View File

@ -37,6 +37,11 @@ namespace osu.Game.Rulesets.Judgements
/// </summary>
public int HighestComboAtJudgement { get; internal set; }
/// <summary>
/// The health prior to this <see cref="JudgementResult"/> occurring.
/// </summary>
public double HealthAtJudgement { get; internal set; }
/// <summary>
/// Whether a miss or hit occurred.
/// </summary>

View File

@ -206,9 +206,6 @@ namespace osu.Game.Rulesets.Scoring
private double baseScore;
private double bonusScore;
private double rollingHp;
private double rollingMaxHp;
protected ScoreProcessor()
{
}
@ -304,6 +301,7 @@ namespace osu.Game.Rulesets.Scoring
{
result.ComboAtJudgement = Combo.Value;
result.HighestComboAtJudgement = HighestCombo.Value;
result.HealthAtJudgement = Health.Value;
JudgedHits++;
@ -336,8 +334,7 @@ namespace osu.Game.Rulesets.Scoring
rollingMaxBaseScore += result.Judgement.MaxNumericResult;
}
rollingHp += HpFactorFor(result.Judgement, result.Type) * result.Judgement.HealthIncreaseFor(result);
rollingMaxHp += HpFactorFor(result.Judgement, result.Judgement.MaxResult) * result.Judgement.MaxHealthIncrease;
Health.Value += HpFactorFor(result) * result.Judgement.HealthIncreaseFor(result);
}
/// <summary>
@ -349,6 +346,7 @@ namespace osu.Game.Rulesets.Scoring
{
Combo.Value = result.ComboAtJudgement;
HighestCombo.Value = result.HighestComboAtJudgement;
Health.Value = result.HealthAtJudgement;
JudgedHits--;
@ -362,12 +360,9 @@ namespace osu.Game.Rulesets.Scoring
baseScore -= result.Judgement.NumericResultFor(result);
rollingMaxBaseScore -= result.Judgement.MaxNumericResult;
}
rollingHp -= HpFactorFor(result.Judgement, result.Type) * result.Judgement.HealthIncreaseFor(result);
rollingMaxHp -= HpFactorFor(result.Judgement, result.Judgement.MaxResult) * result.Judgement.MaxHealthIncrease;
}
protected virtual double HpFactorFor(Judgement judgement, HitResult result) => 1;
protected virtual double HpFactorFor(JudgementResult result) => 1;
private void updateScore()
{