Ejemplo n.º 1
0
        public static void clearAndReloadRoles()
        {
            Morphling.clearAndReload();
            Camouflager.clearAndReload();
            Shifter.clearAndReload();
            Swapper.clearAndReload();
            GM.clearAndReload();

            Lovers.Clear();
            Opportunist.Clear();
            Ninja.Clear();
            Madmate.Clear();
            CreatedMadmate.Clear();
            PlagueDoctor.Clear();
            Lighter.Clear();
            SerialKiller.Clear();
            Fox.Clear();
            Immoralist.Clear();
            FortuneTeller.Clear();
            LastImpostor.Clear();
            SoulPlayer.Clear();
            Munou.Clear();
            SchrodingersCat.Clear();
            Trapper.Clear();
            BomberA.Clear();
            BomberB.Clear();
            EvilTracker.Clear();
            Puppeteer.Clear();
            MimicK.Clear();
            MimicA.Clear();
            Mini.Clear();
            AntiTeleport.Clear();
            Role.ClearAll();
        }
Ejemplo n.º 2
0
 public static void clearAndReloadRoles()
 {
     Jester.clearAndReload();
     Mayor.clearAndReload();
     Engineer.clearAndReload();
     Sheriff.clearAndReload();
     Lighter.clearAndReload();
     Godfather.clearAndReload();
     Mafioso.clearAndReload();
     Janitor.clearAndReload();
     Detective.clearAndReload();
     TimeMaster.clearAndReload();
     Medic.clearAndReload();
     Shifter.clearAndReload();
     Swapper.clearAndReload();
     Lovers.clearAndReload();
     Seer.clearAndReload();
     Morphling.clearAndReload();
     Camouflager.clearAndReload();
     Hacker.clearAndReload();
     Child.clearAndReload();
     Tracker.clearAndReload();
     Vampire.clearAndReload();
     Snitch.clearAndReload();
     Jackal.clearAndReload();
     Sidekick.clearAndReload();
     Eraser.clearAndReload();
     Spy.clearAndReload();
     Trickster.clearAndReload();
 }
Ejemplo n.º 3
0
            public static void Postfix(GameData __instance, PlayerControl player, DisconnectReasons reason)
            {
                if (AmongUsClient.Instance.GameState == InnerNet.InnerNetClient.GameStates.Started)
                {
                    Role.allRoles.Do(x => x.HandleDisconnect(player, reason));
                    Modifier.allModifiers.Do(x => x.HandleDisconnect(player, reason));

                    Lovers.HandleDisconnect(player, reason);
                    Shifter.HandleDisconnect(player, reason);

                    finalStatuses[player.PlayerId] = FinalStatus.Disconnected;
                }
            }
Ejemplo n.º 4
0
 public static bool hasAliveKillingLover(this PlayerControl player)
 {
     if (!Lovers.existingAndAlive())
     {
         return(false);
     }
     if (player != null && player != lover1 && player != lover2) // Is Player a Lover?
     {
         return(false);
     }
     return(lover1 == Jackal.jackal || lover2 == Jackal.jackal ||
            lover1 == Sidekick.sidekick || lover2 == Sidekick.sidekick ||
            lover1.Data.IsImpostor || lover2.Data.IsImpostor);       // Either of the lovers is a killer
 }
Ejemplo n.º 5
0
        public static void OnDeath(this PlayerControl player, PlayerControl killer)
        {
            Role.allRoles.DoIf(x => x.player == player, x => x.OnDeath(killer));
            Modifier.allModifiers.DoIf(x => x.player == player, x => x.OnDeath(killer));

            // Lover suicide trigger on exile/death
            if (player.isLovers())
            {
                Lovers.killLovers(player, killer);
            }

            if (MeetingHud.Instance?.state != MeetingHud.VoteStates.Animating)
            {
                RPCProcedure.updateMeeting(player.PlayerId, true);
            }
        }
