Skip to content

Commit

Permalink
Merge pull request #516 from LumpBloom7/accumulating-health-processor
Browse files Browse the repository at this point in the history
Remove health mechanics
  • Loading branch information
LumpBloom7 authored Nov 30, 2023
2 parents 5eb4de1 + eef3195 commit ec13e1c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions osu.Game.Rulesets.Sentakki/Scoring/SentakkiHealthProcessor.cs
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,
};
}
}
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private static readonly Lazy<bool> is_development_build
public override string ShortName => "Sentakki";

public override ScoreProcessor CreateScoreProcessor() => new SentakkiScoreProcessor(this);
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new SentakkiHealthProcessor();

public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod>? mods = null) =>
new DrawableSentakkiRuleset(this, beatmap, mods);
Expand Down

0 comments on commit ec13e1c

Please sign in to comment.