public static void UpdateMeeting(MeetingHud __instance, Arsonist role) { foreach (var state in __instance.playerStates) { var player = PlayerControl.AllPlayerControls.ToArray() .FirstOrDefault(x => x.PlayerId == state.TargetPlayerId); if (player == null) { continue; } if (role.DousedPlayers.Contains(player.PlayerId)) { state.NameText.Color = Color.black; } } }
public static void Ignite(Arsonist role) { foreach (var playerId in role.DousedPlayers) { var player = Utils.PlayerById(playerId); if (player.Data.IsDead) { continue; } Utils.MurderPlayer(player, player); } Utils.MurderPlayer(role.Player, role.Player); role.IgniteUsed = true; }
static void Main(string[] args) { // Receiver var fire = new Fire(); // Commands var igniteCommand = new IgniteCommmand(fire); var extinguishCommand = new ExtinguishCommand(fire); // Invoker var arsonist = new Arsonist(igniteCommand, extinguishCommand); arsonist.IgniteFire(); arsonist.ExtinguishFire(); Console.ReadKey(); }
// Methods private static IEnumerable <string> GetResults(Role role) { switch (role) { case Vigilante _: case Veteran _: case Mafioso _: // case Pirate _: case Ambusher _: return(new[] { Vigilante.GetName(), Veteran.GetName(), Mafioso.GetName(), Ambusher.GetName() }); case Medium _: case Janitor _: case Retributionist _: // case Necromancer _: case Trapper _: return(new[] { Medium.GetName(), Janitor.GetName(), Retributionist.GetName(), Trapper.GetName() }); case Survivor _: case VampireHunter _: case Amnesiac _: // case Medusa _: case Psychic _: return(new[] { Survivor.GetName(), VampireHunter.GetName(), Amnesiac.GetName(), Psychic.GetName() }); case Spy _: case Blackmailer _: case Jailor _: case GuardianAngel _: return(new[] { Spy.GetName(), Blackmailer.GetName(), Jailor.GetName(), GuardianAngel.GetName() }); case Sheriff _: case Executioner _: case Werewolf _: // case Poisoner _: return(new[] { Sheriff.GetName(), Executioner.GetName(), Werewolf.GetName() }); case Framer _: case Vampire _: case Jester _: // case HexMaster _: return(new[] { Framer.GetName(), Vampire.GetName(), Jester.GetName() }); case Lookout _: case Forger _: // case Juggernaut _: // case CovenLeader _: return(new[] { Lookout.GetName(), Forger.GetName() }); case Escort _: case Transporter _: case Consort _: case Hypnotist _: return(new[] { Escort.GetName(), Transporter.GetName(), Consort.GetName(), Hypnotist.GetName() }); case Doctor _: case Disguiser _: case SerialKiller _: // case PotionMaster _: return(new[] { Doctor.GetName(), Disguiser.GetName(), SerialKiller.GetName() }); case Investigator _: case Consigliere _: case Mayor _: case Tracker _: // case Plaguebearer _: return(new[] { Investigator.GetName(), Consigliere.GetName(), Mayor.GetName(), Tracker.GetName() }); case Bodyguard _: case Godfather _: case Arsonist _: case Crusader _: return(new[] { Bodyguard.GetName(), Godfather.GetName(), Arsonist.GetName(), Crusader.GetName() }); } return(new string[] { }); }
// Methods private static string GetResult(Role role) { switch (role) { case Investigator _: return($"{role.Owner.Data.PlayerName} gathers information about people. They must be an {Investigator.GetName()}."); case Lookout _: return($"{role.Owner.Data.PlayerName} watches who visits people at night. They must be a {Lookout.GetName()}."); case Psychic _: return($"{role.Owner.Data.PlayerName} has the sight. They must be a {Psychic.GetName()}."); case Sheriff _: return($"{role.Owner.Data.PlayerName} is a protector of the {Faction.Crew.Name}. They must be a {Sheriff.GetName()}."); case Spy _: return($"{role.Owner.Data.PlayerName} secretly watches who someone visits. They must be a {Spy.GetName()}."); case Tracker _: return($"{role.Owner.Data.PlayerName} is a skilled in the art of tracking. They must be a {Tracker.GetName()}."); case Jailor _: return($"{role.Owner.Data.PlayerName} detains people at night. They must be a {Jailor.GetName()}."); case VampireHunter _: return($"{role.Owner.Data.PlayerName} tracks Vampires. They must be a {VampireHunter.GetName()}!"); case Veteran _: return($"{role.Owner.Data.PlayerName} is a paranoid war hero. They must be a {Veteran.GetName()}."); case Vigilante _: return($"{role.Owner.Data.PlayerName} will bend the law to enact justice. They must be a {Vigilante.GetName()}."); case Bodyguard _: return($"{role.Owner.Data.PlayerName} is a trained protector. They must be a {Bodyguard.GetName()}."); case Doctor _: return($"{role.Owner.Data.PlayerName} is a professional surgeon. They must be a {Doctor.GetName()}."); case Crusader _: return($"{role.Owner.Data.PlayerName} is a divine protector. They must be a {Crusader.GetName()}."); case Trapper _: return($"{role.Owner.Data.PlayerName} is waiting for a big catch. They must be a {Trapper.GetName()}."); case Escort _: return($"{role.Owner.Data.PlayerName} is a beautiful person working for the {Faction.Crew.Name}. They must be an {Escort.GetName()}."); case Mayor _: return($"{role.Owner.Data.PlayerName} is the leader of the {Faction.Crew.Name}. They must be the {Mayor.GetName()}."); case Medium _: return($"{role.Owner.Data.PlayerName} speaks with the dead. They must be a {Medium.GetName()}."); case Retributionist _: return($"{role.Owner.Data.PlayerName} wields mystical powers. They must be a {Retributionist.GetName()}."); case Transporter _: return($"{role.Owner.Data.PlayerName} specializes in transportation. They must be a {Transporter.GetName()}."); case Disguiser _: return($"{role.Owner.Data.PlayerName} makes other people appear to be someone they're not. They must be a {Disguiser.GetName()}"); case Forger _: return($"{role.Owner.Data.PlayerName} is good at forging documents. They must be a {Forger.GetName()}."); case Framer _: return($"{role.Owner.Data.PlayerName} has a desire to deceive. They must be a {Framer.GetName()}!"); case Hypnotist _: return($"{role.Owner.Data.PlayerName} is skilled at disrupting others. They must be a {Hypnotist.GetName()}."); case Janitor _: return($"{role.Owner.Data.PlayerName} cleans up dead bodies. They must be a {Janitor.GetName()}."); case Ambusher _: return($"{role.Owner.Data.PlayerName} lies in wait. They must be an {Ambusher.GetName()}."); case Godfather _: return($"{role.Owner.Data.PlayerName} is the leader of the {Faction.Mafia.Name}. They must be the {Godfather.GetName()}."); case Mafioso _: return($"{role.Owner.Data.PlayerName} does the {Godfather.GetName()}'s dirty work. They must be a {Mafioso.GetName()}."); case Blackmailer _: return($"{role.Owner.Data.PlayerName} uses information to silence people. They must be a {Blackmailer.GetName()}."); case Consigliere _: return($"{role.Owner.Data.PlayerName} gathers information for the {Faction.Mafia.Name}. They must be a {Consigliere.GetName()}."); case Consort _: return($"{role.Owner.Data.PlayerName} is a beautiful person working for the {Faction.Mafia.Name}. They must be a {Consort.GetName()}."); case Amnesiac _: return($"{role.Owner.Data.PlayerName} does not remember their role. They must be an {Amnesiac.GetName()}."); case GuardianAngel _: return($"{role.Owner.Data.PlayerName} is watching over someone. They must be a {GuardianAngel.GetName()}."); case Survivor _: return($"{role.Owner.Data.PlayerName} simply wants to live. They must be a {Survivor.GetName()}."); case Vampire _: return($"{role.Owner.Data.PlayerName} drinks blood. They must be a {Vampire.GetName()}!"); case Executioner _: return($"{role.Owner.Data.PlayerName} wants someone to be lynched at any cost. They must be an {Executioner.GetName()}."); case Jester _: return($"{role.Owner.Data.PlayerName} wants to be lynched. They must be a {Jester.GetName()}."); case Witch _: return($"{role.Owner.Data.PlayerName} casts spells on people. They must be a {Witch.GetName()}."); case Arsonist _: return($"{role.Owner.Data.PlayerName} likes to watch things burn. They must be an {Arsonist.GetName()}."); case SerialKiller _: return($"{role.Owner.Data.PlayerName} wants to kill everyone. They must be a {SerialKiller.GetName()}"); case Werewolf _: return($"{role.Owner.Data.PlayerName} howls at the moon. They must be a {Werewolf.GetName()}."); default: return("No special role found."); } }
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); } }
public static void Prefix(IntroCutscene __instance) { // Generate and initialize player icons if (PlayerControl.LocalPlayer != null && HudManager.Instance != null) { Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z); foreach (PlayerControl p in PlayerControl.AllPlayerControls) { GameData.PlayerInfo data = p.Data; PoolablePlayer player = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform); player.UpdateFromPlayerOutfit(p.Data.DefaultOutfit, p.Data.IsDead); player.SetFlipX(true); player.PetSlot.gameObject.SetActive(false); player.NameText.text = p.Data.DefaultOutfit.PlayerName; MapOptions.playerIcons[p.PlayerId] = player; if (PlayerControl.LocalPlayer == BountyHunter.bountyHunter) { player.transform.localPosition = bottomLeft + new Vector3(-0.25f, 0f, 0); player.transform.localScale = Vector3.one * 0.4f; player.gameObject.SetActive(false); } else if (PlayerControl.LocalPlayer == GM.gm) { player.transform.localPosition = Vector3.zero; player.transform.localScale = Vector3.one * 0.3f; player.setSemiTransparent(false); player.gameObject.SetActive(false); } else { player.gameObject.SetActive(false); } } } // Force Bounty Hunter to load a new Bounty when the Intro is over if (BountyHunter.bounty != null && PlayerControl.LocalPlayer == BountyHunter.bountyHunter) { BountyHunter.bountyUpdateTimer = 0f; if (HudManager.Instance != null) { Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z) + new Vector3(-0.25f, 1f, 0); BountyHunter.cooldownText = UnityEngine.Object.Instantiate <TMPro.TextMeshPro>(HudManager.Instance.KillButton.cooldownTimerText, HudManager.Instance.transform); BountyHunter.cooldownText.alignment = TMPro.TextAlignmentOptions.Center; BountyHunter.cooldownText.transform.localPosition = bottomLeft + new Vector3(0f, -1f, -1f); BountyHunter.cooldownText.gameObject.SetActive(true); } } Arsonist.updateIcons(); Morphling.resetMorph(); Camouflager.resetCamouflage(); if (PlayerControl.LocalPlayer == GM.gm && !GM.hasTasks) { PlayerControl.LocalPlayer.clearAllTasks(); } if (PlayerControl.LocalPlayer.isGM()) { HudManager.Instance.ShadowQuad.gameObject.SetActive(false); HudManager.Instance.ReportButton.gameObject.SetActiveRecursively(false); HudManager.Instance.ReportButton.SetActive(false); HudManager.Instance.ReportButton.graphic.enabled = false; HudManager.Instance.ReportButton.enabled = false; HudManager.Instance.ReportButton.graphic.sprite = null; HudManager.Instance.ReportButton.buttonLabelText.enabled = false; HudManager.Instance.ReportButton.buttonLabelText.SetText(""); HudManager.Instance.roomTracker.gameObject.SetActiveRecursively(false); HudManager.Instance.roomTracker.text.enabled = false; HudManager.Instance.roomTracker.text.SetText(""); HudManager.Instance.roomTracker.enabled = false; } // ベントを追加する AdditionalVents.AddAdditionalVents(); // スペシメンにバイタルを移動する SpecimenVital.moveVital(); //タスクバグ修正 if (PlayerControl.GameOptions.MapId == 4 && CustomOptionHolder.airshipEnableWallCheck.getBool()) { var objects = UnityEngine.GameObject.FindObjectsOfType <Console>().ToList(); objects.Find(x => x.name == "task_garbage1").checkWalls = true; objects.Find(x => x.name == "task_garbage2").checkWalls = true; objects.Find(x => x.name == "task_garbage3").checkWalls = true; objects.Find(x => x.name == "task_garbage4").checkWalls = true; objects.Find(x => x.name == "task_garbage5").checkWalls = true; objects.Find(x => x.name == "task_shower").checkWalls = true; objects.Find(x => x.name == "task_developphotos").checkWalls = true; objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.Armory).checkWalls = true; objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.MainHall).checkWalls = true; } // 最初から一人の場合はLast Impostorになる if (AmongUsClient.Instance.AmHost) { LastImpostor.promoteToLastImpostor(); } // タスクパネルの表示優先度を上げる var taskPanel = DestroyableSingleton <HudManager> ._instance.TaskStuff; var pos = taskPanel.transform.position; taskPanel.transform.position = new Vector3(pos.x, pos.y, -20); // ダミー人形をスポーンさせておく if (PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer) && SubmergedCompatibility.isSubmerged()) { var playerId = (byte)GameData.Instance.GetAvailableId(); MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpawnDummy, Hazel.SendOption.Reliable, -1); writer.Write(playerId); writer.Write(PlayerControl.LocalPlayer.transform.position.x); writer.Write(PlayerControl.LocalPlayer.transform.position.y); writer.Write(PlayerControl.LocalPlayer.transform.position.z); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.spawnDummy(playerId, PlayerControl.LocalPlayer.transform.position); } }