Пример #1
0
        static void WrapUpPostfix(GameData.PlayerInfo exiled)
        {
            // Mini exile lose condition
            if (exiled != null)
            {
                var p = Helpers.playerById(exiled.PlayerId);
                if (p.hasModifier(ModifierType.Mini) && !Mini.isGrownUp(p) && !p.Data.Role.IsImpostor && !p.isNeutral())
                {
                    Mini.triggerMiniLose = true;
                }

                // Jester win condition
                else if (p.isRole(RoleType.Jester))
                {
                    Jester.triggerJesterWin = true;
                }
            }

            if (SubmergedCompatibility.isSubmerged())
            {
                var fullscreen = UnityEngine.GameObject.Find("FullScreen500(Clone)");
                if (fullscreen)
                {
                    fullscreen.SetActive(false);
                }
            }
            Logger.info("-----------Task Start-----------", "Phase");
        }
Пример #2
0
        public static void ReEnableGameplay()
        {
            // Reset custom button timers where necessary
            CustomButton.MeetingEndedUpdate();

            // Update admin timer text
            MapOptions.MeetingEndedUpdate();

            // Custom role post-meeting functions
            TheOtherRolesGM.OnMeetingEnd();

            // Mini set adapted cooldown
            if (PlayerControl.LocalPlayer.hasModifier(ModifierType.Mini) && PlayerControl.LocalPlayer.Data.Role.IsImpostor)
            {
                var multiplier = Mini.isGrownUp(PlayerControl.LocalPlayer) ? 0.66f : 2f;
                PlayerControl.LocalPlayer.SetKillTimer(PlayerControl.GameOptions.KillCooldown * multiplier);
            }

            // Seer spawn souls
            if (Seer.deadBodyPositions != null && Seer.seer != null && PlayerControl.LocalPlayer == Seer.seer && (Seer.mode == 0 || Seer.mode == 2))
            {
                foreach (Vector3 pos in Seer.deadBodyPositions)
                {
                    GameObject soul = new GameObject();
                    // soul.transform.position = pos;
                    soul.transform.position = new Vector3(pos.x, pos.y, pos.y / 1000 - 1f);
                    soul.layer = 5;
                    var rend = soul.AddComponent <SpriteRenderer>();
                    soul.AddSubmergedComponent(SubmergedCompatibility.Classes.ElevatorMover);
                    rend.sprite = Seer.getSoulSprite();

                    if (Seer.limitSoulDuration)
                    {
                        HudManager.Instance.StartCoroutine(Effects.Lerp(Seer.soulDuration, new Action <float>((p) => {
                            if (rend != null)
                            {
                                var tmp    = rend.color;
                                tmp.a      = Mathf.Clamp01(1 - p);
                                rend.color = tmp;
                            }
                            if (p == 1f && rend != null && rend.gameObject != null)
                            {
                                UnityEngine.Object.Destroy(rend.gameObject);
                            }
                        })));
                    }
                }
                Seer.deadBodyPositions = new List <Vector3>();
            }

            // Tracker reset deadBodyPositions
            Tracker.deadBodyPositions = new List <Vector3>();

            // Arsonist deactivate dead poolable players
            Arsonist.updateIcons();

            // Force Bounty Hunter Bounty Update
            if (BountyHunter.bountyHunter != null && BountyHunter.bountyHunter == PlayerControl.LocalPlayer)
            {
                BountyHunter.bountyUpdateTimer = 0f;
            }

            // Medium spawn souls
            if (Medium.medium != null && PlayerControl.LocalPlayer == Medium.medium)
            {
                if (Medium.souls != null)
                {
                    foreach (SpriteRenderer sr in Medium.souls)
                    {
                        UnityEngine.Object.Destroy(sr.gameObject);
                    }
                    Medium.souls = new List <SpriteRenderer>();
                }

                if (Medium.featureDeadBodies != null)
                {
                    foreach ((DeadPlayer db, Vector3 ps) in Medium.featureDeadBodies)
                    {
                        GameObject s = new GameObject();
                        // s.transform.position = ps;
                        s.transform.position = new Vector3(ps.x, ps.y, ps.y / 1000 - 1f);
                        s.layer = 5;
                        var rend = s.AddComponent <SpriteRenderer>();
                        s.AddSubmergedComponent(SubmergedCompatibility.Classes.ElevatorMover);
                        rend.sprite = Medium.getSoulSprite();
                        Medium.souls.Add(rend);
                    }
                    Medium.deadBodies        = Medium.featureDeadBodies;
                    Medium.featureDeadBodies = new List <Tuple <DeadPlayer, Vector3> >();
                }
            }

            if (Lawyer.lawyer != null && PlayerControl.LocalPlayer == Lawyer.lawyer && !Lawyer.lawyer.Data.IsDead)
            {
                Lawyer.meetings++;
            }

            if (PlayerControl.LocalPlayer.hasModifier(ModifierType.AntiTeleport))
            {
                if (AntiTeleport.position != new Vector3())
                {
                    PlayerControl.LocalPlayer.transform.position = AntiTeleport.position;
                    if (SubmergedCompatibility.isSubmerged())
                    {
                        SubmergedCompatibility.ChangeFloor(AntiTeleport.position.y > -7);
                    }
                }
            }

            // Remove DeadBodys
            DeadBody[] array = UnityEngine.Object.FindObjectsOfType <DeadBody>();
            for (int i = 0; i < array.Length; i++)
            {
                UnityEngine.Object.Destroy(array[i].gameObject);
            }
        }
