1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Merge branch 'master' into flashlight-dim

This commit is contained in:
Dean Herbert 2019-04-24 17:01:11 +09:00 committed by GitHub
commit 4f31eee5ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 122 additions and 131 deletions

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Catch.Judgements
default: default:
return 0; return 0;
case HitResult.Perfect: case HitResult.Perfect:
return 8; return 0.008;
} }
} }

View File

@ -23,9 +23,9 @@ namespace osu.Game.Rulesets.Catch.Judgements
switch (result) switch (result)
{ {
default: default:
return 0; return base.HealthIncreaseFor(result);
case HitResult.Perfect: case HitResult.Perfect:
return 7; return 0.007;
} }
} }
} }

View File

@ -27,9 +27,9 @@ namespace osu.Game.Rulesets.Catch.Judgements
switch (result) switch (result)
{ {
default: default:
return 0; return -0.02;
case HitResult.Perfect: case HitResult.Perfect:
return 10.2; return 0.01;
} }
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.Judgements
default: default:
return 0; return 0;
case HitResult.Perfect: case HitResult.Perfect:
return 4; return 0.004;
} }
} }
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
@ -27,20 +26,15 @@ namespace osu.Game.Rulesets.Catch.Scoring
hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate; hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate;
} }
private const double harshness = 0.01; protected override double HealthAdjustmentFactorFor(JudgementResult result)
protected override void ApplyResult(JudgementResult result)
{ {
base.ApplyResult(result); switch (result.Type)
if (result.Type == HitResult.Miss)
{ {
if (!result.Judgement.IsBonus) case HitResult.Miss:
Health.Value -= hpDrainRate * (harshness * 2); return hpDrainRate;
return; default:
return 10.2 - hpDrainRate; // Award less HP as drain rate is increased
} }
Health.Value += Math.Max(result.Judgement.HealthIncreaseFor(result) - hpDrainRate, 0) * harshness;
} }
public override HitWindows CreateHitWindows() => new CatchHitWindows(); public override HitWindows CreateHitWindows() => new CatchHitWindows();

View File

@ -10,5 +10,16 @@ namespace osu.Game.Rulesets.Mania.Judgements
public override bool AffectsCombo => false; public override bool AffectsCombo => false;
protected override int NumericResultFor(HitResult result) => 20; protected override int NumericResultFor(HitResult result) => 20;
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
case HitResult.Miss:
return 0;
default:
return 0.040;
}
}
} }
} }

View File

@ -25,5 +25,26 @@ namespace osu.Game.Rulesets.Mania.Judgements
return 300; return 300;
} }
} }
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
case HitResult.Miss:
return -0.125;
case HitResult.Meh:
return 0.005;
case HitResult.Ok:
return 0.010;
case HitResult.Good:
return 0.035;
case HitResult.Great:
return 0.055;
case HitResult.Perfect:
return 0.065;
default:
return 0;
}
}
} }
} }

View File

@ -3,7 +3,6 @@
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
@ -28,36 +27,6 @@ namespace osu.Game.Rulesets.Mania.Scoring
/// </summary> /// </summary>
private const double hp_multiplier_max = 1; 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> /// <summary>
/// The MISS HP multiplier at OD = 0. /// The MISS HP multiplier at OD = 0.
/// </summary> /// </summary>
@ -73,11 +42,6 @@ namespace osu.Game.Rulesets.Mania.Scoring
/// </summary> /// </summary>
private const double hp_multiplier_miss_max = 1; private const double hp_multiplier_miss_max = 1;
/// <summary>
/// The default MISS HP increase.
/// </summary>
private const double hp_increase_miss = -0.125;
/// <summary> /// <summary>
/// The MISS HP multiplier. This is multiplied to the miss hp increase. /// The MISS HP multiplier. This is multiplied to the miss hp increase.
/// </summary> /// </summary>
@ -88,10 +52,6 @@ namespace osu.Game.Rulesets.Mania.Scoring
/// </summary> /// </summary>
private double hpMultiplier = 1; private double hpMultiplier = 1;
public ManiaScoreProcessor()
{
}
public ManiaScoreProcessor(DrawableRuleset<ManiaHitObject> drawableRuleset) public ManiaScoreProcessor(DrawableRuleset<ManiaHitObject> drawableRuleset)
: base(drawableRuleset) : base(drawableRuleset)
{ {
@ -122,42 +82,8 @@ namespace osu.Game.Rulesets.Mania.Scoring
} }
} }
protected override void ApplyResult(JudgementResult result) protected override double HealthAdjustmentFactorFor(JudgementResult result)
{ => result.Type == HitResult.Miss ? hpMissMultiplier : hpMultiplier;
base.ApplyResult(result);
bool isTick = result.Judgement is HoldNoteTickJudgement;
if (isTick)
{
if (result.IsHit)
Health.Value += hpMultiplier * hp_increase_tick;
}
else
{
switch (result.Type)
{
case HitResult.Miss:
Health.Value += hpMissMultiplier * hp_increase_miss;
break;
case HitResult.Meh:
Health.Value += hpMultiplier * hp_increase_bad;
break;
case HitResult.Ok:
Health.Value += hpMultiplier * hp_increase_ok;
break;
case HitResult.Good:
Health.Value += hpMultiplier * hp_increase_good;
break;
case HitResult.Great:
Health.Value += hpMultiplier * hp_increase_great;
break;
case HitResult.Perfect:
Health.Value += hpMultiplier * hp_increase_perfect;
break;
}
}
}
public override HitWindows CreateHitWindows() => new ManiaHitWindows(); public override HitWindows CreateHitWindows() => new ManiaHitWindows();
} }

