Fix Being Drunk! (#41002)

* Drunk moment

* push

* fix test fails + a smidge of cleanup

* two smidges of cleanup

* Unpredicted so don't need the workaround

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Princess Cheeseballs
2025-10-21 13:12:36 -07:00
committed by GitHub
parent 04a2c2e968
commit 4aac3dbc9d
9 changed files with 47 additions and 47 deletions

View File

@@ -27,6 +27,15 @@ public sealed class DrunkOverlay : Overlay
private const float VisualThreshold = 10.0f;
private const float PowerDivisor = 250.0f;
/// <remarks>
/// This is a magic number based on my person preference of how quickly the bloodloss effect should kick in.
/// It is entirely arbitrary, and you should change it if it sucks.
/// Honestly should be refactored to be based on amount of blood lost but that's out of scope for what I'm doing atm.
/// Also caps all booze visual effects to a max intensity of 100 seconds or 100 booze power.
/// </remarks>
private const float MaxBoozePower = 100f;
private const float BoozePowerScale = 8f;
private float _visualScale = 0;
@@ -50,15 +59,9 @@ public sealed class DrunkOverlay : Overlay
var time = status.Item2;
var power = SharedDrunkSystem.MagicNumber;
var power = time == null ? MaxBoozePower : (float) Math.Min((time - _timing.CurTime).Value.TotalSeconds, MaxBoozePower);
if (time != null)
{
var curTime = _timing.CurTime;
power = (float) (time - curTime).Value.TotalSeconds;
}
CurrentBoozePower += 8f * (power * 0.5f - CurrentBoozePower) * args.DeltaSeconds / (power+1);
CurrentBoozePower += BoozePowerScale * (power - CurrentBoozePower) * args.DeltaSeconds / (power+1);
}
protected override bool BeforeDraw(in OverlayDrawArgs args)