Пример #3
0
            public static bool Prefix(KillButton __instance)
            {
                if (__instance.isActiveAndEnabled && __instance.currentTarget && !__instance.isCoolingDown && PlayerControl.LocalPlayer.isAlive() && PlayerControl.LocalPlayer.CanMove)
                {
                    bool showAnimation = true;
                    if (PlayerControl.LocalPlayer.isRole(RoleType.Ninja) && Ninja.isStealthed(PlayerControl.LocalPlayer))
                    {
                        showAnimation = false;
                    }

                    // Use an unchecked kill command, to allow shorter kill cooldowns etc. without getting kicked
                    MurderAttemptResult res = Helpers.checkMuderAttemptAndKill(PlayerControl.LocalPlayer, __instance.currentTarget, showAnimation: showAnimation);
                    // Handle blank kill
                    if (res == MurderAttemptResult.BlankKill)
                    {
                        PlayerControl.LocalPlayer.killTimer = PlayerControl.GameOptions.KillCooldown;
                        if (PlayerControl.LocalPlayer == Cleaner.cleaner)
                        {
                            Cleaner.cleaner.killTimer = HudManagerStartPatch.cleanerCleanButton.Timer = HudManagerStartPatch.cleanerCleanButton.MaxTimer;
                        }
                        else if (PlayerControl.LocalPlayer == Warlock.warlock)
                        {
                            Warlock.warlock.killTimer = HudManagerStartPatch.warlockCurseButton.Timer = HudManagerStartPatch.warlockCurseButton.MaxTimer;
                        }
                        else if (PlayerControl.LocalPlayer.hasModifier(ModifierType.Mini) && PlayerControl.LocalPlayer.Data.Role.IsImpostor)
                        {
                            PlayerControl.LocalPlayer.SetKillTimer(PlayerControl.GameOptions.KillCooldown * (Mini.isGrownUp(PlayerControl.LocalPlayer) ? 0.66f : 2f));
                        }
                        else if (PlayerControl.LocalPlayer == Witch.witch)
                        {
                            Witch.witch.killTimer = HudManagerStartPatch.witchSpellButton.Timer = HudManagerStartPatch.witchSpellButton.MaxTimer;
                        }
                        else if (PlayerControl.LocalPlayer == Assassin.assassin)
                        {
                            Assassin.assassin.killTimer = HudManagerStartPatch.assassinButton.Timer = HudManagerStartPatch.assassinButton.MaxTimer;
                        }
                    }

                    __instance.SetTarget(null);
                }
                return(false);
            }