示例#1
0
        private static void GetMaxShield(PlayableScps.Scp096 __instance, ref float __result)
        {
            try
            {
                var ply = __instance?.GetPlayer();
                if (ply == null)
                {
                    return;
                }

                __result = ply.Scp096Controller.MaxShield;
            }
            catch (Exception e)
            {
                Logger.Get.Error($"Synapse-Wrapper: SCP-096 MaxShield failed!!\n{e}\nStackTrace:\n{e.StackTrace}");
            }
        }
        private static IEnumerator <float> NewAttackTriggerPhysics(PlayableScps.Scp096 __instance)
        {
            var scp                 = __instance.GetPlayer();
            var alreadyHit          = new HashSet <GameObject>();
            var alreadyDamagedDoors = HashSetPool <Interactables.Interobjects.DoorUtils.IDamageableDoor> .Shared.Rent();

            int armAttack = __instance._leftAttack ? 1 : -1;

            do
            {
                var b    = scp.CameraReference.TransformDirection(0.25f * armAttack, 0f, 1.3f);
                int num  = Physics.OverlapSphereNonAlloc(scp.CameraReference.position + b, 1f, PlayableScps.Scp096._cachedAttackSwingColliders, PlayableScps.Scp096._attackHitMask);
                var num2 = 0f;
                for (int i = 0; i < num; i++)
                {
                    var collider = PlayableScps.Scp096._cachedAttackSwingColliders[i];
                    var comp     = collider.GetComponentInParent <Interactables.Interobjects.DoorUtils.DoorVariant>();
                    if (comp != null && (object)comp is Interactables.Interobjects.DoorUtils.IDamageableDoor damageableDoor)
                    {
                        if (alreadyDamagedDoors.Add(damageableDoor))
                        {
                            damageableDoor.ServerDamage(250f, Interactables.Interobjects.DoorUtils.DoorDamageType.Scp096);
                            if (num2 < 1f)
                            {
                                num2 = 1f;
                            }
                        }
                    }
                    else
                    {
                        var comp2 = collider.GetComponentInParent <BreakableWindow>();
                        if (comp2 != null)
                        {
                            comp2.ServerDamageWindow(500f);
                            if (num2 < 0.5f)
                            {
                                num2 = 0.5f;
                            }
                        }
                        else
                        {
                            var player = collider.GetComponentInParent <Synapse.Api.Player>();

                            if (player == null || player == scp)
                            {
                                continue;
                            }
                            if (!alreadyHit.Add(player.gameObject) ||
                                Physics.Linecast(scp.transform.position, player.transform.position, PlayableScps.Scp096._solidObjectMask))
                            {
                                continue;
                            }

                            if (!scp.WeaponManager.GetShootPermission(player.ClassManager))
                            {
                                continue;
                            }

                            var allow = true;

                            try
                            {
                                ev.Get.Scp.InvokeScpAttack(scp, player, Api.Enum.ScpAttackType.Scp096_Tear, out allow);
                            }
                            catch (Exception e)
                            {
                                Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096) failed!!\n{e}\nStackTrace:\n{e.StackTrace}");
                            }

                            if (allow)
                            {
                                num2 = 1.35f;
                                player.Hurt(9696, DamageTypes.Scp096, scp);
                                __instance._targets.Remove(player.Hub);
                                NetworkServer.SendToAll(default(PlayableScps.Messages.Scp096OnKillMessage), 0);
                            }
                        }
                    }
                }

                if (num > 0f)
                {
                    NetworkServer.SendToClientOfPlayer(scp.NetworkIdentity, new PlayableScps.Messages.Scp096HitmarkerMessage(num2));
                }

                yield return(MEC.Timing.WaitForOneFrame);
            }while (__instance._attackDuration >= 0.099999994f);
            yield break;
        }
示例#3
0
        private static bool ChargePlayer(PlayableScps.Scp096 __instance, ReferenceHub player)
        {
            try
            {
                var scp    = __instance.GetPlayer();
                var target = player.GetPlayer();
                if (!HitboxIdentity.CheckFriendlyFire(scp.Hub, target.Hub))
                {
                    return(false);
                }

                if (Physics.Linecast(scp.transform.position, player.transform.position, LayerMask.GetMask(new string[]
                {
                    "Default",
                    "Door",
                    "Glass"
                })))
                {
                    return(false);
                }

                if (__instance._chargeHitTargets.Contains(player))
                {
                    return(false);
                }


                try
                {
                    ev.Get.Scp.InvokeScpAttack(scp, target, Api.Enum.ScpAttackType.Scp096_Tear, out var allow);
                    if (!allow)
                    {
                        return(false);
                    }
                }
                catch (Exception e)
                {
                    Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096-Charge) failed!!\n{e}");
                }

                var flag   = __instance._targets.Contains(player);
                var damage = flag ? 9696f : 40f;
                var flag2  = player.playerStats.DealDamage(new Scp096DamageHandler(__instance, damage, Scp096DamageHandler.AttackType.Charge));
                __instance._chargeHitTargets.Add(player);

                if (flag2)
                {
                    __instance._targets.Remove(player);

                    Hitmarker.SendHitmarker(__instance.Hub, 1.35f);
                    if (!__instance._chargeKilled)
                    {
                        __instance._chargeCooldownPenaltyAmount++;
                        __instance._chargeKilled = true;
                    }
                }
                if (flag)
                {
                    __instance.EndChargeNextFrame();
                }

                return(false);
            }
            catch (Exception e)
            {
                Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp096AttackEvent(Charge) failed!!\n{e}");
                return(true);
            }
        }
