From 0c95459f3192834117743c6439097183c36f79f4 Mon Sep 17 00:00:00 2001 From: Carlos Pinto Date: Thu, 3 Nov 2022 21:15:24 +0000 Subject: [PATCH 1/2] add trustworthy mod --- .../Beatmaps/HishigataBeatmapConverter.cs | 9 ++++++- .../HishigataRuleset.cs | 6 +++++ .../Mods/HishigataModTrustworthyStrings.cs | 16 +++++++++++ .../Mods/HishigataModTrustworthy.cs | 27 +++++++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Hishigata/Localisation/Mods/HishigataModTrustworthyStrings.cs create mode 100644 osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs diff --git a/osu.Game.Rulesets.Hishigata/Beatmaps/HishigataBeatmapConverter.cs b/osu.Game.Rulesets.Hishigata/Beatmaps/HishigataBeatmapConverter.cs index 262e17c..cfb16ee 100644 --- a/osu.Game.Rulesets.Hishigata/Beatmaps/HishigataBeatmapConverter.cs +++ b/osu.Game.Rulesets.Hishigata/Beatmaps/HishigataBeatmapConverter.cs @@ -24,6 +24,9 @@ public HishigataBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) // https://github.com/ppy/osu/tree/master/osu.Game/Rulesets/Objects/Types public override bool CanConvert() => Beatmap.HitObjects.All(x => x is IHasPosition); + // trustworthy mod + public bool FeignsAllowed { get; set; } = true; + protected override IEnumerable ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken) { var difficulty = beatmap.BeatmapInfo.Difficulty; @@ -34,7 +37,11 @@ protected override IEnumerable ConvertHitObject(HitObject or float angle = getHitObjectAngle(position) / 90; int lane = (int)Math.Round(angle); - bool isFeign = original.Samples.Any(x => x.Name == HitSampleInfo.HIT_WHISTLE); + bool isFeign = false; + if (FeignsAllowed) + { + isFeign = original.Samples.Any(x => x.Name == HitSampleInfo.HIT_WHISTLE); + } if (lane >= 4) lane -= 4; switch (original) diff --git a/osu.Game.Rulesets.Hishigata/HishigataRuleset.cs b/osu.Game.Rulesets.Hishigata/HishigataRuleset.cs index 2f0407f..24b28a5 100644 --- a/osu.Game.Rulesets.Hishigata/HishigataRuleset.cs +++ b/osu.Game.Rulesets.Hishigata/HishigataRuleset.cs @@ -64,6 +64,12 @@ public override IEnumerable GetModsFor(ModType type) new HishigataModAutoplay(), }; + case ModType.Conversion: + return new Mod[] + { + new HishigataModTrustworthy(), + }; + case ModType.Fun: return new Mod[] { diff --git a/osu.Game.Rulesets.Hishigata/Localisation/Mods/HishigataModTrustworthyStrings.cs b/osu.Game.Rulesets.Hishigata/Localisation/Mods/HishigataModTrustworthyStrings.cs new file mode 100644 index 0000000..b2388c8 --- /dev/null +++ b/osu.Game.Rulesets.Hishigata/Localisation/Mods/HishigataModTrustworthyStrings.cs @@ -0,0 +1,16 @@ +using osu.Framework.Localisation; + +namespace osu.Game.Rulesets.Hishigata.Localisation.Mods +{ + public static class HishigataModTrustworthyStrings + { + private const string prefix = @"osu.Game.Rulesets.Hishigata.Resources.Localisation.Mods.HishigataModTrustworthyStrings"; + + /// + /// "Notes don't switch sides." + /// + public static LocalisableString ModDescription => new TranslatableString(getKey(@"mod_description"), @"Notes don't switch sides."); + + private static string getKey(string key) => $"{prefix}:{key}"; + } +} diff --git a/osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs b/osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs new file mode 100644 index 0000000..053544b --- /dev/null +++ b/osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs @@ -0,0 +1,27 @@ +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Hishigata.Localisation.Mods; +using osu.Game.Rulesets.Hishigata.Beatmaps; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Rulesets.Hishigata.Mods +{ + public class HishigataModTrustworthy : Mod, IApplicableToBeatmapConverter + { + public override string Name => "Trustworthy"; + public override string Acronym => "TW"; + public override LocalisableString Description => HishigataModTrustworthyStrings.ModDescription; + public override double ScoreMultiplier => 0.8; + public override ModType Type => ModType.Conversion; + //public override bool UserPlayable => true; + public override IconUsage? Icon => FontAwesome.Solid.Check; + //public override bool HasImplementation => true; + + public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter) + { + var converter = (HishigataBeatmapConverter)beatmapConverter; + converter.FeignsAllowed = false; + } + } +} From 495ad75a21c724b20e41d4d6804700fa768c4aae Mon Sep 17 00:00:00 2001 From: Carlos Pinto Date: Thu, 3 Nov 2022 21:59:07 +0000 Subject: [PATCH 2/2] add resx file for trustworthy mod and delete a couple of unusued commented lines --- .../Mods/HishigataModTrustworthy.cs | 2 - .../Mods/HishigataModTrustworthyStrings.resx | 64 +++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Hishigata/Resources/Localisation/Mods/HishigataModTrustworthyStrings.resx diff --git a/osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs b/osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs index 053544b..cd6612c 100644 --- a/osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs +++ b/osu.Game.Rulesets.Hishigata/Mods/HishigataModTrustworthy.cs @@ -14,9 +14,7 @@ public class HishigataModTrustworthy : Mod, IApplicableToBeatmapConverter public override LocalisableString Description => HishigataModTrustworthyStrings.ModDescription; public override double ScoreMultiplier => 0.8; public override ModType Type => ModType.Conversion; - //public override bool UserPlayable => true; public override IconUsage? Icon => FontAwesome.Solid.Check; - //public override bool HasImplementation => true; public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter) { diff --git a/osu.Game.Rulesets.Hishigata/Resources/Localisation/Mods/HishigataModTrustworthyStrings.resx b/osu.Game.Rulesets.Hishigata/Resources/Localisation/Mods/HishigataModTrustworthyStrings.resx new file mode 100644 index 0000000..6e5d0e5 --- /dev/null +++ b/osu.Game.Rulesets.Hishigata/Resources/Localisation/Mods/HishigataModTrustworthyStrings.resx @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Notes don't switch sides. + +