improve bloodfueled & serpents
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
using CustomPlayerEffects;
|
||||
using InventorySystem.Items.Usables.Scp330;
|
||||
using LabApi.Events.Handlers;
|
||||
using LabApi.Features.Wrappers;
|
||||
using MEC;
|
||||
using PlayerRoles.FirstPersonControl;
|
||||
using PlayerRoles.PlayableScps.Scp939;
|
||||
using static LabApi.Features.Wrappers.Server;
|
||||
using Logger = LabApi.Features.Console.Logger;
|
||||
using Random = System.Random;
|
||||
|
||||
@@ -32,8 +35,6 @@ public class BloodFueledStaminaEffect : CustomPlayerEffect, IStaminaModifier
|
||||
|
||||
public class BloodFueledManager
|
||||
{
|
||||
private readonly CustomClasses _plugin;
|
||||
|
||||
public static bool IsBloodFueled(Player player)
|
||||
{
|
||||
try
|
||||
@@ -46,9 +47,8 @@ public class BloodFueledManager
|
||||
}
|
||||
}
|
||||
|
||||
public BloodFueledManager(CustomClasses plugin)
|
||||
public BloodFueledManager()
|
||||
{
|
||||
_plugin = plugin;
|
||||
PlayerEvents.Hurt += ev =>
|
||||
{
|
||||
if (ev.DamageHandler is not Scp939DamageHandler damageHandler) return;
|
||||
@@ -56,6 +56,13 @@ public class BloodFueledManager
|
||||
if (attacker == null) return;
|
||||
if (!IsBloodFueled(attacker)) return;
|
||||
|
||||
var isAffectedByBloodCloud = Scp939AmnesticCloudInstance.ActiveInstances.Where(x=>x.Owner && x.Owner == ev.Attacker?.ReferenceHub).Any(x=>x.AffectedPlayers.Contains(ev.Player.ReferenceHub));
|
||||
|
||||
if (isAffectedByBloodCloud)
|
||||
{
|
||||
attacker.Heal(10);
|
||||
attacker.StaminaRemaining += 0.1f;
|
||||
}
|
||||
|
||||
if (ev.Player.Health <= 0)
|
||||
{
|
||||
@@ -69,6 +76,34 @@ public class BloodFueledManager
|
||||
};
|
||||
|
||||
Timing.RunCoroutine(DrainBlood());
|
||||
|
||||
PlayerEvents.EnteringHazard += ev =>
|
||||
{
|
||||
if (ev.Hazard is not AmnesticCloudHazard amnesticCloud) return;
|
||||
if (amnesticCloud.Owner == null || !IsBloodFueled(amnesticCloud.Owner)) return;
|
||||
|
||||
ev.Player.EnableEffect<Invigorated>(1, float.PositiveInfinity);
|
||||
};
|
||||
|
||||
PlayerEvents.StayingInHazard += ev =>
|
||||
{
|
||||
if (ev.Hazard is not AmnesticCloudHazard amnesticCloud) return;
|
||||
if (amnesticCloud.Owner == null || !IsBloodFueled(amnesticCloud.Owner)) return;
|
||||
|
||||
foreach (var affectedPlayer in ev.AffectedPlayers)
|
||||
{
|
||||
// ReSharper disable once PossibleLossOfFraction
|
||||
affectedPlayer.Heal(10 / MaxTps);
|
||||
}
|
||||
};
|
||||
|
||||
PlayerEvents.LeavingHazard += ev =>
|
||||
{
|
||||
if (ev.Hazard is not AmnesticCloudHazard amnesticCloud) return;
|
||||
if (amnesticCloud.Owner == null || !IsBloodFueled(amnesticCloud.Owner)) return;
|
||||
|
||||
ev.Player.DisableEffect<Invigorated>();
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerator<float> DrainBlood()
|
||||
@@ -99,8 +134,8 @@ 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>";
|
||||
player.SendBroadcast("You are SCP-939-<color=#C50000>Blood Fueled</color> \n Your stamina bar has been replaced by a <color=#C50000>blood meter</color>. \n You refill it by <color=#C50000>damaging</color> or <color=#C50000>killing</color> Humans. \n <color=#C50000><b>Don't let it run out.</color></b>", CustomClasses.BroadcastDuration);
|
||||
const string customInfo = "<color=#C50000>Blood Fueled</color>";
|
||||
if (!Player.ValidateCustomInfo(customInfo, out var reason))
|
||||
{
|
||||
Logger.Error($"Invalid custom info for Blood Fueled: {reason}");
|
||||
|
||||
Reference in New Issue
Block a user