Ejemplo n.º 6
0
        public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] ref GameOverReason reason, [HarmonyArgument(1)] bool showAd)
        {
            AdditionalTempData.clear();

            // Remove Jester from winners (on Jester win he will be added again, see below)
            if (Jester.jester != null)
            {
                WinningPlayerData jesterWinner = null;
                foreach (WinningPlayerData winner in  TempData.winners)
                {
                    if (winner.Name == Jester.jester.Data.PlayerName)
                    {
                        jesterWinner = winner;
                    }
                }

                if (jesterWinner != null)
                {
                    TempData.winners.Remove(jesterWinner);
                }
            }
            // Remove Jackal and Sidekick from winners (on Jackal win he will be added again, see below)
            if (Jackal.jackal != null || Sidekick.sidekick != null)
            {
                List <WinningPlayerData> winnersToRemove = new List <WinningPlayerData>();
                foreach (WinningPlayerData winner in TempData.winners)
                {
                    if (winner.Name == Jackal.jackal?.Data?.PlayerName)
                    {
                        winnersToRemove.Add(winner);
                    }
                    if (winner.Name == Sidekick.sidekick?.Data?.PlayerName)
                    {
                        winnersToRemove.Add(winner);
                    }
                    foreach (var player in Jackal.formerJackals)
                    {
                        if (winner.Name == player.Data.PlayerName)
                        {
                            winnersToRemove.Add(winner);
                        }
                    }
                }

                foreach (var winner in winnersToRemove)
                {
                    TempData.winners.Remove(winner);
                }
            }

            bool jesterWin     = Jester.jester != null && gameOverReason == (GameOverReason)CustomGameOverReason.JesterWin;
            bool childLose     = Child.child != null && gameOverReason == (GameOverReason)CustomGameOverReason.ChildLose;
            bool loversWin     = Lovers.existingAndAlive() && (gameOverReason == (GameOverReason)CustomGameOverReason.LoversWin || (TempData.DidHumansWin(gameOverReason) && Lovers.existingAndCrewLovers())); // Either they win if they are among the last 3 players, or they win if they are both Crewmates and both alive and the Crew wins (Team Imp/Jackal Lovers can only win solo wins)
            bool teamJackalWin = gameOverReason == (GameOverReason)CustomGameOverReason.TeamJackalWin && ((Jackal.jackal != null && !Jackal.jackal.Data.IsDead) || (Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead));

            // Child lose
            if (childLose)
            {
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Child.child.Data);
                wpd.IsYou = false; // If "no one is the Child", it will display the Child, but also show defeat to everyone
                TempData.winners.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.ChildLose;
            }

            // Jester win
            else if (jesterWin)
            {
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jester.jester.Data);
                TempData.winners.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.JesterWin;
            }

            // Lovers win conditions
            else if (loversWin)
            {
                AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2);
                // Double win for lovers, crewmates also win
                if (Lovers.existingAndCrewLovers())
                {
                    AdditionalTempData.winCondition = WinCondition.LoversTeamWin;
                    TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                    {
                        if (p == null)
                        {
                            continue;
                        }
                        if (p == Lovers.lover1 || p == Lovers.lover2)
                        {
                            TempData.winners.Add(new WinningPlayerData(p.Data));
                        }
                        else if (p != Jester.jester && p != Jackal.jackal && p != Sidekick.sidekick && !p.Data.IsImpostor)
                        {
                            TempData.winners.Add(new WinningPlayerData(p.Data));
                        }
                    }
                }
                // Lovers solo win
                else
                {
                    AdditionalTempData.winCondition = WinCondition.LoversSoloWin;
                    TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover1.Data));
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover2.Data));
                }
            }

            // Jackal win condition (should be implemented using a proper GameOverReason in the future)
            else if (teamJackalWin)
            {
                // Jackal wins if nobody except jackal is alive
                AdditionalTempData.winCondition = WinCondition.JackalWin;
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jackal.jackal.Data);
                wpd.IsImpostor = false;
                TempData.winners.Add(wpd);
                // If there is a sidekick. The sidekick also wins
                if (Sidekick.sidekick != null)
                {
                    WinningPlayerData wpdSidekick = new WinningPlayerData(Sidekick.sidekick.Data);
                    wpdSidekick.IsImpostor = false;
                    TempData.winners.Add(wpdSidekick);
                }
                foreach (var player in Jackal.formerJackals)
                {
                    WinningPlayerData wpdFormerJackal = new WinningPlayerData(player.Data);
                    wpdFormerJackal.IsImpostor = false;
                    TempData.winners.Add(wpdFormerJackal);
                }
            }

            // Reset Settings
            RPCProcedure.resetVariables();
        }
