-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hurt the player if in the same lane as a missed hitobject
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,11 +1,53 @@ | ||
// Copyright (c) Shane Woolcock. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Game.Rulesets.Judgements; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Rulesets.Rush.Objects; | ||
using osu.Game.Rulesets.Rush.UI; | ||
using osu.Game.Rulesets.Scoring; | ||
|
||
namespace osu.Game.Rulesets.Rush.Scoring | ||
{ | ||
public class RushHealthProcessor : HealthProcessor | ||
{ | ||
private const float sawblade_points = -20f; | ||
private const float minion_points = -10f; | ||
private const float orb_points = -10f; | ||
private const float miniboss_points = -10f; | ||
private const float heart_points = 50f; | ||
|
||
public double PlayerHealthPercentage { get; } | ||
|
||
private double healthForPoints(double points) => points / PlayerHealthPercentage; | ||
|
||
[Resolved] | ||
private DrawableRushRuleset drawableRushRuleset { get; set; } | ||
|
||
public RushHealthProcessor(double playerHealthPercentage = 100f) | ||
{ | ||
PlayerHealthPercentage = playerHealthPercentage; | ||
} | ||
|
||
protected override double GetHealthIncreaseFor(JudgementResult result) | ||
{ | ||
if (result.IsHit) | ||
{ | ||
// TODO: handle hearts | ||
return 0; | ||
} | ||
|
||
return result.HitObject switch | ||
{ | ||
Sawblade _ => healthForPoints(sawblade_points), | ||
Minion _ when collidesWith(result.HitObject) => healthForPoints(minion_points), | ||
Orb _ when collidesWith(result.HitObject) => healthForPoints(orb_points), | ||
MiniBoss _ => healthForPoints(miniboss_points), | ||
_ => 0 | ||
}; | ||
} | ||
|
||
private bool collidesWith(HitObject hitObject) => drawableRushRuleset.Playfield.PlayerSprite.CollidesWith(hitObject); | ||
} | ||
} |
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