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

Fixed "works only for std" problem

1) Now it use AR/OD calculation from Ruleset class
2) Implemented needed functions in each of default rulesets
This commit is contained in:
Givikap120 2023-08-25 00:58:26 +03:00
parent ed886a4dc3
commit 17b9b1649a
6 changed files with 29 additions and 5 deletions

View File

@ -232,5 +232,9 @@ namespace osu.Game.Rulesets.Catch
}), }),
}; };
} }
public override double PreemptFromAr(float AR) => AR < 5 ? (1200.0 + 600.0 * (5 - AR) / 5) : (1200.0 - 750.0 * (AR - 5) / 5);
public override float ArFromPreempt(double preempt) => (float)(preempt > 1200 ? ((1800 - preempt) / 120) : ((1200 - preempt) / 150)) + 5;
public override float ChangeArFromRate(float AR, double rate) => ArFromPreempt(PreemptFromAr(AR) / rate);
} }
} }

View File

@ -427,6 +427,10 @@ namespace osu.Game.Rulesets.Mania
public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection(); public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection();
public override DifficultySection CreateEditorDifficultySection() => new ManiaDifficultySection(); public override DifficultySection CreateEditorDifficultySection() => new ManiaDifficultySection();
public override double HitwindowFromOd(float OD) => 64.0 - 3 * OD;
public override float OdFromHitwindow(double hitwindow300) => (float)(64.0 - hitwindow300) / 3;
public override float ChangeOdFromRate(float OD, double rate) => OdFromHitwindow(HitwindowFromOd(OD) / rate);
} }
public enum PlayfieldType public enum PlayfieldType

View File

@ -328,5 +328,12 @@ namespace osu.Game.Rulesets.Osu
} }
public override RulesetSetupSection CreateEditorSetupSection() => new OsuSetupSection(); public override RulesetSetupSection CreateEditorSetupSection() => new OsuSetupSection();
public override double PreemptFromAr(float AR) => AR < 5 ? (1200.0 + 600.0 * (5 - AR) / 5) : (1200.0 - 750.0 * (AR - 5) / 5);
public override float ArFromPreempt(double preempt) => (float)(preempt > 1200 ? ((1800 - preempt) / 120) : ((1200 - preempt) / 150)) + 5;
public override double HitwindowFromOd(float OD) => 80.0 - 6 * OD;
public override float OdFromHitwindow(double hitwindow300) => (float)(80.0 - hitwindow300) / 6;
public override float ChangeArFromRate(float AR, double rate) => ArFromPreempt(PreemptFromAr(AR) / rate);
public override float ChangeOdFromRate(float OD, double rate) => OdFromHitwindow(HitwindowFromOd(OD) / rate);
} }
} }

View File

@ -263,5 +263,8 @@ namespace osu.Game.Rulesets.Taiko
}), true) }), true)
}; };
} }
public override double HitwindowFromOd(float OD) => 35.0 - 15.0 * (OD - 5) / 5;
public override float OdFromHitwindow(double hitwindow300) => (float)(5 * (35 - hitwindow300) / 15 + 5);
public override float ChangeOdFromRate(float OD, double rate) => OdFromHitwindow(HitwindowFromOd(OD) / rate);
} }
} }

View File

@ -389,5 +389,13 @@ namespace osu.Game.Rulesets
/// Can be overridden to alter the difficulty section to the editor beatmap setup screen. /// Can be overridden to alter the difficulty section to the editor beatmap setup screen.
/// </summary> /// </summary>
public virtual DifficultySection? CreateEditorDifficultySection() => null; public virtual DifficultySection? CreateEditorDifficultySection() => null;
public virtual double PreemptFromAr(float AR) => 0;
public virtual float ArFromPreempt(double preempt) => 5;
public virtual double HitwindowFromOd(float OD) => 0;
public virtual float OdFromHitwindow(double hitwindow300) => 0;
public virtual float ChangeArFromRate(float AR, double rate) => AR;
public virtual float ChangeOdFromRate(float OD, double rate) => OD;
} }
} }

View File

@ -133,12 +133,10 @@ namespace osu.Game.Screens.Select.Details
foreach (var mod in mods.Value.OfType<ModRateAdjust>()) foreach (var mod in mods.Value.OfType<ModRateAdjust>())
{ {
double speedChange = (float)mod.SpeedChange.Value; double speedChange = (float)mod.SpeedChange.Value;
Ruleset ruleset = gameRuleset.Value.CreateInstance();
double preempt = (int)IBeatmapDifficultyInfo.DifficultyRange(adjustedDifficulty.ApproachRate, 1800, 1200, 450) / speedChange; adjustedDifficulty.ApproachRate = ruleset.ChangeArFromRate(adjustedDifficulty.ApproachRate, speedChange);
adjustedDifficulty.ApproachRate = (float)(preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5); adjustedDifficulty.OverallDifficulty = ruleset.ChangeOdFromRate(adjustedDifficulty.OverallDifficulty, speedChange);
float hitwindow300 = (80.0f - 6 * adjustedDifficulty.OverallDifficulty) / (float)speedChange;
adjustedDifficulty.OverallDifficulty = (80.0f - hitwindow300) / 6;
} }
} }