67 lines
2.1 KiB
C#
67 lines
2.1 KiB
C#
using LabApi.Features.Wrappers;
|
|
using PlayerRoles.FirstPersonControl;
|
|
using Logger = LabApi.Features.Console.Logger;
|
|
using Random = System.Random;
|
|
|
|
namespace CustomClasses;
|
|
|
|
public class DisableStaminaRegenEffect : CustomPlayerEffect, IStaminaModifier
|
|
{
|
|
public bool StaminaModifierActive => IsEnabled;
|
|
public float StaminaUsageMultiplier => 1;
|
|
|
|
public float StaminaRegenMultiplier => 0;
|
|
public bool SprintingDisabled => false;
|
|
|
|
public override EffectClassification Classification => EffectClassification.Negative;
|
|
}
|
|
|
|
public class BloodFueledStaminaEffect : CustomPlayerEffect, IStaminaModifier
|
|
{
|
|
public bool StaminaModifierActive => IsEnabled;
|
|
public float StaminaUsageMultiplier => 0.1f;
|
|
|
|
public float StaminaRegenMultiplier => 1;
|
|
public bool SprintingDisabled => false;
|
|
|
|
public override EffectClassification Classification => EffectClassification.Positive;
|
|
}
|
|
|
|
public class BloodFueledManager
|
|
{
|
|
private readonly CustomClasses _plugin;
|
|
|
|
public static bool IsBloodFueled(Player player) => player.CustomInfo.Contains("Blood Fueled");
|
|
|
|
public BloodFueledManager(CustomClasses plugin)
|
|
{
|
|
_plugin = plugin;
|
|
|
|
}
|
|
}
|
|
|
|
public class BloodFueledHandler : CustomClassHandler
|
|
{
|
|
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
|
{
|
|
player.SendBroadcast("You are the <color=#6e2e99>Blood Fueled</color>!", CustomClasses.BroadcastDuration);
|
|
const string customInfo = "<color=#A0A0A0>Blood Fueled</color>";
|
|
if (!Player.ValidateCustomInfo(customInfo, out var reason))
|
|
{
|
|
Logger.Error($"Invalid custom info for Blood Fueled: {reason}");
|
|
}
|
|
else
|
|
{
|
|
player.CustomInfo = customInfo;
|
|
player.InfoArea |= PlayerInfoArea.CustomInfo;
|
|
}
|
|
|
|
player.MaxHumeShield = 0;
|
|
player.HumeShield = 0;
|
|
player.MaxHealth = 3500;
|
|
player.Health = 3500;
|
|
|
|
player.EnableEffect<DisableStaminaRegenEffect>(1, float.PositiveInfinity);
|
|
player.EnableEffect<BloodFueledStaminaEffect>(1, float.PositiveInfinity);
|
|
}
|
|
} |