示例#4
0
        private static bool Pry(PlayableScps.Scp096 __instance)
        {
            try
            {
                if (!__instance.PryingGate)
                {
                    return(false);
                }

                var num = Physics.OverlapSphereNonAlloc(__instance.Hub.playerMovementSync.RealModelPosition, 0.5f, PlayableScps.Scp096._sphereHits, LayerMask.GetMask(new string[]
                {
                    "Hitbox"
                }));

                if (num <= 0)
                {
                    return(false);
                }

                for (int i = 0; i < num; i++)
                {
                    ReferenceHub componentInParent = PlayableScps.Scp096._sphereHits[i].gameObject.GetComponentInParent <ReferenceHub>();

                    if (componentInParent == null || componentInParent == __instance.Hub)
                    {
                        continue;
                    }

                    var scp    = __instance.GetPlayer();
                    var target = componentInParent.GetPlayer();
                    if (!HitboxIdentity.CheckFriendlyFire(scp.Hub, target.Hub))
                    {
                        continue;
                    }
                    try
                    {
                        ev.Get.Scp.InvokeScpAttack(scp, target, Api.Enum.ScpAttackType.Scp096_Tear, out var allow);
                        if (!allow)
                        {
                            continue;
                        }
                    }
                    catch (Exception e)
                    {
                        Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096-Charge) failed!!\n{e}");
                    }

                    // if (__instance.Hub.playerStats.HurtPlayer(new PlayerStats.HitInfo(9696f, null, DamageTypes.Scp096, __instance.Hub.playerId, false), componentInParent.gameObject, false, true))
                    if (componentInParent.playerStats.DealDamage(new Scp096DamageHandler(__instance, 9696f, Scp096DamageHandler.AttackType.GateKill)))
                    {
                        if (__instance._targets.Contains(componentInParent))
                        {
                            __instance._targets.Remove(componentInParent);
                        }

                        NetworkServer.SendToAll(default(PlayableScps.Messages.Scp096OnKillMessage), 0);
                    }
                }
                if (Physics.Raycast(__instance.Hub.PlayerCameraReference.position, __instance.Hub.PlayerCameraReference.forward, 2f, LayerMask.GetMask(new string[]
                {
                    "Default"
                })))
                {
                    __instance.EndChargeNextFrame();
                }

                return(false);
            }
            catch (Exception e)
            {
                Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp096AttackEvent(Pry) failed!!\n{e}");
                return(true);
            }
        }
示例#5
0
        private static bool HitObject(PlayableScps.Scp096 __instance, GameObject target, out bool __result)
        {
            try
            {
                __result = false;

                if (target.TryGetComponent <BreakableWindow>(out var window))
                {
                    __result = window.Damage(500f, new Scp096DamageHandler(__instance, 500f, Scp096DamageHandler.AttackType.Slap), target.transform.position);
                    return(false);
                }

                if (target.TryGetComponent <DoorVariant>(out var door) && (object)door is IDamageableDoor damageable && !door.IsConsideredOpen())
                {
                    __result = damageable.ServerDamage(250f, DoorDamageType.Scp096);
                    return(false);
                }

                if (!ReferenceHub.TryGetHub(target, out var hub) || hub == null || hub == __instance.Hub || hub.characterClassManager.IsAnyScp())
                {
                    return(false);
                }

                var scp    = __instance.GetPlayer();
                var player = hub.GetPlayer();

                if (Physics.Linecast(scp.Position, player.Position, PlayableScps.Scp096._solidObjectMask))
                {
                    return(false);
                }

                if (Vector3.Distance(scp.Position, player.Position) > 5f)
                {
                    return(false);
                }

                if (!SynapseExtensions.GetHarmPermission(scp, player))
                {
                    return(false);
                }
                try
                {
                    ev.Get.Scp.InvokeScpAttack(scp, player, Api.Enum.ScpAttackType.Scp096_Tear, out var allow);
                    if (!allow)
                    {
                        return(false);
                    }
                }
                catch (Exception e)
                {
                    Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096-Charge) failed!!\n{e}");
                }

                if (hub.playerStats.DealDamage(new Scp096DamageHandler(__instance, 9696f, Scp096DamageHandler.AttackType.Slap)))
                {
                    __instance._targets.Remove(hub);
                    NetworkServer.SendToAll(default(PlayableScps.Messages.Scp096OnKillMessage), 0, false);
                }

                __result = true;
                return(false);
            }
            catch (Exception e)
            {
                Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(HitObject) failed!!\n{e}");
                __result = false;
                return(true);
            }
        }