Skip to content

Commit

Permalink
fix: SCP-076-2 healing
Browse files Browse the repository at this point in the history
  • Loading branch information
JustMarfix committed May 1, 2024
1 parent 1bc3022 commit 7c9673f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Handlers/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ public static class Player
{
public static void OnChangingRole(ChangingRoleEventArgs ev)
{
if (!VeryUsualDay.Instance.IsEnabledInRound) return;
Timing.CallDelayed(5f, () =>
{
if (!VeryUsualDay.Instance.IsEnabledInRound || ev.NewRole != RoleTypeId.Spectator ||
if (ev.NewRole != RoleTypeId.Spectator ||
ev.Reason == SpawnReason.ForceClass) return;
if (VeryUsualDay.Instance.Is008Leaked)
{
Expand Down Expand Up @@ -89,6 +90,7 @@ when VeryUsualDay.Instance.Config.ForbiddenForSecurity.Contains(ev.Pickup.Type):

public static void OnDroppingItem(DroppingItemEventArgs ev)
{
if (!VeryUsualDay.Instance.IsEnabledInRound) return;
if (!VeryUsualDay.Instance.ScpPlayers.ContainsKey(ev.Player.Id)) return;
if (VeryUsualDay.Instance.ScpPlayers[ev.Player.Id] == VeryUsualDay.Scps.Scp0762)
{
Expand All @@ -104,11 +106,12 @@ public static void OnDroppingItem(DroppingItemEventArgs ev)

public static void OnHurting(HurtingEventArgs ev)
{
if (!VeryUsualDay.Instance.IsEnabledInRound) return;
try
{
if (ev.Player != null && Random.Range(0, 100) < 40) ev.Attacker.Health += 25f;
if (ev.Player != null && !VeryUsualDay.Instance.ScpPlayers.TryGetValue(ev.Player.Id, out var player) &&
player != VeryUsualDay.Scps.Scp0762) return; // checks if target is SCP except for avel himself
if (!VeryUsualDay.Instance.ScpPlayers.TryGetValue(ev.Attacker.Id, out var avel) ||
avel != VeryUsualDay.Scps.Scp0762) return; // checks if attacker is not avel
if (ev.Player != null && Random.Range(0, 100) < 40) ev.Attacker.Heal(25f);
if (ev.Attacker.CurrentItem.As<Jailbird>()?.WearState != JailbirdWearState.AlmostBroken) return;
ev.Attacker.CurrentItem?.Destroy();
var jailbird = ev.Attacker.AddItem(ItemType.Jailbird);
Expand Down Expand Up @@ -176,6 +179,7 @@ public static void OnDied(DiedEventArgs ev)

public static void OnLeft(LeftEventArgs ev)
{
if (!VeryUsualDay.Instance.IsEnabledInRound) return;
if (VeryUsualDay.Instance.ScpPlayers.ContainsKey(ev.Player.Id))
{
VeryUsualDay.Instance.ScpPlayers.Remove(ev.Player.Id);
Expand All @@ -200,6 +204,7 @@ public static void OnLeft(LeftEventArgs ev)

public static void OnShooting(ShootingEventArgs ev)
{
if (!VeryUsualDay.Instance.IsEnabledInRound) return;
if (!VeryUsualDay.Instance.ScpPlayers.TryGetValue(ev.Player.Id, out var player)) return;
if (player == VeryUsualDay.Scps.Scp035 && ev.Firearm.Type == ItemType.GunRevolver)
{
Expand All @@ -209,6 +214,7 @@ public static void OnShooting(ShootingEventArgs ev)

public static void OnUsingItem(UsingItemEventArgs ev)
{
if (!VeryUsualDay.Instance.IsEnabledInRound) return;
if (!VeryUsualDay.Instance.ScpPlayers.TryGetValue(ev.Player.Id, out var player)) return;
if ((player != VeryUsualDay.Scps.Scp035 || ev.Usable.Type != ItemType.SCP500) &&
ev.Usable.Type != ItemType.SCP207 && ev.Usable.Type != ItemType.AntiSCP207) return;
Expand Down

0 comments on commit 7c9673f

Please sign in to comment.