1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 15:27:30 +08:00

Implement taiko relax mod

This commit is contained in:
Bartłomiej Dach 2024-06-13 14:49:56 +02:00
parent 173f195834
commit d7997cc93c
No known key found for this signature in database
3 changed files with 30 additions and 4 deletions

View File

@ -5,13 +5,34 @@ using System;
using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
namespace osu.Game.Rulesets.Taiko.Mods
{
public class TaikoModRelax : ModRelax
public class TaikoModRelax : ModRelax, IApplicableToDrawableHitObject
{
public override LocalisableString Description => @"No ninja-like spinners, demanding drumrolls or unexpected katus.";
public override LocalisableString Description => @"No need to remember which key is correct anymore!";
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(TaikoModSingleTap) }).ToArray();
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
{
var allActions = Enum.GetValues<TaikoAction>();
drawable.HitObjectApplied += dho =>
{
switch (dho)
{
case DrawableHit hit:
hit.HitActions = allActions;
break;
case DrawableSwell swell:
swell.MustAlternate = false;
break;
}
};
}
}
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// <summary>
/// A list of keys which can result in hits for this HitObject.
/// </summary>
public TaikoAction[] HitActions { get; private set; }
public TaikoAction[] HitActions { get; internal set; }
/// <summary>
/// The action that caused this <see cref="DrawableHit"/> to be hit.

View File

@ -43,6 +43,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public override bool DisplayResult => false;
/// <summary>
/// Whether the player must alternate centre and rim hits.
/// </summary>
public bool MustAlternate { get; internal set; } = true;
public DrawableSwell()
: this(null)
{
@ -292,7 +297,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
bool isCentre = e.Action == TaikoAction.LeftCentre || e.Action == TaikoAction.RightCentre;
// Ensure alternating centre and rim hits
if (lastWasCentre == isCentre)
if (lastWasCentre == isCentre && MustAlternate)
return false;
// If we've already successfully judged a tick this frame, do not judge more.