public static void ExileControllerPostfix(ExileController __instance) { var exiled = __instance.exiled?.Object; if (!PlayerControl.LocalPlayer.Data.IsDead && exiled != PlayerControl.LocalPlayer) { return; } if (exiled == PlayerControl.LocalPlayer && PlayerControl.LocalPlayer.Is(RoleEnum.Jester)) { return; } if (PlayerControl.LocalPlayer != WillBePhantom) { return; } if (!PlayerControl.LocalPlayer.Is(RoleEnum.Phantom)) { Role.RoleDictionary.Remove(PlayerControl.LocalPlayer.PlayerId); var role = new Phantom(PlayerControl.LocalPlayer); role.RegenTask(); RemoveTasks(PlayerControl.LocalPlayer); PlayerControl.LocalPlayer.MyPhysics.ResetMoveState(); System.Console.WriteLine("Become Phantom - Phantom"); PlayerControl.LocalPlayer.gameObject.layer = LayerMask.NameToLayer("Players"); var writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PhantomDied, SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); } if (Role.GetRole <Phantom>(PlayerControl.LocalPlayer).Caught) { return; } Vent startingVent = ShipStatus.Instance.AllVents[Random.RandomRangeInt(0, ShipStatus.Instance.AllVents.Count)]; Vector3 destination = Utils.GetCoordinatesToSendPlayerToVent(startingVent); PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(destination); PlayerControl.LocalPlayer.MyPhysics.RpcEnterVent(startingVent.Id); }
private static bool CheckSeerChance(PlayerControl target) { float chance; switch (Role.GetRole(target).Faction) { case Faction.Crewmates: chance = CustomGameOptions.SeerCrewmateChance; break; case Faction.Neutral: chance = CustomGameOptions.SeerNeutralChance; break; case Faction.Impostors: default: chance = CustomGameOptions.SeerImpostorChance; break; } var seen = Random.RandomRangeInt(1, 101) <= chance; return(seen); }
public static int Range(int min, int max) { return(Random.RandomRangeInt(min, max)); }
public static int Range(int minInclusive, int maxExclusive) { return(Random.RandomRangeInt(minInclusive, maxExclusive)); }