mirror of
https://github.com/ppy/osu.git
synced 2025-03-19 01:17:19 +08:00
Merge branch 'master' into default-value-indicator
This commit is contained in:
commit
cc9727ec11
@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
public double OverallDifficulty { get; set; }
|
||||
public double DrainRate { get; set; }
|
||||
public int HitCircleCount { get; set; }
|
||||
public int SliderCount { get; set; }
|
||||
public int SpinnerCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
maxCombo += beatmap.HitObjects.OfType<Slider>().Sum(s => s.NestedHitObjects.Count - 1);
|
||||
|
||||
int hitCirclesCount = beatmap.HitObjects.Count(h => h is HitCircle);
|
||||
int sliderCount = beatmap.HitObjects.Count(h => h is Slider);
|
||||
int spinnerCount = beatmap.HitObjects.Count(h => h is Spinner);
|
||||
|
||||
return new OsuDifficultyAttributes
|
||||
@ -78,6 +79,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
DrainRate = drainRate,
|
||||
MaxCombo = maxCombo,
|
||||
HitCircleCount = hitCirclesCount,
|
||||
SliderCount = sliderCount,
|
||||
SpinnerCount = spinnerCount,
|
||||
Skills = skills
|
||||
};
|
||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
private int countMeh;
|
||||
private int countMiss;
|
||||
|
||||
private int effectiveMissCount;
|
||||
|
||||
public OsuPerformanceCalculator(Ruleset ruleset, DifficultyAttributes attributes, ScoreInfo score)
|
||||
: base(ruleset, attributes, score)
|
||||
{
|
||||
@ -39,19 +41,20 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
countOk = Score.Statistics.GetValueOrDefault(HitResult.Ok);
|
||||
countMeh = Score.Statistics.GetValueOrDefault(HitResult.Meh);
|
||||
countMiss = Score.Statistics.GetValueOrDefault(HitResult.Miss);
|
||||
effectiveMissCount = calculateEffectiveMissCount();
|
||||
|
||||
double multiplier = 1.12; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things.
|
||||
|
||||
// Custom multipliers for NoFail and SpunOut.
|
||||
if (mods.Any(m => m is OsuModNoFail))
|
||||
multiplier *= Math.Max(0.90, 1.0 - 0.02 * countMiss);
|
||||
multiplier *= Math.Max(0.90, 1.0 - 0.02 * effectiveMissCount);
|
||||
|
||||
if (mods.Any(m => m is OsuModSpunOut))
|
||||
multiplier *= 1.0 - Math.Pow((double)Attributes.SpinnerCount / totalHits, 0.85);
|
||||
|
||||
if (mods.Any(h => h is OsuModRelax))
|
||||
{
|
||||
countMiss += countOk + countMeh;
|
||||
effectiveMissCount += countOk + countMeh;
|
||||
multiplier *= 0.6;
|
||||
}
|
||||
|
||||
@ -97,8 +100,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
aimValue *= lengthBonus;
|
||||
|
||||
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
||||
if (countMiss > 0)
|
||||
aimValue *= 0.97 * Math.Pow(1 - Math.Pow((double)countMiss / totalHits, 0.775), countMiss);
|
||||
if (effectiveMissCount > 0)
|
||||
aimValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), effectiveMissCount);
|
||||
|
||||
// Combo scaling.
|
||||
if (Attributes.MaxCombo > 0)
|
||||
@ -115,7 +118,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
double approachRateBonus = 1.0 + (0.03 + 0.37 * approachRateTotalHitsFactor) * approachRateFactor;
|
||||
|
||||
if (mods.Any(m => m is OsuModBlinds))
|
||||
aimValue *= 1.3 + (totalHits * (0.0016 / (1 + 2 * countMiss)) * Math.Pow(accuracy, 16)) * (1 - 0.003 * Attributes.DrainRate * Attributes.DrainRate);
|
||||
aimValue *= 1.3 + (totalHits * (0.0016 / (1 + 2 * effectiveMissCount)) * Math.Pow(accuracy, 16)) * (1 - 0.003 * Attributes.DrainRate * Attributes.DrainRate);
|
||||
else if (mods.Any(h => h is OsuModHidden))
|
||||
{
|
||||
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
||||
@ -142,8 +145,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
speedValue *= lengthBonus;
|
||||
|
||||
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
||||
if (countMiss > 0)
|
||||
speedValue *= 0.97 * Math.Pow(1 - Math.Pow((double)countMiss / totalHits, 0.775), Math.Pow(countMiss, .875));
|
||||
if (effectiveMissCount > 0)
|
||||
speedValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
|
||||
|
||||
// Combo scaling.
|
||||
if (Attributes.MaxCombo > 0)
|
||||
@ -231,8 +234,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
flashlightValue *= 1.3;
|
||||
|
||||
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
||||
if (countMiss > 0)
|
||||
flashlightValue *= 0.97 * Math.Pow(1 - Math.Pow((double)countMiss / totalHits, 0.775), Math.Pow(countMiss, .875));
|
||||
if (effectiveMissCount > 0)
|
||||
flashlightValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875));
|
||||
|
||||
// Combo scaling.
|
||||
if (Attributes.MaxCombo > 0)
|
||||
@ -250,6 +253,24 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
return flashlightValue;
|
||||
}
|
||||
|
||||
private int calculateEffectiveMissCount()
|
||||
{
|
||||
// guess the number of misses + slider breaks from combo
|
||||
double comboBasedMissCount = 0.0;
|
||||
|
||||
if (Attributes.SliderCount > 0)
|
||||
{
|
||||
double fullComboThreshold = Attributes.MaxCombo - 0.1 * Attributes.SliderCount;
|
||||
if (scoreMaxCombo < fullComboThreshold)
|
||||
comboBasedMissCount = fullComboThreshold / Math.Max(1.0, scoreMaxCombo);
|
||||
}
|
||||
|
||||
// we're clamping misscount because since its derived from combo it can be higher than total hits and that breaks some calculations
|
||||
comboBasedMissCount = Math.Min(comboBasedMissCount, totalHits);
|
||||
|
||||
return Math.Max(countMiss, (int)Math.Floor(comboBasedMissCount));
|
||||
}
|
||||
|
||||
private int totalHits => countGreat + countOk + countMeh + countMiss;
|
||||
private int totalSuccessfulHits => countGreat + countOk + countMeh;
|
||||
}
|
||||
|
@ -20,14 +20,15 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
/// </summary>
|
||||
public abstract class TestSceneAllRulesetPlayers : RateAdjustedBeatmapTestScene
|
||||
{
|
||||
protected Player Player;
|
||||
protected Player Player { get; private set; }
|
||||
|
||||
protected OsuConfigManager Config { get; private set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
OsuConfigManager manager;
|
||||
Dependencies.Cache(manager = new OsuConfigManager(LocalStorage));
|
||||
manager.GetBindable<double>(OsuSetting.DimLevel).Value = 1.0;
|
||||
Dependencies.Cache(Config = new OsuConfigManager(LocalStorage));
|
||||
Config.GetBindable<double>(OsuSetting.DimLevel).Value = 1.0;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -2,7 +2,9 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Play;
|
||||
@ -17,6 +19,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
return new FailPlayer();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOsuWithoutRedTint()
|
||||
{
|
||||
AddStep("Disable red tint", () => Config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, false));
|
||||
TestOsu();
|
||||
AddStep("Enable red tint", () => Config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, true));
|
||||
}
|
||||
|
||||
protected override void AddCheckSteps()
|
||||
{
|
||||
AddUntilStep("wait for fail", () => Player.HasFailed);
|
||||
|
@ -291,7 +291,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType<EpilepsyWarning>().Any() == warning);
|
||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => (getWarning() != null) == warning);
|
||||
|
||||
if (warning)
|
||||
{
|
||||
@ -335,12 +335,17 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddUntilStep("wait for epilepsy warning", () => loader.ChildrenOfType<EpilepsyWarning>().Single().Alpha > 0);
|
||||
AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0);
|
||||
AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible);
|
||||
|
||||
AddStep("exit early", () => loader.Exit());
|
||||
|
||||
AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden);
|
||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||
}
|
||||
|
||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault();
|
||||
|
||||
private class TestPlayerLoader : PlayerLoader
|
||||
{
|
||||
public new VisualSettings VisualSettings => base.VisualSettings;
|
||||
|
@ -275,6 +275,68 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
var state = i;
|
||||
AddStep($"set state: {state}", () => Client.ChangeUserState(0, state));
|
||||
}
|
||||
|
||||
AddStep("set state: downloading", () => Client.ChangeUserBeatmapAvailability(0, BeatmapAvailability.Downloading(0)));
|
||||
|
||||
AddStep("set state: locally available", () => Client.ChangeUserBeatmapAvailability(0, BeatmapAvailability.LocallyAvailable()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestModOverlap()
|
||||
{
|
||||
AddStep("add dummy mods", () =>
|
||||
{
|
||||
Client.ChangeUserMods(new Mod[]
|
||||
{
|
||||
new OsuModNoFail(),
|
||||
new OsuModDoubleTime()
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("add user with mods", () =>
|
||||
{
|
||||
Client.AddUser(new User
|
||||
{
|
||||
Id = 0,
|
||||
Username = "Baka",
|
||||
RulesetsStatistics = new Dictionary<string, UserStatistics>
|
||||
{
|
||||
{
|
||||
Ruleset.Value.ShortName,
|
||||
new UserStatistics { GlobalRank = RNG.Next(1, 100000), }
|
||||
}
|
||||
},
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
||||
});
|
||||
Client.ChangeUserMods(0, new Mod[]
|
||||
{
|
||||
new OsuModHardRock(),
|
||||
new OsuModDoubleTime()
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("set 0 ready", () => Client.ChangeState(MultiplayerUserState.Ready));
|
||||
|
||||
AddStep("set 1 spectate", () => Client.ChangeUserState(0, MultiplayerUserState.Spectating));
|
||||
|
||||
// Have to set back to idle due to status priority.
|
||||
AddStep("set 0 no map, 1 ready", () =>
|
||||
{
|
||||
Client.ChangeState(MultiplayerUserState.Idle);
|
||||
Client.ChangeBeatmapAvailability(BeatmapAvailability.NotDownloaded());
|
||||
Client.ChangeUserState(0, MultiplayerUserState.Ready);
|
||||
});
|
||||
|
||||
AddStep("set 0 downloading", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
||||
|
||||
AddStep("set 0 spectate", () => Client.ChangeUserState(0, MultiplayerUserState.Spectating));
|
||||
|
||||
AddStep("make both default", () =>
|
||||
{
|
||||
Client.ChangeBeatmapAvailability(BeatmapAvailability.LocallyAvailable());
|
||||
Client.ChangeUserState(0, MultiplayerUserState.Idle);
|
||||
Client.ChangeState(MultiplayerUserState.Idle);
|
||||
});
|
||||
}
|
||||
|
||||
private void createNewParticipantsList()
|
||||
|
@ -39,17 +39,19 @@ namespace osu.Game.Online.API
|
||||
if (string.IsNullOrEmpty(username)) throw new ArgumentException("Missing username.");
|
||||
if (string.IsNullOrEmpty(password)) throw new ArgumentException("Missing password.");
|
||||
|
||||
using (var req = new AccessTokenRequestPassword(username, password)
|
||||
var accessTokenRequest = new AccessTokenRequestPassword(username, password)
|
||||
{
|
||||
Url = $@"{endpoint}/oauth/token",
|
||||
Method = HttpMethod.Post,
|
||||
ClientId = clientId,
|
||||
ClientSecret = clientSecret
|
||||
})
|
||||
};
|
||||
|
||||
using (accessTokenRequest)
|
||||
{
|
||||
try
|
||||
{
|
||||
req.Perform();
|
||||
accessTokenRequest.Perform();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -60,7 +62,7 @@ namespace osu.Game.Online.API
|
||||
try
|
||||
{
|
||||
// attempt to decode a displayable error string.
|
||||
var error = JsonConvert.DeserializeObject<OAuthError>(req.GetResponseString() ?? string.Empty);
|
||||
var error = JsonConvert.DeserializeObject<OAuthError>(accessTokenRequest.GetResponseString() ?? string.Empty);
|
||||
if (error != null)
|
||||
throwableException = new APIException(error.UserDisplayableError, ex);
|
||||
}
|
||||
@ -71,7 +73,7 @@ namespace osu.Game.Online.API
|
||||
throw throwableException;
|
||||
}
|
||||
|
||||
Token.Value = req.ResponseObject;
|
||||
Token.Value = accessTokenRequest.ResponseObject;
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,17 +81,19 @@ namespace osu.Game.Online.API
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var req = new AccessTokenRequestRefresh(refresh)
|
||||
var refreshRequest = new AccessTokenRequestRefresh(refresh)
|
||||
{
|
||||
Url = $@"{endpoint}/oauth/token",
|
||||
Method = HttpMethod.Post,
|
||||
ClientId = clientId,
|
||||
ClientSecret = clientSecret
|
||||
})
|
||||
{
|
||||
req.Perform();
|
||||
};
|
||||
|
||||
Token.Value = req.ResponseObject;
|
||||
using (refreshRequest)
|
||||
{
|
||||
refreshRequest.Perform();
|
||||
|
||||
Token.Value = refreshRequest.ResponseObject;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
@ -190,6 +191,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
|
||||
userStateDisplay.UpdateStatus(User.State, User.BeatmapAvailability);
|
||||
|
||||
if ((User.BeatmapAvailability.State == DownloadState.LocallyAvailable) && (User.State != MultiplayerUserState.Spectating))
|
||||
userModsDisplay.FadeIn(fade_time);
|
||||
else
|
||||
userModsDisplay.FadeOut(fade_time);
|
||||
|
||||
if (Client.IsHost && !User.Equals(Client.LocalUser))
|
||||
kickButton.FadeIn(fade_time);
|
||||
else
|
||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio.Effects;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -35,7 +36,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private Container filters;
|
||||
|
||||
private Box failFlash;
|
||||
private Box redFlashLayer;
|
||||
|
||||
private Track track;
|
||||
|
||||
@ -46,6 +47,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private Sample failSample;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
protected override Container<Drawable> Content { get; } = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
@ -77,7 +81,7 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
},
|
||||
Content,
|
||||
failFlash = new Box
|
||||
redFlashLayer = new Box
|
||||
{
|
||||
Colour = Color4.Red,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -114,7 +118,8 @@ namespace osu.Game.Screens.Play
|
||||
applyToPlayfield(drawableRuleset.Playfield);
|
||||
drawableRuleset.Playfield.HitObjectContainer.FadeOut(duration / 2);
|
||||
|
||||
failFlash.FadeOutFromOne(1000);
|
||||
if (config.Get<bool>(OsuSetting.FadePlayfieldWhenHealthLow))
|
||||
redFlashLayer.FadeOutFromOne(1000);
|
||||
|
||||
Content.Masking = true;
|
||||
|
||||
|
@ -246,6 +246,9 @@ namespace osu.Game.Screens.Play
|
||||
cancelLoad();
|
||||
contentOut();
|
||||
|
||||
// If the load sequence was interrupted, the epilepsy warning may already be displayed (or in the process of being displayed).
|
||||
epilepsyWarning?.Hide();
|
||||
|
||||
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
||||
this.Delay(content_out_duration).FadeOut();
|
||||
|
||||
|
@ -73,6 +73,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLocalFunction/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToStaticClass/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToUsingDeclaration/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertTypeCheckPatternToNullCheck/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=DoubleNegationOperator/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EmptyGeneralCatchClause/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String>
|
||||
|
Loading…
x
Reference in New Issue
Block a user