Ejemplo n.º 7
0
        public static void Postfix(AmongUsClient __instance, GameOverReason FCBGPMEMOJB, bool GKFHPFPIHGA)
        {
            AdditionalTempData.clear();

            // Remove Jester from winners (on Jester win he will be added again, see below)
            if (Jester.jester != null)
            {
                WinningPlayerData jesterWinner = null;
                foreach (WinningPlayerData winner in  TempData.BDGOKPKHCNB)
                {
                    if (winner.GEDNCGBDPKC == Jester.jester.IDOFAMCIJKE.HGGCLJHCDBM)
                    {
                        jesterWinner = winner;
                    }
                }

                if (jesterWinner != null)
                {
                    TempData.BDGOKPKHCNB.Remove(jesterWinner);
                }
            }
            // Remove Jackal and Sidekick from winners (on Jackal win he will be added again, see below)
            if (Jackal.jackal != null || Sidekick.sidekick != null)
            {
                List <WinningPlayerData> winnersToRemove = new List <WinningPlayerData>();
                foreach (WinningPlayerData winner in TempData.BDGOKPKHCNB)
                {
                    if (winner.GEDNCGBDPKC == Jackal.jackal?.IDOFAMCIJKE?.HGGCLJHCDBM)
                    {
                        winnersToRemove.Add(winner);
                    }
                    if (winner.GEDNCGBDPKC == Sidekick.sidekick?.IDOFAMCIJKE?.HGGCLJHCDBM)
                    {
                        winnersToRemove.Add(winner);
                    }
                    foreach (var player in Jackal.formerJackals)
                    {
                        if (winner.GEDNCGBDPKC == player.IDOFAMCIJKE.HGGCLJHCDBM)
                        {
                            winnersToRemove.Add(winner);
                        }
                    }
                }

                foreach (var winner in winnersToRemove)
                {
                    TempData.BDGOKPKHCNB.Remove(winner);
                }
            }

            bool childLose = Child.child != null && gameOverReason == (GameOverReason)CustomGameOverReason.ChildLose;
            bool jesterWin = Jester.jester != null && gameOverReason == (GameOverReason)CustomGameOverReason.JesterWin;

            // Child lose
            if (childLose)
            {
                TempData.BDGOKPKHCNB = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Child.child.IDOFAMCIJKE);
                wpd.KCEFGIGGLHM = false; // If "no one is the Child", it will display the Child, but also show defeat to everyone
                TempData.BDGOKPKHCNB.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.ChildLose;
            }

            // Jester win
            else if (jesterWin)
            {
                TempData.BDGOKPKHCNB = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jester.jester.IDOFAMCIJKE);
                TempData.BDGOKPKHCNB.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.JesterWin;
            }

            // Lovers win conditions
            else if (Lovers.existingAndAlive() && gameOverReason == (GameOverReason)CustomGameOverReason.LoversWin)
            {
                AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2);
                // Double win for lovers, crewmates also win
                if (!Lovers.existingWithImpLover())
                {
                    AdditionalTempData.winCondition = WinCondition.LoversTeamWin;
                    TempData.BDGOKPKHCNB            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                    {
                        if (p == null)
                        {
                            continue;
                        }
                        if (p == Lovers.lover1 || p == Lovers.lover2)
                        {
                            TempData.BDGOKPKHCNB.Add(new WinningPlayerData(p.IDOFAMCIJKE));
                        }
                        else if (p != Jester.jester && p != Jackal.jackal && p != Sidekick.sidekick && !p.IDOFAMCIJKE.CIDDOFDJHJH)
                        {
                            TempData.BDGOKPKHCNB.Add(new WinningPlayerData(p.IDOFAMCIJKE));
                        }
                    }
                }
                // Lovers solo win
                else
                {
                    AdditionalTempData.winCondition = WinCondition.LoversSoloWin;
                    TempData.BDGOKPKHCNB            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    TempData.BDGOKPKHCNB.Add(new WinningPlayerData(Lovers.lover1.IDOFAMCIJKE));
                    TempData.BDGOKPKHCNB.Add(new WinningPlayerData(Lovers.lover2.IDOFAMCIJKE));
                }
            }

            // Jackal win condition (should be implemented using a proper GameOverReason in the future)
            else if (gameOverReason == (GameOverReason)CustomGameOverReason.TeamJackalWin && (Jackal.jackal != null && !Jackal.jackal.IDOFAMCIJKE.FGNJJFABIHJ || Sidekick.sidekick != null && !Sidekick.sidekick.IDOFAMCIJKE.FGNJJFABIHJ))
            {
                // Jackal wins if nobody except jackal is alive
                AdditionalTempData.winCondition = WinCondition.JackalWin;
                TempData.BDGOKPKHCNB            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jackal.jackal.IDOFAMCIJKE);
                wpd.CIDDOFDJHJH = false;
                TempData.BDGOKPKHCNB.Add(wpd);
                // If there is a sidekick. The sidekick also wins
                if (Sidekick.sidekick != null)
                {
                    WinningPlayerData wpdSidekick = new WinningPlayerData(Sidekick.sidekick.IDOFAMCIJKE);
                    wpdSidekick.CIDDOFDJHJH = false;
                    TempData.BDGOKPKHCNB.Add(wpdSidekick);
                }
                foreach (var player in Jackal.formerJackals)
                {
                    WinningPlayerData wpdFormerJackal = new WinningPlayerData(player.IDOFAMCIJKE);
                    wpdFormerJackal.CIDDOFDJHJH = false;
                    TempData.BDGOKPKHCNB.Add(wpdFormerJackal);
                }
            }

            // Reset Settings
            RPCProcedure.resetVariables();
        }
