1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Fixed being able to miss taiko objects by hitting them too early

Revamped taiko HP system
This commit is contained in:
Ivan Pavluk 2018-12-04 21:20:44 +07:00
parent fbb7dc4507
commit 7d692939fc
9 changed files with 70 additions and 63 deletions

View File

@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Taiko.Judgements
{
public override bool AffectsCombo => false;
public override bool AffectsHP => false;
protected override int NumericResultFor(HitResult result) => 0;
protected override double HealthIncreaseFor(HitResult result) => 0;
}
}

View File

@ -19,5 +19,16 @@ namespace osu.Game.Rulesets.Taiko.Judgements
return 200;
}
}
protected override double HealthIncreaseFor(HitResult result)
{
switch(result)
{
default:
return 0;
case HitResult.Great:
return 0.0000003;
}
}
}
}

View File

@ -9,12 +9,7 @@ namespace osu.Game.Rulesets.Taiko.Judgements
public class TaikoJudgement : Judgement
{
public override HitResult MaxResult => HitResult.Great;
/// <summary>
/// Whether this <see cref="TaikoJudgement"/> should affect user's hitpoints.
/// </summary>
public virtual bool AffectsHP => true;
/// <summary>
/// Computes the numeric result value for the combo portion of the score.
/// </summary>
@ -32,5 +27,32 @@ namespace osu.Game.Rulesets.Taiko.Judgements
return 300;
}
}
/// <summary>
/// Retrieves the numeric health increase of a <see cref="HitResult"/>.
/// </summary>
/// <param name="result">The <see cref="HitResult"/> to find the numeric health increase for.</param>
/// <returns>The numeric health increase of <paramref name="result"/>.</returns>
protected virtual double HealthIncreaseFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Miss:
return -1.0;
case HitResult.Good:
return 1.1;
case HitResult.Great:
return 3.0;
}
}
/// <summary>
/// Retrieves the numeric health increase of a <see cref="JudgementResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/> to find the numeric health increase for.</param>
/// <returns>The numeric health increase of <paramref name="result"/>.</returns>
public double HealthIncreaseFor(JudgementResult result) => HealthIncreaseFor(result.Type);
}
}

View File

@ -1,12 +1,14 @@
// 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.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Judgements
{
public class TaikoStrongJudgement : TaikoJudgement
{
// MainObject already changes the HP
public override bool AffectsHP => false;
protected override double HealthIncreaseFor(HitResult result) => 0;
public override bool AffectsCombo => false;
}

View File

@ -9,6 +9,15 @@ namespace osu.Game.Rulesets.Taiko.Judgements
{
public override bool AffectsCombo => false;
protected override int NumericResultFor(HitResult result) => 0;
protected override double HealthIncreaseFor(HitResult result)
{
switch(result)
{
default:
return 0;
case HitResult.Miss:
return -0.65;
}
}
}
}

View File

@ -9,17 +9,8 @@ namespace osu.Game.Rulesets.Taiko.Judgements
{
public override bool AffectsCombo => false;
public override bool AffectsHP => false;
protected override int NumericResultFor(HitResult result) => 0;
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Great:
return 300;
}
}
protected override double HealthIncreaseFor(HitResult result) => 0;
}
}

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
}
var result = HitObject.HitWindows.ResultFor(timeOffset);
if (result == HitResult.None)
if (result <= HitResult.Miss)
return;
if (!validActionPressed)

View File

@ -73,11 +73,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring
/// </summary>
protected override bool DefaultFailCondition => JudgedHits == MaxHits && Health.Value <= 0.5;
private double hpIncreaseTick;
private double hpIncreaseGreat;
private double hpIncreaseGood;
private double hpIncreaseMiss;
private double hpIncreaseMissSwell;
private double hpMultiplier;
private double hpMissMultiplier;
public TaikoScoreProcessor(RulesetContainer<TaikoHitObject> rulesetContainer)
: base(rulesetContainer)
@ -88,49 +85,25 @@ namespace osu.Game.Rulesets.Taiko.Scoring
{
base.ApplyBeatmap(beatmap);
double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.5, 0.75, 0.98));
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));
hpIncreaseTick = hp_hit_tick;
hpIncreaseGreat = hpMultiplierNormal * hp_hit_great;
hpIncreaseGood = hpMultiplierNormal * hp_hit_good;
hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max);
hpIncreaseMissSwell = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, swell_hp_miss_min, swell_hp_miss_mid, swell_hp_miss_max);
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120);
}
protected override void ApplyResult(JudgementResult result)
{
base.ApplyResult(result);
if (!((TaikoJudgement)result.Judgement).AffectsHP)
return;
bool isSwell = false;
bool isTick = result.Judgement is TaikoDrumRollTickJudgement;
if(!isTick)
isSwell = result.Judgement is TaikoSwellJudgement;
// Apply HP changes
switch (result.Type)
if (result.Judgement is TaikoJudgement taikoJudgement)
{
case HitResult.Miss:
// Missing ticks shouldn't drop HP
if (isSwell)
Health.Value += hpIncreaseMissSwell;
else if (!isTick)
Health.Value += hpIncreaseMiss;
break;
case HitResult.Good:
// Swells shouldn't increase HP
if (!isSwell)
Health.Value += hpIncreaseGood;
break;
case HitResult.Great:
if (isTick)
Health.Value += hpIncreaseTick;
else if(!isSwell)
Health.Value += hpIncreaseGreat;
break;
double hpIncrease = taikoJudgement.HealthIncreaseFor(result);
if (result.Type == HitResult.Miss)
hpIncrease *= hpMissMultiplier;
else
hpIncrease *= hpMultiplier;
Health.Value += hpIncrease;
}
}

View File

@ -200,7 +200,6 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GL/@EntryIndexedValue">GL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GLSL/@EntryIndexedValue">GLSL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HID/@EntryIndexedValue">HID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HP/@EntryIndexedValue">HP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HUD/@EntryIndexedValue">HUD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>