review modifications: change xmldoc wording, configure with enum instead of bool, declare incompatibility with hr

This commit is contained in:
Gabe Livengood 2021-07-26 17:48:03 -04:00
parent 49160e4482
commit c7c261ba03
No known key found for this signature in database
GPG Key ID: 70321B78DAECE683
3 changed files with 29 additions and 12 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -16,6 +17,8 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public override double ScoreMultiplier => 1.06; public override double ScoreMultiplier => 1.06;
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust), typeof(ModMirror) };
public void ApplyToHitObject(HitObject hitObject) public void ApplyToHitObject(HitObject hitObject)
{ {
var osuObject = (OsuHitObject)hitObject; var osuObject = (OsuHitObject)hitObject;

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq; using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -17,21 +18,34 @@ namespace osu.Game.Rulesets.Osu.Mods
public class OsuModMirror : ModMirror, IApplicableToHitObject public class OsuModMirror : ModMirror, IApplicableToHitObject
{ {
public override string Description => "Reflect the playfield."; public override string Description => "Reflect the playfield.";
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
[SettingSource("Reflect Horizontally", "Reflect the playfield horizontally.")] [SettingSource("Reflection", "Change the type of reflection.")]
public Bindable<bool> ReflectY { get; } = new BindableBool(true); public Bindable<MirrorType> Reflection { get; } = new Bindable<MirrorType>();
[SettingSource("Reflect Vertically", "Reflect the playfield vertically.")]
public Bindable<bool> ReflectX { get; } = new BindableBool(false);
public void ApplyToHitObject(HitObject hitObject) public void ApplyToHitObject(HitObject hitObject)
{ {
if (!(ReflectY.Value || ReflectX.Value))
return; // TODO deselect the mod if possible so replays and submissions don't have purposeless mods attached.
var osuObject = (OsuHitObject)hitObject; var osuObject = (OsuHitObject)hitObject;
if (ReflectY.Value) switch (Reflection.Value)
OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject); {
if (ReflectX.Value) case MirrorType.Horizontal:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject); OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject);
break;
case MirrorType.Vertical:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject);
break;
case MirrorType.Both:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject);
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject);
break;
}
}
public enum MirrorType
{
Horizontal,
Vertical,
Both
} }
} }
} }

View File

@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.Utils
} }
/// <summary> /// <summary>
/// Reflects an OsuHitObject's position horizontally (over the 'y axis'). /// Reflects an OsuHitObject's position horizontally.
/// </summary> /// </summary>
/// <param name="osuObject">The OsuHitObject to be reflected.</param> /// <param name="osuObject">The OsuHitObject to be reflected.</param>
/// <returns>The reflected OsuHitObject.</returns> /// <returns>The reflected OsuHitObject.</returns>
@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Utils
} }
/// <summary> /// <summary>
/// Reflects an OsuHitObject's position vertically (over the 'x axis'). /// Reflects an OsuHitObject's position vertically.
/// </summary> /// </summary>
/// <param name="osuObject">The OsuHitObject to be reflected.</param> /// <param name="osuObject">The OsuHitObject to be reflected.</param>
/// <returns>The reflected OsuHitObject.</returns> /// <returns>The reflected OsuHitObject.</returns>