Ejemplo n.º 8
0
        public static void Postfix(AmongUsClient __instance, GameOverReason OFLKLGMHBEL, bool JFFPAKGPNJA)
        {
            AdditionalTempData.clear();

            // Remove shifter from winners
            if (Shifter.shifter != null)
            {
                WinningPlayerData shifterWinner = null;
                foreach (WinningPlayerData winner in  TempData.winners)
                {
                    if (winner.Name == Shifter.shifter.Data.PlayerName)
                    {
                        shifterWinner = winner;
                    }
                }

                if (shifterWinner != null)
                {
                    TempData.winners.Remove(shifterWinner);
                }
            }
            // Remove Jester from winners (on Jester win he will be added again, see below)
            if (Jester.jester != null)
            {
                WinningPlayerData jesterWinner = null;
                foreach (WinningPlayerData winner in  TempData.winners)
                {
                    if (winner.Name == Jester.jester.Data.PlayerName)
                    {
                        jesterWinner = winner;
                    }
                }

                if (jesterWinner != null)
                {
                    TempData.winners.Remove(jesterWinner);
                }
            }
            // Remove Jackal and Sidekick from winners (on Jackal win he will be added again, see below)
            if (Jackal.jackal != null || Sidekick.sidekick != null)
            {
                List <WinningPlayerData> winnersToRemove = new List <WinningPlayerData>();
                foreach (WinningPlayerData winner in TempData.winners)
                {
                    if (winner.Name == Jackal.jackal?.Data?.PlayerName)
                    {
                        winnersToRemove.Add(winner);
                    }
                    if (winner.Name == Sidekick.sidekick?.Data?.PlayerName)
                    {
                        winnersToRemove.Add(winner);
                    }
                    foreach (var player in Jackal.formerJackals)
                    {
                        if (winner.Name == player.Data.PlayerName)
                        {
                            winnersToRemove.Add(winner);
                        }
                    }
                }

                foreach (var winner in winnersToRemove)
                {
                    TempData.winners.Remove(winner);
                }
            }

            // Jester and Bounty Hunter win condition (should be implemented using a proper GameOverReason in the future)
            bool jesterWin       = Jester.jester != null && Jester.jester.Data.IsImpostor;
            bool bountyHunterWin = BountyHunter.bountyHunter != null && BountyHunter.bountyHunter.Data.IsImpostor;

            if (jesterWin || bountyHunterWin)
            {
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                if (jesterWin)
                {
                    WinningPlayerData wpd = new WinningPlayerData(Jester.jester.Data);
                    wpd.IsImpostor = false;
                    TempData.winners.Add(wpd);
                    AdditionalTempData.winCondition = WinCondition.JesterWin;
                }
                if (bountyHunterWin)
                {
                    WinningPlayerData wpd = new WinningPlayerData(BountyHunter.bountyHunter.Data);
                    wpd.IsImpostor = false;
                    TempData.winners.Add(wpd);
                    if (AdditionalTempData.winCondition == WinCondition.JesterWin)
                    {
                        AdditionalTempData.winCondition = WinCondition.JesterAndBountyHunterWin;
                    }
                    else
                    {
                        AdditionalTempData.winCondition = WinCondition.BountyHunterWin;
                    }
                }
            }

            // Lovers win conditions (should be implemented using a proper GameOverReason in the future)
            else if (Lovers.existingAndAlive() && gameOverReason == (GameOverReason)CustomGameOverReason.LoversWin)
            {
                AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2);
                // Double win for lovers, crewmates also win
                if (!Lovers.existingWithImpLover())
                {
                    AdditionalTempData.winCondition = WinCondition.LoversTeamWin;
                    TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                    {
                        if (p == null)
                        {
                            continue;
                        }
                        if (p == Lovers.lover1 || p == Lovers.lover2)
                        {
                            TempData.winners.Add(new WinningPlayerData(p.Data));
                        }
                        else if (p != Shifter.shifter && p != Jester.jester && p != Jackal.jackal && p != Sidekick.sidekick && !p.Data.IsImpostor)
                        {
                            TempData.winners.Add(new WinningPlayerData(p.Data));
                        }
                    }
                }
                // Lovers solo win
                else
                {
                    AdditionalTempData.winCondition = WinCondition.LoversSoloWin;
                    TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover1.Data));
                    TempData.winners.Add(new WinningPlayerData(Lovers.lover2.Data));
                }
            }

            // Jackal win condition (should be implemented using a proper GameOverReason in the future)
            else if (gameOverReason == (GameOverReason)CustomGameOverReason.TeamJackalWin && (Jackal.jackal != null && !Jackal.jackal.Data.IsDead || Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead))
            {
                // Jackal wins if nobody except jackal is alive
                AdditionalTempData.winCondition = WinCondition.JackalWin;
                TempData.winners = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jackal.jackal.Data);
                wpd.IsImpostor = false;
                TempData.winners.Add(wpd);
                // If there is a sidekick. The sidekick also wins
                if (Sidekick.sidekick != null)
                {
                    WinningPlayerData wpdSidekick = new WinningPlayerData(Sidekick.sidekick.Data);
                    wpdSidekick.IsImpostor = false;
                    TempData.winners.Add(wpdSidekick);
                }
                foreach (var player in Jackal.formerJackals)
                {
                    WinningPlayerData wpdFormerJackal = new WinningPlayerData(player.Data);
                    wpdFormerJackal.IsImpostor = false;
                    TempData.winners.Add(wpdFormerJackal);
                }
            }

            // Reset Role Settings
            clearAndReloadRoles();
            clearGameHistory();
        }