View File

@ -24,5 +24,20 @@ namespace osu.Game.Rulesets.Osu.Judgements
return 300; return 300;
} }
} }
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
case HitResult.Miss:
return -0.02;
case HitResult.Meh:
case HitResult.Good:
case HitResult.Great:
return 0.01;
default:
return 0;
}
}
} }
} }

View File

@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.Osu.Scoring
comboResultCounts.Clear(); comboResultCounts.Clear();
} }
private const double harshness = 0.01;
protected override void ApplyResult(JudgementResult result) protected override void ApplyResult(JudgementResult result)
{ {
base.ApplyResult(result); base.ApplyResult(result);
@ -47,28 +45,29 @@ namespace osu.Game.Rulesets.Osu.Scoring
if (result.Type != HitResult.None) if (result.Type != HitResult.None)
comboResultCounts[osuResult.ComboType] = comboResultCounts.GetOrDefault(osuResult.ComboType) + 1; comboResultCounts[osuResult.ComboType] = comboResultCounts.GetOrDefault(osuResult.ComboType) + 1;
}
protected override double HealthAdjustmentFactorFor(JudgementResult result)
{
switch (result.Type) switch (result.Type)
{ {
case HitResult.Great: case HitResult.Great:
Health.Value += (10.2 - hpDrainRate) * harshness; return 10.2 - hpDrainRate;
break;
case HitResult.Good: case HitResult.Good:
Health.Value += (8 - hpDrainRate) * harshness; return 8 - hpDrainRate;
break;
case HitResult.Meh: case HitResult.Meh:
Health.Value += (4 - hpDrainRate) * harshness; return 4 - hpDrainRate;
break;
/*case HitResult.SliderTick: // case HitResult.SliderTick:
Health.Value += Math.Max(7 - hpDrainRate, 0) * 0.01; // return Math.Max(7 - hpDrainRate, 0) * 0.01;
break;*/
case HitResult.Miss: case HitResult.Miss:
Health.Value -= hpDrainRate * (harshness * 2); return hpDrainRate;
break;
default:
return 0;
} }
} }

View File

@ -46,19 +46,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120); hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120);
} }
protected override void ApplyResult(JudgementResult result) protected override double HealthAdjustmentFactorFor(JudgementResult result)
{ => result.Type == HitResult.Miss ? hpMissMultiplier : hpMultiplier;
base.ApplyResult(result);
double hpIncrease = result.Judgement.HealthIncreaseFor(result);
if (result.Type == HitResult.Miss)
hpIncrease *= hpMissMultiplier;
else
hpIncrease *= hpMultiplier;
Health.Value += hpIncrease;
}
protected override void Reset(bool storeResults) protected override void Reset(bool storeResults)
{ {

View File

@ -31,6 +31,11 @@ namespace osu.Game.Rulesets.Judgements
/// </summary> /// </summary>
public int MaxNumericResult => NumericResultFor(MaxResult); public int MaxNumericResult => NumericResultFor(MaxResult);
/// <summary>
/// The health increase for the maximum achievable result.
/// </summary>
public double MaxHealthIncrease => HealthIncreaseFor(MaxResult);
/// <summary> /// <summary>
/// Retrieves the numeric score representation of a <see cref="HitResult"/>. /// Retrieves the numeric score representation of a <see cref="HitResult"/>.
/// </summary> /// </summary>

View File

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

View File

@ -301,6 +301,7 @@ namespace osu.Game.Rulesets.Scoring
{ {
result.ComboAtJudgement = Combo.Value; result.ComboAtJudgement = Combo.Value;
result.HighestComboAtJudgement = HighestCombo.Value; result.HighestComboAtJudgement = HighestCombo.Value;
result.HealthAtJudgement = Health.Value;
JudgedHits++; JudgedHits++;
@ -332,6 +333,8 @@ namespace osu.Game.Rulesets.Scoring
baseScore += result.Judgement.NumericResultFor(result); baseScore += result.Judgement.NumericResultFor(result);
rollingMaxBaseScore += result.Judgement.MaxNumericResult; rollingMaxBaseScore += result.Judgement.MaxNumericResult;
} }
Health.Value += HealthAdjustmentFactorFor(result) * result.Judgement.HealthIncreaseFor(result);
} }
/// <summary> /// <summary>
@ -343,6 +346,7 @@ namespace osu.Game.Rulesets.Scoring
{ {
Combo.Value = result.ComboAtJudgement; Combo.Value = result.ComboAtJudgement;
HighestCombo.Value = result.HighestComboAtJudgement; HighestCombo.Value = result.HighestComboAtJudgement;
Health.Value = result.HealthAtJudgement;
JudgedHits--; JudgedHits--;
@ -358,6 +362,13 @@ namespace osu.Game.Rulesets.Scoring
} }
} }
/// <summary>
/// An adjustment factor which is multiplied into the health increase provided by a <see cref="JudgementResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/> for which the adjustment should apply.</param>
/// <returns>The adjustment factor.</returns>
protected virtual double HealthAdjustmentFactorFor(JudgementResult result) => 1;
private void updateScore() private void updateScore()
{ {
if (rollingMaxBaseScore != 0) if (rollingMaxBaseScore != 0)

View File

@ -225,6 +225,12 @@ namespace osu.Game.Rulesets.UI
if (replayInputManager.ReplayInputHandler != null) if (replayInputManager.ReplayInputHandler != null)
replayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace; replayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace;
if (!ProvidingUserCursor)
{
// The cursor is hidden by default (see Playfield.load()), but should be shown when there's a replay
Playfield.Cursor?.Show();
}
} }
/// <summary> /// <summary>

