Skip to content

Commit

Permalink
Add Gori mod
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Aug 23, 2023
1 parent f7c6012 commit 9254edc
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
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

0 comments on commit 9254edc

Please sign in to comment.