Ejemplo n.º 9
0
        public static void erasePlayerRole(byte playerId)
        {
            PlayerControl player = Helpers.playerById(playerId);

            if (player == null)
            {
                return;
            }

            // Crewmate roles
            if (player == Mayor.mayor)
            {
                Mayor.clearAndReload();
            }
            if (player == Engineer.engineer)
            {
                Engineer.clearAndReload();
            }
            if (player == Sheriff.sheriff)
            {
                Sheriff.clearAndReload();
            }
            if (player == Lighter.lighter)
            {
                Lighter.clearAndReload();
            }
            if (player == Detective.detective)
            {
                Detective.clearAndReload();
            }
            if (player == TimeMaster.timeMaster)
            {
                TimeMaster.clearAndReload();
            }
            if (player == Medic.medic)
            {
                Medic.clearAndReload();
            }
            if (player == Shifter.shifter)
            {
                Shifter.clearAndReload();
            }
            if (player == Seer.seer)
            {
                Seer.clearAndReload();
            }
            if (player == Hacker.hacker)
            {
                Hacker.clearAndReload();
            }
            if (player == Child.child)
            {
                Child.clearAndReload();
            }
            if (player == Tracker.tracker)
            {
                Tracker.clearAndReload();
            }
            if (player == Snitch.snitch)
            {
                Snitch.clearAndReload();
            }
            if (player == Swapper.swapper)
            {
                Swapper.clearAndReload();
            }
            if (player == Spy.spy)
            {
                Spy.clearAndReload();
            }

            // Impostor roles
            if (player == Morphling.morphling)
            {
                Morphling.clearAndReload();
            }
            if (player == Camouflager.camouflager)
            {
                Camouflager.clearAndReload();
            }
            if (player == Godfather.godfather)
            {
                Godfather.clearAndReload();
            }
            if (player == Mafioso.mafioso)
            {
                Mafioso.clearAndReload();
            }
            if (player == Janitor.janitor)
            {
                Janitor.clearAndReload();
            }
            if (player == Vampire.vampire)
            {
                Vampire.clearAndReload();
            }
            if (player == Eraser.eraser)
            {
                Eraser.clearAndReload();
            }
            if (player == Trickster.trickster)
            {
                Trickster.clearAndReload();
            }
            if (player == Cleaner.cleaner)
            {
                Cleaner.clearAndReload();
            }
            if (player == Warlock.warlock)
            {
                Warlock.clearAndReload();
            }

            // Other roles
            if (player == Jester.jester)
            {
                Jester.clearAndReload();
            }
            if (player == Lovers.lover1 || player == Lovers.lover2)   // The whole Lover couple is being erased
            {
                Lovers.clearAndReload();
            }
            if (player == Jackal.jackal)   // Promote Sidekick and hence override the the Jackal or erase Jackal
            {
                if (Sidekick.promotesToJackal && Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead)
                {
                    RPCProcedure.sidekickPromotes();
                }
                else
                {
                    Jackal.clearAndReload();
                }
            }
            if (player == Sidekick.sidekick)
            {
                Sidekick.clearAndReload();
            }
        }