View File

@ -68,8 +68,13 @@ namespace osu.Game.Rulesets.UI
{ {
Cursor = CreateCursor(); Cursor = CreateCursor();
if (Cursor != null) if (Cursor != null)
{
// initial showing of the cursor will be handed by MenuCursorContainer (via DrawableRuleset's IProvideCursor implementation).
Cursor.Hide();
AddInternal(Cursor); AddInternal(Cursor);
} }
}
/// <summary> /// <summary>
/// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield. /// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield.

View File

@ -79,7 +79,7 @@ namespace osu.Game.Screens.Multi
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
Title = "multiplayer"; Title = "multi";
Icon = OsuIcon.Multi; Icon = OsuIcon.Multi;
AccentColour = colours.Yellow; AccentColour = colours.Yellow;
} }

View File

@ -276,7 +276,7 @@ namespace osu.Game.Screens.Multi
updatePollingRate(isIdle.Value); updatePollingRate(isIdle.Value);
if (screenStack.CurrentScreen == null) if (screenStack.CurrentScreen == null && this.IsCurrentScreen())
this.Exit(); this.Exit();
} }

View File

@ -110,20 +110,17 @@ namespace osu.Game.Screens.Play
adjustableClock.ChangeSource(sourceClock); adjustableClock.ChangeSource(sourceClock);
updateRate(); updateRate();
this.Delay(750).Schedule(() =>
{
if (!IsPaused.Value) if (!IsPaused.Value)
Start(); Start();
}); });
}); });
});
} }
public void Start() public void Start()
{ {
// Seeking the decoupled clock to its current time ensures that its source clock will be seeked to the same time // Seeking the decoupled clock to its current time ensures that its source clock will be seeked to the same time
// This accounts for the audio clock source potentially taking time to enter a completely stopped state // This accounts for the audio clock source potentially taking time to enter a completely stopped state
adjustableClock.Seek(adjustableClock.CurrentTime); Seek(GameplayClock.CurrentTime);
adjustableClock.Start(); adjustableClock.Start();
IsPaused.Value = false; IsPaused.Value = false;
} }

View File

@ -129,7 +129,7 @@ namespace osu.Game.Screens.Play.HUD
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(15), Size = new Vector2(15),
Icon = FontAwesome.Solid.TimesCircle Icon = FontAwesome.Solid.Times
}, },
} }
}; };

View File

@ -4,17 +4,24 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Testing.Input; using osu.Framework.Testing.Input;
using osu.Game.Graphics.Cursor;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
public abstract class ManualInputManagerTestCase : OsuTestCase public abstract class ManualInputManagerTestCase : OsuTestCase
{ {
protected override Container<Drawable> Content => InputManager; protected override Container<Drawable> Content => content;
private readonly Container content;
protected readonly ManualInputManager InputManager; protected readonly ManualInputManager InputManager;
protected ManualInputManagerTestCase() protected ManualInputManagerTestCase()
{ {
base.Content.Add(InputManager = new ManualInputManager { UseParentInput = true }); base.Content.Add(InputManager = new ManualInputManager
{
UseParentInput = true,
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both },
});
} }
/// <summary> /// <summary>