-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from defvs/mods-addition
Mods addition: "No Regen" and "Damage Multiplier"
- Loading branch information
Showing
7 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
osu.Game.Rulesets.Touhosu/Mods/TouhosuModDamageMultiplier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Framework.Localisation; | ||
using osu.Game.Configuration; | ||
using osu.Game.Graphics; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Rulesets.Scoring; | ||
using osu.Game.Rulesets.Touhosu.Scoring; | ||
|
||
namespace osu.Game.Rulesets.Touhosu.Mods | ||
{ | ||
public class TouhosuModDamageMultiplier : Mod, IApplicableToHealthProcessor | ||
{ | ||
public override double ScoreMultiplier => 1.0; | ||
|
||
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 ApplyToHealthProcessor(HealthProcessor healthProcessor) | ||
{ | ||
((TouhosuHealthProcessor)healthProcessor).LossMultiplier = DamageMultiplier.Value; | ||
} | ||
|
||
[SettingSource("Damage increase", "Multiplier to damage taken when hitting a projectile")] | ||
public BindableNumber<double> DamageMultiplier { get; } = new BindableDouble | ||
{ | ||
MinValue = 1.1, | ||
MaxValue = 5, | ||
Default = 3, | ||
Value = 3, | ||
Precision = 0.1 | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Framework.Localisation; | ||
using osu.Game.Graphics; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Rulesets.Scoring; | ||
using osu.Game.Rulesets.Touhosu.Scoring; | ||
|
||
namespace osu.Game.Rulesets.Touhosu.Mods | ||
{ | ||
public class TouhosuModNoRegen : Mod, IApplicableToHealthProcessor | ||
{ | ||
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 => "No health regeneration."; | ||
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; | ||
|
||
public void ApplyToHealthProcessor(HealthProcessor healthProcessor) | ||
{ | ||
((TouhosuHealthProcessor)healthProcessor).NoRegen = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) }; | ||
} | ||
} |
25 changes: 24 additions & 1 deletion
25
osu.Game.Rulesets.Touhosu/Scoring/TouhosuHealthProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters