1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 16:25:32 +08:00

Merge pull request #2804 from smoogipoo/mania-keymod-optimisation

Don't compute keymod difficulties for mania-specific beatmap
This commit is contained in:
Dean Herbert 2018-06-18 02:07:02 +09:00 committed by GitHub
commit 62a2a5fbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,9 +29,12 @@ namespace osu.Game.Rulesets.Mania.Difficulty
/// </summary> /// </summary>
private const double decay_weight = 0.9; private const double decay_weight = 0.9;
private readonly bool isForCurrentRuleset;
public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap) : base(ruleset, beatmap)
{ {
isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo);
} }
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate)
@ -129,12 +132,24 @@ namespace osu.Game.Rulesets.Mania.Difficulty
return difficulty; return difficulty;
} }
protected override Mod[] DifficultyAdjustmentMods => new Mod[] protected override Mod[] DifficultyAdjustmentMods
{
get
{
var mods = new Mod[]
{ {
new ManiaModDoubleTime(), new ManiaModDoubleTime(),
new ManiaModHalfTime(), new ManiaModHalfTime(),
new ManiaModEasy(), new ManiaModEasy(),
new ManiaModHardRock(), new ManiaModHardRock(),
};
if (isForCurrentRuleset)
return mods;
// if we are a convert, we can be played in any key mod.
return mods.Concat(new Mod[]
{
new ManiaModKey1(), new ManiaModKey1(),
new ManiaModKey2(), new ManiaModKey2(),
new ManiaModKey3(), new ManiaModKey3(),
@ -144,7 +159,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty
new ManiaModKey7(), new ManiaModKey7(),
new ManiaModKey8(), new ManiaModKey8(),
new ManiaModKey9(), new ManiaModKey9(),
}; }).ToArray();
}
}
} }
} }