-
-
Notifications
You must be signed in to change notification settings - Fork 20
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 #516 from LumpBloom7/accumulating-health-processor
Remove health mechanics
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
osu.Game.Rulesets.Sentakki/Scoring/SentakkiHealthProcessor.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,37 @@ | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Rulesets.Judgements; | ||
using osu.Game.Rulesets.Scoring; | ||
|
||
namespace osu.Game.Rulesets.Sentakki.Scoring; | ||
|
||
public partial class SentakkiHealthProcessor : AccumulatingHealthProcessor | ||
{ | ||
public SentakkiHealthProcessor() : base(0) | ||
{ | ||
} | ||
|
||
private float healthMultiplier = 0; | ||
|
||
public override void ApplyBeatmap(IBeatmap beatmap) | ||
{ | ||
base.ApplyBeatmap(beatmap); | ||
float maxHP = 0; | ||
foreach (var ho in EnumerateHitObjects(beatmap)) | ||
maxHP += healthForResult(ho.CreateJudgement().MaxResult); | ||
|
||
healthMultiplier = 1 / maxHP; | ||
} | ||
|
||
protected override double GetHealthIncreaseFor(JudgementResult result) => healthForResult(result.Type) * healthMultiplier; | ||
|
||
private static float healthForResult(HitResult result) | ||
{ | ||
return result switch | ||
{ | ||
HitResult.Great => 1, | ||
HitResult.Good => 2 / 3f, | ||
HitResult.Ok => 1 / 3f, | ||
_ => 0, | ||
}; | ||
} | ||
} |
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