mirror of
https://github.com/ppy/osu.git
synced 2025-02-07 19:02:58 +08:00
Replace indexed skill access with skills.First(s is ...)
This commit is contained in:
parent
c1e51e05df
commit
75890005e6
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
|
||||
@ -40,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
|
||||
CatchDifficultyAttributes attributes = new CatchDifficultyAttributes
|
||||
{
|
||||
StarRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier,
|
||||
StarRating = Math.Sqrt(skills.First(s => s is Movement).DifficultyValue()) * difficulty_multiplier,
|
||||
Mods = mods,
|
||||
ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0,
|
||||
MaxCombo = beatmap.GetMaxCombo(),
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
|
||||
ManiaDifficultyAttributes attributes = new ManiaDifficultyAttributes
|
||||
{
|
||||
StarRating = skills[0].DifficultyValue() * difficulty_multiplier,
|
||||
StarRating = skills.First(s => s is Strain).DifficultyValue() * difficulty_multiplier,
|
||||
Mods = mods,
|
||||
// In osu-stable mania, rate-adjustment mods don't affect the hit window.
|
||||
// This is done the way it is to introduce fractional differences in order to match osu-stable for the time being.
|
||||
|
@ -36,15 +36,22 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
if (beatmap.HitObjects.Count == 0)
|
||||
return new OsuDifficultyAttributes { Mods = mods };
|
||||
|
||||
double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
|
||||
double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
|
||||
double speedRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier;
|
||||
double speedNotes = ((Speed)skills[2]).RelevantNoteCount();
|
||||
var aim = (Aim)skills.First(s => s is Aim);
|
||||
var aimWithoutSliders = (AimWithoutSliders)skills.First(s => s is AimWithoutSliders);
|
||||
var speed = (Speed)skills.First(s => s is Speed);
|
||||
|
||||
double aimRating = Math.Sqrt(aim.DifficultyValue()) * difficulty_multiplier;
|
||||
double aimRatingNoSliders = Math.Sqrt(aimWithoutSliders.DifficultyValue()) * difficulty_multiplier;
|
||||
double speedRating = Math.Sqrt(speed.DifficultyValue()) * difficulty_multiplier;
|
||||
double speedNotes = speed.RelevantNoteCount();
|
||||
|
||||
double flashlightRating = 0.0;
|
||||
|
||||
if (mods.Any(h => h is OsuModFlashlight))
|
||||
flashlightRating = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier;
|
||||
{
|
||||
var flashlight = (Flashlight)skills.First(s => s is Flashlight);
|
||||
flashlightRating = Math.Sqrt(flashlight.DifficultyValue()) * difficulty_multiplier;
|
||||
}
|
||||
|
||||
double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1;
|
||||
|
||||
@ -131,8 +138,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
{
|
||||
var skills = new List<Skill>
|
||||
{
|
||||
new Aim(mods, true),
|
||||
new Aim(mods, false),
|
||||
new Aim(mods),
|
||||
new AimWithoutSliders(mods),
|
||||
new Speed(mods)
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
/// </summary>
|
||||
public class Aim : OsuStrainSkill
|
||||
{
|
||||
public Aim(Mod[] mods, bool withSliders)
|
||||
public Aim(Mod[] mods, bool withSliders = true)
|
||||
: base(mods)
|
||||
{
|
||||
this.withSliders = withSliders;
|
||||
|
18
osu.Game.Rulesets.Osu/Difficulty/Skills/AimWithoutSliders.cs
Normal file
18
osu.Game.Rulesets.Osu/Difficulty/Skills/AimWithoutSliders.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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.
|
||||
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the Aim skill that includes sliders in it's calculation
|
||||
/// </summary>
|
||||
public class AimWithoutSliders : Aim
|
||||
{
|
||||
public AimWithoutSliders(Mod[] mods)
|
||||
: base(mods, false)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user