public static void Postfix(HudManager __instance)
        {
            if (PlayerControl.LocalPlayer != null)
            {
                if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Jester))
                {
                    PlayerControl.LocalPlayer.nameText.Color = RoleInfo.JesterColor;
                }
                else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Snitch))
                {
                    PlayerControl.LocalPlayer.nameText.Color = RoleInfo.SnitchColor;
                }
                else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Mechanic))
                {
                    PlayerControl.LocalPlayer.nameText.Color = RoleInfo.MechanicColor;
                }
                else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Witness))
                {
                    PlayerControl.LocalPlayer.nameText.Color = RoleInfo.WitnessColor;
                }
                else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Sheriff))
                {
                    PlayerControl.LocalPlayer.nameText.Color = RoleInfo.SheriffColor;

                    if (!PlayerControl.LocalPlayer.Data.IsDead && PlayerControl.LocalPlayer.CanMove)
                    {
                        // Enable sheriff kill button
                        __instance.KillButton.gameObject.SetActive(true);
                        __instance.KillButton.isActive = true;
                        __instance.KillButton.SetCoolDown(RoleInfo.GetSheriffCDRemaining() / 1000,
                                                          MoreRolesPlugin.SheriffKillCDOption.GetValue());

                        // Highlight the button if a player is near enough to kill
                        double distance = Utilities.DistanceToClosestPlayer(PlayerControl.LocalPlayer);
                        if (distance <= GameOptionsData.KillDistances[PlayerControl.GameOptions.KillDistance])
                        {
                            __instance.KillButton.SetTarget(Utilities.GetClosestPlayer(PlayerControl.LocalPlayer));
                        }
                        if (Input.GetKeyDown(KeyCode.Q))
                        {
                            __instance.KillButton.PerformKill();
                        }
                    }
                    else
                    {
                        // Disable kill button so it cannot be used, since the player can't move (in task, meeting, etc.)
                        __instance.KillButton.isActive = false;
                        // Hide kill button completely if player is dead
                        if (PlayerControl.LocalPlayer.Data.IsDead)
                        {
                            __instance.KillButton.gameObject.SetActive(false);
                        }
                    }
                }
            }
        }
示例#2
0
 public static void Postfix(ExileController __instance, [HarmonyArgument(0)] GameData.PlayerInfo target)
 {
     if (target != null && RoleInfo.IsRole(target, Roles.Jester))
     {
         if (PlayerControl.GameOptions.ConfirmImpostor)
         {
             __instance.completeString = $"{target.PlayerName} was the Jester.";
         }
     }
 }
 public static void Postfix(PlayerControl __instance)
 {
     if (RoleInfo.IsRole(__instance.PlayerId, Roles.Jester))
     {
         ImportantTextTask importantTask = new GameObject("Jester Tasks").AddComponent <ImportantTextTask>();
         importantTask.transform.SetParent(__instance.transform, false);
         importantTask.Text = RoleInfo.HighlightHex + "Get voted out.[]";
         __instance.myTasks.Insert(0, importantTask);
     }
 }
示例#4
0
 public static void OnJesterEject()
 {
     if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Jester))
     {
         EndGamePatch.SetValues("Victory", RoleInfo.JesterColor, RoleInfo.JesterColor, StingerTypes.Impostor);
     }
     else
     {
         EndGamePatch.SetValues("Defeat", RoleInfo.JesterColor, RoleInfo.JesterColor, StingerTypes.Impostor);
     }
     EndGamePatch.WinnerType = WinnerTypes.Jester;
 }
示例#5
0
 public static void Prefix(PlayerControl __instance)
 {
     if (RoleInfo.IsRole(__instance, Roles.Jester))
     {
         OnJesterEject();
         if (AmongUsClient.Instance.AmHost)
         {
             ShipStatus.Instance.enabled = true;
             ShipStatus.RpcEndGame(GameOverReason.HumansDisconnect, true);
         }
     }
 }
 private static void RunPatch(IntroCutscene.CoBegin__d __instance)
 {
     if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Jester))
     {
         __instance.__this.Title.Text                   = "Jester";
         __instance.__this.Title.Color                  = RoleInfo.JesterColor;
         __instance.__this.ImpostorText.Text            = "Get voted out to win";
         __instance.__this.BackgroundBar.material.color = RoleInfo.JesterColor;
         // Team is only the jester
         __instance.yourTeam = new Il2CppSystem.Collections.Generic.List <PlayerControl>();
         __instance.yourTeam.Add(PlayerControl.LocalPlayer);
     }
     else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Mechanic))
     {
         __instance.__this.Title.Text                   = "Mechanic";
         __instance.__this.Title.Color                  = RoleInfo.MechanicColor;
         __instance.__this.ImpostorText.Text            = "You are a crewmate that can vent";
         __instance.__this.BackgroundBar.material.color = RoleInfo.MechanicColor;
     }
     else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Snitch))
     {
         __instance.__this.Title.Text                   = "Snitch";
         __instance.__this.Title.Color                  = RoleInfo.SnitchColor;
         __instance.__this.ImpostorText.Text            = "Finish your tasks to reveal the Impostors";
         __instance.__this.BackgroundBar.material.color = RoleInfo.SnitchColor;
     }
     else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Witness))
     {
         __instance.__this.Title.Text                   = "Witness";
         __instance.__this.Title.Color                  = RoleInfo.WitnessColor;
         __instance.__this.ImpostorText.Text            = "Use your improved vision to gather information";
         __instance.__this.BackgroundBar.material.color = RoleInfo.WitnessColor;
     }
     else if (RoleInfo.IsRole(PlayerControl.LocalPlayer, Roles.Sheriff))
     {
         __instance.__this.Title.Text                   = "Sheriff";
         __instance.__this.Title.Color                  = RoleInfo.SheriffColor;
         __instance.__this.ImpostorText.Text            = "Find and kill the Impostors";
         __instance.__this.BackgroundBar.material.color = RoleInfo.SheriffColor;
     }
 }