mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Fix up mod application + beatmap/hitobject references
This commit is contained in:
parent
cc1720241e
commit
7892eefd68
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.OsuDifficulty.Preprocessing;
|
||||
@ -16,19 +17,25 @@ namespace osu.Game.Rulesets.Osu.OsuDifficulty
|
||||
private const int section_length = 400;
|
||||
private const double difficulty_multiplier = 0.0675;
|
||||
|
||||
public OsuDifficultyCalculator(Beatmap beatmap) : base(beatmap)
|
||||
public OsuDifficultyCalculator(Beatmap beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
public OsuDifficultyCalculator(Beatmap beatmap, Mod[] mods)
|
||||
: base(beatmap, mods)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void PreprocessHitObjects()
|
||||
{
|
||||
foreach (OsuHitObject h in Objects)
|
||||
foreach (OsuHitObject h in Beatmap.HitObjects)
|
||||
(h as Slider)?.Curve?.Calculate();
|
||||
}
|
||||
|
||||
public override double Calculate(Dictionary<string, string> categoryDifficulty)
|
||||
{
|
||||
OsuDifficultyBeatmap beatmap = new OsuDifficultyBeatmap(Objects);
|
||||
OsuDifficultyBeatmap beatmap = new OsuDifficultyBeatmap(Beatmap.HitObjects);
|
||||
Skill[] skills =
|
||||
{
|
||||
new Aim(),
|
||||
|
@ -113,7 +113,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_osu_o };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new OsuDifficultyCalculator(beatmap);
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new OsuDifficultyCalculator(beatmap, mods);
|
||||
|
||||
public override string Description => "osu!";
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko
|
||||
// Fill our custom DifficultyHitObject class, that carries additional information
|
||||
difficultyHitObjects.Clear();
|
||||
|
||||
foreach (var hitObject in Objects)
|
||||
foreach (var hitObject in Beatmap.HitObjects)
|
||||
difficultyHitObjects.Add(new TaikoHitObjectDifficulty(hitObject));
|
||||
|
||||
// Sort DifficultyHitObjects by StartTime of the HitObjects - just to make sure.
|
||||
|
@ -19,11 +19,9 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public abstract class DifficultyCalculator<T> : DifficultyCalculator where T : HitObject
|
||||
{
|
||||
protected readonly Beatmap Beatmap;
|
||||
protected readonly Beatmap<T> Beatmap;
|
||||
protected readonly Mod[] Mods;
|
||||
|
||||
protected List<T> Objects;
|
||||
|
||||
protected DifficultyCalculator(Beatmap beatmap)
|
||||
: this(beatmap, null)
|
||||
{
|
||||
@ -31,13 +29,9 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
protected DifficultyCalculator(Beatmap beatmap, Mod[] mods)
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
Beatmap = CreateBeatmapConverter().Convert(beatmap);
|
||||
Mods = mods ?? new Mod[0];
|
||||
|
||||
Objects = CreateBeatmapConverter().Convert(beatmap).HitObjects;
|
||||
|
||||
foreach (var h in Objects)
|
||||
h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
||||
|
||||
ApplyMods(Mods);
|
||||
|
||||
@ -50,9 +44,15 @@ namespace osu.Game.Beatmaps
|
||||
mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock));
|
||||
TimeRate = clock.Rate;
|
||||
|
||||
foreach (var mod in Mods.OfType<IApplicableToDifficulty>())
|
||||
mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BaseDifficulty);
|
||||
|
||||
foreach (var mod in mods.OfType<IApplicableToHitObject<T>>())
|
||||
foreach (var obj in Objects)
|
||||
foreach (var obj in Beatmap.HitObjects)
|
||||
mod.ApplyToHitObject(obj);
|
||||
|
||||
foreach (var h in Beatmap.HitObjects)
|
||||
h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BaseDifficulty);
|
||||
}
|
||||
|
||||
protected virtual void PreprocessHitObjects()
|
||||
|
Loading…
Reference in New Issue
Block a user