Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gori mod #485

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions osu.Game.Rulesets.Sentakki/Mods/SentakkiModGori.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Framework.Localisation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Configuration;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Framework.Graphics.Sprites;
using System;
using System.ComponentModel;

namespace osu.Game.Rulesets.Sentakki.Mods;

public class SentakkiModGori : Mod, IApplicableToDrawableHitObject
{
public override string Name => "Gori";
public override string Acronym => "GR";

public override bool HasImplementation => true;
public override double ScoreMultiplier => 1;

public override IconUsage? Icon => FontAwesome.Solid.PooStorm;

public override Type[] IncompatibleMods => new Type[]{
typeof(ModAutoplay),
};

// TODO: LOCALISATION
public override LocalisableString Description => "You either hit it right, or you don't hit it at all.";

[SettingSource("Lowest valid hit result", "The minimum HitResult that is accepted during gameplay. Anything below will be considered a miss.")]
public Bindable<SentakkiHitResult> MaxHitResult { get; } = new Bindable<SentakkiHitResult>(SentakkiHitResult.Perfect);

public void ApplyToDrawableHitObject(DrawableHitObject drawable)
{
if (drawable is DrawableSentakkiHitObject d)
d.MinimumAcceptedHitResult = (HitResult)MaxHitResult.Value;
}

public enum SentakkiHitResult
{
Great = 4,
Perfect = 5,
[Description("Critical Perfect")] Critical = 6,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Sentakki.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Sentakki.Judgements;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables
{
Expand Down Expand Up @@ -54,9 +56,28 @@ protected override void OnApply()
AccentColour.BindTo(HitObject.ColourBindable);
}

public HitResult MinimumAcceptedHitResult = HitResult.None;

protected void ApplyResult(HitResult result)
{
void resultApplication(JudgementResult r) => r.Type = result;

// SentakkiModGori turns subpar judgements into misses
if (Result.Judgement is SentakkiJudgement)
{
if (MinimumAcceptedHitResult == HitResult.Perfect) // using the Perfect result to represent Crits
{
double absTimeOffset = Math.Abs(Time.Current - HitObject.GetEndTime());

if (absTimeOffset > 16)
result = Result.Judgement.MinResult;
}
else if (result < MinimumAcceptedHitResult)
{
result = Result.Judgement.MinResult;
}
}

ApplyResult(resultApplication);
}

Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new SentakkiModHardRock(),
new MultiMod(new SentakkiModSuddenDeath(), new SentakkiModPerfect()),
new MultiMod(new SentakkiModChallenge(), new SentakkiModAccuracyChallenge()),
new SentakkiModGori(),
new MultiMod(new SentakkiModDoubleTime(), new SentakkiModNightcore()),
new SentakkiModHidden(),
};
Expand Down
Loading