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 AffectsCombo => false;
public override bool AffectsHP => false;
protected override int NumericResultFor(HitResult result) => 0; 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; return 200;
} }
} }
protected override double HealthIncreaseFor(HitResult result)
{
switch(result)
{
default:
return 0;
case HitResult.Great:
return 0.0000003;
}
}
} }
} }

View File

@ -10,11 +10,6 @@ namespace osu.Game.Rulesets.Taiko.Judgements
{ {
public override HitResult MaxResult => HitResult.Great; public override HitResult MaxResult => HitResult.Great;
/// <summary>
/// Whether this <see cref="TaikoJudgement"/> should affect user's hitpoints.
/// </summary>
public virtual bool AffectsHP => true;
/// <summary> /// <summary>
/// Computes the numeric result value for the combo portion of the score. /// Computes the numeric result value for the combo portion of the score.
/// </summary> /// </summary>
@ -32,5 +27,32 @@ namespace osu.Game.Rulesets.Taiko.Judgements
return 300; 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>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Judgements namespace osu.Game.Rulesets.Taiko.Judgements
{ {
public class TaikoStrongJudgement : TaikoJudgement public class TaikoStrongJudgement : TaikoJudgement
{ {
// MainObject already changes the HP // MainObject already changes the HP
public override bool AffectsHP => false; protected override double HealthIncreaseFor(HitResult result) => 0;
public override bool AffectsCombo => false; public override bool AffectsCombo => false;
} }

View File

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

View File

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

View File

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

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/=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/=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/=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/=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/=ID/@EntryIndexedValue">ID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>