From 6f44bea14388b7b533a3121303ec6e894ea9ea5f Mon Sep 17 00:00:00 2001 From: Daniel Thirion Date: Mon, 5 Sep 2022 19:43:26 +0200 Subject: [PATCH 1/7] Bump ppy.osu.Game from 2022.810.2 to 2022.902.2 --- osu.Game.Rulesets.Touhosu/osu.Game.Rulesets.Touhosu.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Touhosu/osu.Game.Rulesets.Touhosu.csproj b/osu.Game.Rulesets.Touhosu/osu.Game.Rulesets.Touhosu.csproj index f577032..1bbf591 100644 --- a/osu.Game.Rulesets.Touhosu/osu.Game.Rulesets.Touhosu.csproj +++ b/osu.Game.Rulesets.Touhosu/osu.Game.Rulesets.Touhosu.csproj @@ -11,6 +11,6 @@ - + \ No newline at end of file From 83f529dc93f94e31ceb5678ba6fbe26bea75db95 Mon Sep 17 00:00:00 2001 From: Daniel Thirion Date: Mon, 5 Sep 2022 19:44:10 +0200 Subject: [PATCH 2/7] Fix breaking changes in mods Description by using LocalisableString --- osu.Game.Rulesets.Touhosu/Mods/TouhosuModEasy.cs | 5 +++-- osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModEasy.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModEasy.cs index 9b2ef78..20c93e1 100644 --- a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModEasy.cs +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModEasy.cs @@ -1,9 +1,10 @@ -using osu.Game.Rulesets.Mods; +using osu.Framework.Localisation; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Touhosu.Mods { public class TouhosuModEasy : ModEasy { - public override string Description => @"Smaller bullets, more forgiving HP drain and three lives!"; + public override LocalisableString Description => @"Smaller bullets, more forgiving HP drain and three lives!"; } } diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs index 0ebd642..7f2fdf2 100644 --- a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs @@ -1,4 +1,5 @@ -using osu.Game.Rulesets.Touhosu.Objects.Drawables; +using osu.Framework.Localisation; +using osu.Game.Rulesets.Touhosu.Objects.Drawables; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; @@ -8,7 +9,7 @@ public class TouhosuModHidden : ModHidden { public override double ScoreMultiplier => 1.06; - public override string Description => "Bullets will become invisible near you."; + public override LocalisableString Description => "Bullets will become invisible near you."; public override void ApplyToDrawableHitObject(DrawableHitObject dho) { From 41d9027cbb2b85ea1ab2997bca0fd4cc33551a2a Mon Sep 17 00:00:00 2001 From: Daniel Thirion Date: Mon, 5 Sep 2022 19:44:33 +0200 Subject: [PATCH 3/7] Import cleanup in TouhosuPlayfield.cs --- osu.Game.Rulesets.Touhosu/UI/TouhosuPlayfield.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Touhosu/UI/TouhosuPlayfield.cs b/osu.Game.Rulesets.Touhosu/UI/TouhosuPlayfield.cs index 624392f..3f6d185 100644 --- a/osu.Game.Rulesets.Touhosu/UI/TouhosuPlayfield.cs +++ b/osu.Game.Rulesets.Touhosu/UI/TouhosuPlayfield.cs @@ -13,7 +13,6 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Touhosu.Objects; using osu.Game.Rulesets.Touhosu.Objects.Drawables; -using osu.Game.Rulesets.Touhosu.Extensions; namespace osu.Game.Rulesets.Touhosu.UI { From 0f5f390681174c3cdad21c3fee75f5d57739a3a6 Mon Sep 17 00:00:00 2001 From: Daniel Thirion Date: Mon, 5 Sep 2022 22:00:32 +0200 Subject: [PATCH 4/7] Add mods "No Regen" and "Damage Multiplier" --- .../Judgements/TouhosuJudgement.cs | 13 +++-- .../Mods/TouhosuModDamageMultiplier.cs | 56 +++++++++++++++++++ .../Mods/TouhosuModNoRegen.cs | 42 ++++++++++++++ .../Objects/AngeledProjectile.cs | 11 +++- osu.Game.Rulesets.Touhosu/TouhosuRuleset.cs | 2 + 5 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs create mode 100644 osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs diff --git a/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs b/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs index c31e91e..147d60b 100644 --- a/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs +++ b/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs @@ -5,14 +5,19 @@ namespace osu.Game.Rulesets.Touhosu.Judgements { public class TouhosuJudgement : Judgement { + public double MissHealthIncrease = -0.1; + public double PerfectHealthIncrease = 0.0002f; + public override HitResult MaxResult => HitResult.Perfect; protected override double HealthIncreaseFor(HitResult result) { - if (result == HitResult.Perfect) - return 0.0002f; - - return base.HealthIncreaseFor(result); + return result switch + { + HitResult.Perfect => PerfectHealthIncrease, + HitResult.Miss => MissHealthIncrease, + _ => base.HealthIncreaseFor(result) + }; } } } diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs new file mode 100644 index 0000000..3ab37ed --- /dev/null +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs @@ -0,0 +1,56 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using osu.Framework.Bindables; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Touhosu.Beatmaps; +using osu.Game.Rulesets.Touhosu.Objects; + +namespace osu.Game.Rulesets.Touhosu.Mods +{ + public class TouhosuModDamageMultiplier : Mod, IApplicableToBeatmap + { + public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.2 : 1; + + public override string Name => "Damage Multiplier"; + public override string Acronym => "DM"; + public override IconUsage? Icon => OsuIcon.ModHardRock; + public override ModType Type => ModType.DifficultyIncrease; + public override LocalisableString Description => "Bullet hits hurt more!"; + public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; + + public void ApplyToBeatmap(IBeatmap beatmap) + { + var touhosuBeatmap = (TouhosuBeatmap)beatmap; + + if (touhosuBeatmap.HitObjects.Count == 0) return; + + var hitObjects = touhosuBeatmap.HitObjects.Select(ho => + { + if (!(ho is AngeledProjectile projectile)) return ho; + + projectile.MissHealthIncrease *= DamageMultiplier.Value; + return projectile; + } + ).ToList(); + touhosuBeatmap.HitObjects = hitObjects; + } + + [SettingSource("Damage increase", "Multiplier to damage taken when hitting a projectile")] + public BindableNumber DamageMultiplier { get; } = new BindableDouble + { + MinValue = 1.1, + MaxValue = 5, + Default = 3, + Value = 3, + Precision = 0.1 + }; + } +} diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs new file mode 100644 index 0000000..689021f --- /dev/null +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs @@ -0,0 +1,42 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Touhosu.Beatmaps; +using osu.Game.Rulesets.Touhosu.Objects; + +namespace osu.Game.Rulesets.Touhosu.Mods +{ + public class TouhosuModNoRegen : Mod, IApplicableToBeatmap + { + public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.3 : 1; + + public override string Name => "No Regen"; + public override string Acronym => "NR"; + public override IconUsage? Icon => OsuIcon.HeartBreak; + public override ModType Type => ModType.DifficultyIncrease; + public override LocalisableString Description => "You cannot regenerate health."; + + public void ApplyToBeatmap(IBeatmap beatmap) + { + var touhosuBeatmap = (TouhosuBeatmap)beatmap; + + if (touhosuBeatmap.HitObjects.Count == 0) return; + + var hitObjects = touhosuBeatmap.HitObjects.Select(ho => + { + if (!(ho is AngeledProjectile projectile)) return ho; + + projectile.PerfectHealthIncrease = 0; + return projectile; + } + ).ToList(); + touhosuBeatmap.HitObjects = hitObjects; + } + } +} diff --git a/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs b/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs index ccef549..49bd277 100644 --- a/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs +++ b/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs @@ -6,7 +6,10 @@ namespace osu.Game.Rulesets.Touhosu.Objects { public class AngeledProjectile : ConstantMovingProjectile { - public readonly Bindable AngleBindable = new Bindable(); + public Bindable AngleBindable = new Bindable(); + + public double MissHealthIncrease = -0.1; + public double PerfectHealthIncrease = 0.0002f; public float Angle { @@ -14,6 +17,10 @@ public float Angle set => AngleBindable.Value = value; } - public override Judgement CreateJudgement() => new TouhosuJudgement(); + public override Judgement CreateJudgement() => new TouhosuJudgement() + { + MissHealthIncrease = MissHealthIncrease, + PerfectHealthIncrease = PerfectHealthIncrease + }; } } diff --git a/osu.Game.Rulesets.Touhosu/TouhosuRuleset.cs b/osu.Game.Rulesets.Touhosu/TouhosuRuleset.cs index 821e57a..a5875a4 100644 --- a/osu.Game.Rulesets.Touhosu/TouhosuRuleset.cs +++ b/osu.Game.Rulesets.Touhosu/TouhosuRuleset.cs @@ -73,6 +73,8 @@ public override IEnumerable GetModsFor(ModType type) case ModType.DifficultyIncrease: return new Mod[] { + new TouhosuModDamageMultiplier(), + new TouhosuModNoRegen(), new TouhosuModSuddenDeath(), new MultiMod(new TouhosuModDoubleTime(), new TouhosuModNightcore()), new TouhosuModHidden() From 3e9d45fbb681ee6f46a7f31d7842fa85fb890d47 Mon Sep 17 00:00:00 2001 From: Daniel Thirion Date: Mon, 5 Sep 2022 23:40:57 +0200 Subject: [PATCH 5/7] Add NoRegen / DamageMultiplier incompatibility to SuddenDeath --- osu.Game.Rulesets.Touhosu/Mods/TouhosuModSuddenDeath.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModSuddenDeath.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModSuddenDeath.cs index bad7841..8e70095 100644 --- a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModSuddenDeath.cs +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModSuddenDeath.cs @@ -1,8 +1,10 @@ -using osu.Game.Rulesets.Mods; +using System; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Touhosu.Mods { public class TouhosuModSuddenDeath : ModSuddenDeath { + public override Type[] IncompatibleMods => new[] { typeof(TouhosuModNoRegen), typeof(TouhosuModDamageMultiplier) }; } } From 84401cf30948d9d6c44622810e810f2503280996 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 20 Sep 2022 19:15:05 +0300 Subject: [PATCH 6/7] Removed not needed using --- osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs index 358fd62..7f2fdf2 100644 --- a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModHidden.cs @@ -2,7 +2,6 @@ using osu.Game.Rulesets.Touhosu.Objects.Drawables; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; -using osu.Framework.Localisation; namespace osu.Game.Rulesets.Touhosu.Mods { From 1d0feb956a3e9f2117eabf8dbbd0fc2f17a0881e Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 20 Sep 2022 19:38:29 +0300 Subject: [PATCH 7/7] Improve health changes handling --- .../Judgements/TouhosuJudgement.cs | 13 +++---- .../Mods/TouhosuModDamageMultiplier.cs | 31 ++++------------- .../Mods/TouhosuModNoRegen.cs | 34 +++++-------------- .../Objects/AngeledProjectile.cs | 11 ++---- .../Scoring/TouhosuHealthProcessor.cs | 25 +++++++++++++- 5 files changed, 46 insertions(+), 68 deletions(-) diff --git a/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs b/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs index 147d60b..c31e91e 100644 --- a/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs +++ b/osu.Game.Rulesets.Touhosu/Judgements/TouhosuJudgement.cs @@ -5,19 +5,14 @@ namespace osu.Game.Rulesets.Touhosu.Judgements { public class TouhosuJudgement : Judgement { - public double MissHealthIncrease = -0.1; - public double PerfectHealthIncrease = 0.0002f; - public override HitResult MaxResult => HitResult.Perfect; protected override double HealthIncreaseFor(HitResult result) { - return result switch - { - HitResult.Perfect => PerfectHealthIncrease, - HitResult.Miss => MissHealthIncrease, - _ => base.HealthIncreaseFor(result) - }; + if (result == HitResult.Perfect) + return 0.0002f; + + return base.HealthIncreaseFor(result); } } } diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs index 3ab37ed..a510487 100644 --- a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs @@ -1,23 +1,18 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Linq; +using System; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; -using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Touhosu.Beatmaps; -using osu.Game.Rulesets.Touhosu.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Touhosu.Scoring; namespace osu.Game.Rulesets.Touhosu.Mods { - public class TouhosuModDamageMultiplier : Mod, IApplicableToBeatmap + public class TouhosuModDamageMultiplier : Mod, IApplicableToHealthProcessor { - public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.2 : 1; + public override double ScoreMultiplier => 1.0; public override string Name => "Damage Multiplier"; public override string Acronym => "DM"; @@ -26,21 +21,9 @@ public class TouhosuModDamageMultiplier : Mod, IApplicableToBeatmap public override LocalisableString Description => "Bullet hits hurt more!"; public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; - public void ApplyToBeatmap(IBeatmap beatmap) + public void ApplyToHealthProcessor(HealthProcessor healthProcessor) { - var touhosuBeatmap = (TouhosuBeatmap)beatmap; - - if (touhosuBeatmap.HitObjects.Count == 0) return; - - var hitObjects = touhosuBeatmap.HitObjects.Select(ho => - { - if (!(ho is AngeledProjectile projectile)) return ho; - - projectile.MissHealthIncrease *= DamageMultiplier.Value; - return projectile; - } - ).ToList(); - touhosuBeatmap.HitObjects = hitObjects; + ((TouhosuHealthProcessor)healthProcessor).LossMultiplier = DamageMultiplier.Value; } [SettingSource("Damage increase", "Multiplier to damage taken when hitting a projectile")] diff --git a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs index 689021f..d399a18 100644 --- a/osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs +++ b/osu.Game.Rulesets.Touhosu/Mods/TouhosuModNoRegen.cs @@ -1,42 +1,26 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.Linq; +using System; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; -using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Touhosu.Beatmaps; -using osu.Game.Rulesets.Touhosu.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Touhosu.Scoring; namespace osu.Game.Rulesets.Touhosu.Mods { - public class TouhosuModNoRegen : Mod, IApplicableToBeatmap + public class TouhosuModNoRegen : Mod, IApplicableToHealthProcessor { - public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.3 : 1; - + public override double ScoreMultiplier => 1.0; public override string Name => "No Regen"; public override string Acronym => "NR"; public override IconUsage? Icon => OsuIcon.HeartBreak; public override ModType Type => ModType.DifficultyIncrease; - public override LocalisableString Description => "You cannot regenerate health."; + public override LocalisableString Description => "No health regeneration."; + public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; - public void ApplyToBeatmap(IBeatmap beatmap) + public void ApplyToHealthProcessor(HealthProcessor healthProcessor) { - var touhosuBeatmap = (TouhosuBeatmap)beatmap; - - if (touhosuBeatmap.HitObjects.Count == 0) return; - - var hitObjects = touhosuBeatmap.HitObjects.Select(ho => - { - if (!(ho is AngeledProjectile projectile)) return ho; - - projectile.PerfectHealthIncrease = 0; - return projectile; - } - ).ToList(); - touhosuBeatmap.HitObjects = hitObjects; + ((TouhosuHealthProcessor)healthProcessor).NoRegen = true; } } } diff --git a/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs b/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs index 49bd277..ccef549 100644 --- a/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs +++ b/osu.Game.Rulesets.Touhosu/Objects/AngeledProjectile.cs @@ -6,10 +6,7 @@ namespace osu.Game.Rulesets.Touhosu.Objects { public class AngeledProjectile : ConstantMovingProjectile { - public Bindable AngleBindable = new Bindable(); - - public double MissHealthIncrease = -0.1; - public double PerfectHealthIncrease = 0.0002f; + public readonly Bindable AngleBindable = new Bindable(); public float Angle { @@ -17,10 +14,6 @@ public float Angle set => AngleBindable.Value = value; } - public override Judgement CreateJudgement() => new TouhosuJudgement() - { - MissHealthIncrease = MissHealthIncrease, - PerfectHealthIncrease = PerfectHealthIncrease - }; + public override Judgement CreateJudgement() => new TouhosuJudgement(); } } diff --git a/osu.Game.Rulesets.Touhosu/Scoring/TouhosuHealthProcessor.cs b/osu.Game.Rulesets.Touhosu/Scoring/TouhosuHealthProcessor.cs index fabb06d..10c8a35 100644 --- a/osu.Game.Rulesets.Touhosu/Scoring/TouhosuHealthProcessor.cs +++ b/osu.Game.Rulesets.Touhosu/Scoring/TouhosuHealthProcessor.cs @@ -1,8 +1,31 @@ -using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Touhosu.Scoring { public class TouhosuHealthProcessor : HealthProcessor { + public bool NoRegen { get; set; } + + public double LossMultiplier { get; set; } = 1.0; + + protected override double GetHealthIncreaseFor(JudgementResult result) + { + double adjustment = 1.0; + + switch (result.Type) + { + case HitResult.Perfect: + if (NoRegen) + adjustment = 0; + break; + + case HitResult.Miss: + adjustment *= LossMultiplier; + break; + } + + return base.GetHealthIncreaseFor(result) * adjustment; + } } }