Ejemplo n.º 10
0
        public static void Postfix(AmongUsClient __instance, GameOverReason NEPMFBMGGLF, bool FBEKDLNKNLL)
        {
            AdditionalTempData.clear();

            // Remove Jester from winners (on Jester win he will be added again, see below)
            if (Jester.jester != null)
            {
                WinningPlayerData jesterWinner = null;
                foreach (WinningPlayerData winner in  TempData.BPDANAHEJDD)
                {
                    if (winner.NNMPJKHJLMB == Jester.jester.PPMOEEPBHJO.PCLLABJCIPC)
                    {
                        jesterWinner = winner;
                    }
                }

                if (jesterWinner != null)
                {
                    TempData.BPDANAHEJDD.Remove(jesterWinner);
                }
            }
            // Remove Jackal and Sidekick from winners (on Jackal win he will be added again, see below)
            if (Jackal.jackal != null || Sidekick.sidekick != null)
            {
                List <WinningPlayerData> winnersToRemove = new List <WinningPlayerData>();
                foreach (WinningPlayerData winner in TempData.BPDANAHEJDD)
                {
                    if (winner.NNMPJKHJLMB == Jackal.jackal?.PPMOEEPBHJO?.PCLLABJCIPC)
                    {
                        winnersToRemove.Add(winner);
                    }
                    if (winner.NNMPJKHJLMB == Sidekick.sidekick?.PPMOEEPBHJO?.PCLLABJCIPC)
                    {
                        winnersToRemove.Add(winner);
                    }
                    foreach (var player in Jackal.formerJackals)
                    {
                        if (winner.NNMPJKHJLMB == player.PPMOEEPBHJO.PCLLABJCIPC)
                        {
                            winnersToRemove.Add(winner);
                        }
                    }
                }

                foreach (var winner in winnersToRemove)
                {
                    TempData.BPDANAHEJDD.Remove(winner);
                }
            }

            bool jesterWin     = Jester.jester != null && gameOverReason == (GameOverReason)CustomGameOverReason.JesterWin;
            bool childLose     = Child.child != null && gameOverReason == (GameOverReason)CustomGameOverReason.ChildLose;
            bool loversWin     = Lovers.existingAndAlive() && (gameOverReason == (GameOverReason)CustomGameOverReason.LoversWin || (TempData.OMHNAMNPJCP(gameOverReason) && Lovers.existingAndCrewLovers())); // Either they win if they are among the last 3 players, or they win if they are both Crewmates and both alive and the Crew wins (Team Imp/Jackal Lovers can only win solo wins)
            bool teamJackalWin = gameOverReason == (GameOverReason)CustomGameOverReason.TeamJackalWin && ((Jackal.jackal != null && !Jackal.jackal.PPMOEEPBHJO.IAGJEKLJCCI) || (Sidekick.sidekick != null && !Sidekick.sidekick.PPMOEEPBHJO.IAGJEKLJCCI));

            // Child lose
            if (childLose)
            {
                TempData.BPDANAHEJDD = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Child.child.PPMOEEPBHJO);
                wpd.APIPIPIKLCE = false; // If "no one is the Child", it will display the Child, but also show defeat to everyone
                TempData.BPDANAHEJDD.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.ChildLose;
            }

            // Jester win
            else if (jesterWin)
            {
                TempData.BPDANAHEJDD = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jester.jester.PPMOEEPBHJO);
                TempData.BPDANAHEJDD.Add(wpd);
                AdditionalTempData.winCondition = WinCondition.JesterWin;
            }

            // Lovers win conditions
            else if (loversWin)
            {
                AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2);
                // Double win for lovers, crewmates also win
                if (Lovers.existingAndCrewLovers())
                {
                    AdditionalTempData.winCondition = WinCondition.LoversTeamWin;
                    TempData.BPDANAHEJDD            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                    {
                        if (p == null)
                        {
                            continue;
                        }
                        if (p == Lovers.lover1 || p == Lovers.lover2)
                        {
                            TempData.BPDANAHEJDD.Add(new WinningPlayerData(p.PPMOEEPBHJO));
                        }
                        else if (p != Jester.jester && p != Jackal.jackal && p != Sidekick.sidekick && !p.PPMOEEPBHJO.FDNMBJOAPFL)
                        {
                            TempData.BPDANAHEJDD.Add(new WinningPlayerData(p.PPMOEEPBHJO));
                        }
                    }
                }
                // Lovers solo win
                else
                {
                    AdditionalTempData.winCondition = WinCondition.LoversSoloWin;
                    TempData.BPDANAHEJDD            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                    TempData.BPDANAHEJDD.Add(new WinningPlayerData(Lovers.lover1.PPMOEEPBHJO));
                    TempData.BPDANAHEJDD.Add(new WinningPlayerData(Lovers.lover2.PPMOEEPBHJO));
                }
            }

            // Jackal win condition (should be implemented using a proper GameOverReason in the future)
            else if (teamJackalWin)
            {
                // Jackal wins if nobody except jackal is alive
                AdditionalTempData.winCondition = WinCondition.JackalWin;
                TempData.BPDANAHEJDD            = new Il2CppSystem.Collections.Generic.List <WinningPlayerData>();
                WinningPlayerData wpd = new WinningPlayerData(Jackal.jackal.PPMOEEPBHJO);
                wpd.FDNMBJOAPFL = false;
                TempData.BPDANAHEJDD.Add(wpd);
                // If there is a sidekick. The sidekick also wins
                if (Sidekick.sidekick != null)
                {
                    WinningPlayerData wpdSidekick = new WinningPlayerData(Sidekick.sidekick.PPMOEEPBHJO);
                    wpdSidekick.FDNMBJOAPFL = false;
                    TempData.BPDANAHEJDD.Add(wpdSidekick);
                }
                foreach (var player in Jackal.formerJackals)
                {
                    WinningPlayerData wpdFormerJackal = new WinningPlayerData(player.PPMOEEPBHJO);
                    wpdFormerJackal.FDNMBJOAPFL = false;
                    TempData.BPDANAHEJDD.Add(wpdFormerJackal);
                }
            }

            // Reset Settings
            RPCProcedure.resetVariables();
        }
Ejemplo n.º 11
0
 public static PlayerControl getPartner(this PlayerControl player)
 {
     return(Lovers.getPartner(player));
 }
Ejemplo n.º 12
0
 public static bool isLovers(this PlayerControl player)
 {
     return(player != null && Lovers.isLovers(player));
 }