Compare commits
2 Commits
15293ae598
...
18fad25807
Author | SHA1 | Date | |
---|---|---|---|
|
18fad25807 | ||
f839619464 |
@ -1,5 +1,6 @@
|
||||
using LabApi.Events.Handlers;
|
||||
using LabApi.Features.Wrappers;
|
||||
using MEC;
|
||||
using PlayerRoles.FirstPersonControl;
|
||||
using PlayerRoles.PlayableScps.Scp939;
|
||||
using Logger = LabApi.Features.Console.Logger;
|
||||
@ -21,7 +22,7 @@ public class DisableStaminaRegenEffect : CustomPlayerEffect, IStaminaModifier
|
||||
public class BloodFueledStaminaEffect : CustomPlayerEffect, IStaminaModifier
|
||||
{
|
||||
public bool StaminaModifierActive => IsEnabled;
|
||||
public float StaminaUsageMultiplier => 0.1f;
|
||||
public float StaminaUsageMultiplier => 0.2f;
|
||||
|
||||
public float StaminaRegenMultiplier => 1;
|
||||
public bool SprintingDisabled => false;
|
||||
@ -33,7 +34,17 @@ public class BloodFueledManager
|
||||
{
|
||||
private readonly CustomClasses _plugin;
|
||||
|
||||
public static bool IsBloodFueled(Player player) => player.CustomInfo.Contains("Blood Fueled");
|
||||
public static bool IsBloodFueled(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
return player.CustomInfo.Contains("Blood Fueled");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public BloodFueledManager(CustomClasses plugin)
|
||||
{
|
||||
@ -45,14 +56,42 @@ public class BloodFueledManager
|
||||
if (attacker == null) return;
|
||||
if (!IsBloodFueled(attacker)) return;
|
||||
|
||||
|
||||
if (ev.Player.Health <= 0)
|
||||
{
|
||||
attacker.Heal(25);
|
||||
attacker.StaminaRemaining += 0.2f;
|
||||
return;
|
||||
}
|
||||
|
||||
attacker.Heal(15);
|
||||
attacker.StaminaRemaining += 0.1f;
|
||||
};
|
||||
|
||||
Timing.RunCoroutine(DrainBlood());
|
||||
}
|
||||
|
||||
public static IEnumerator<float> DrainBlood()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return Timing.WaitForSeconds(1);
|
||||
foreach (var player in Player.ReadyList.Where(IsBloodFueled))
|
||||
{
|
||||
if (player.StaminaRemaining <= 0f)
|
||||
{
|
||||
player.Health = Math.Min(Math.Max(player.Health - 50, 500), player.Health);
|
||||
continue;
|
||||
}
|
||||
|
||||
player.StaminaRemaining -= 0.005f;
|
||||
|
||||
if (player.MaxHealth <= player.Health) continue;
|
||||
player.Heal(5);
|
||||
player.StaminaRemaining -= 0.001f;
|
||||
}
|
||||
}
|
||||
// ReSharper disable once IteratorNeverReturns
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user