Add Blind & Pawn

This commit is contained in:
Gurge44 committed 2025-04-28 11:53:15 +02:00
1 parent 9a8e7073bc
commit 0d2307054c
12 files changed
+84 -3

No files matched your search

+2
View File
@@ -316,6 +316,7 @@ public enum CustomRoles
NoteKiller,
Opportunist,
Patroller,
Pawn,
Pelican,
Pestilence,
Phantasm,
@@ -451,6 +452,7 @@ public enum CustomRoles
Bait,
Trapper, // Beartrap
Bewilder,
Blind,
Blocked,
Bloodlust,
Bloodmoon, // Ghost role
+2
View File
@@ -560,6 +560,7 @@ public class Main : BasePlugin
{ CustomRoles.BloodKnight, "#630000" },
{ CustomRoles.Juggernaut, "#A41342" },
{ CustomRoles.Cherokious, "#de4b9e" },
{ CustomRoles.Pawn, "#78C48F" },
{ CustomRoles.Parasite, "#ff1919" },
{ CustomRoles.Crewpostor, "#ff1919" },
{ CustomRoles.Hypocrite, "#ff1919" },
@@ -601,6 +602,7 @@ public class Main : BasePlugin
{ CustomRoles.Messenger, "#28b573" },
{ CustomRoles.Dynamo, "#ebe534" },
{ CustomRoles.AntiTP, "#fcba03" },
{ CustomRoles.Blind, "#666666" },
{ CustomRoles.Shy, "#9582f5" },
{ CustomRoles.Blocked, "#B7A627" },
{ CustomRoles.Aide, "#ff1919" },
+2
View File
@@ -319,6 +319,7 @@ internal static class CustomRolesHelper
CustomRoles.Crewpostor => CustomRoles.Engineer,
CustomRoles.Hypocrite => CustomRoles.Crewmate,
CustomRoles.Cherokious => CustomRoles.Engineer,
CustomRoles.Pawn => CustomRoles.Crewmate,
CustomRoles.Observer => CustomRoles.Crewmate,
CustomRoles.DovesOfNeace => UsePets ? CustomRoles.Crewmate : CustomRoles.Engineer,
CustomRoles.Disperser => UsePets ? CustomRoles.Impostor : CustomRoles.Shapeshifter,
@@ -1454,6 +1455,7 @@ internal static class CustomRolesHelper
CustomRoles.Opportunist => RoleOptionType.Neutral_Benign,
CustomRoles.Lawyer => RoleOptionType.Neutral_Benign,
CustomRoles.Amnesiac => RoleOptionType.Neutral_Benign,
CustomRoles.Pawn => RoleOptionType.Neutral_Benign,
CustomRoles.Postman => RoleOptionType.Neutral_Benign,
CustomRoles.Dealer => RoleOptionType.Neutral_Benign,
CustomRoles.RoomRusher => RoleOptionType.Neutral_Benign,
+1 -1
View File
@@ -1529,7 +1529,7 @@ internal static class ExtendedPlayerControl
void DoKill()
{
var sender = CustomRpcSender.Create("Send Noisemaker Alerts & Kill", SendOption.Reliable);
Main.PlayerStates.Values.DoIf(x => !x.IsDead && x.Role.SeesArrowsToDeadBodies, x => sender.RpcSetRole(target, RoleTypes.Noisemaker, x.Player.GetClientId()));
Main.PlayerStates.Values.DoIf(x => !x.IsDead && x.Role.SeesArrowsToDeadBodies && !x.SubRoles.Contains(CustomRoles.Blind), x => sender.RpcSetRole(target, RoleTypes.Noisemaker, x.Player.GetClientId()));
if (AmongUsClient.Instance.AmClient) killer.MurderPlayer(target, MurderResultFlags.Succeeded);
sender.AutoStartRpc(killer.NetId, 12);
@@ -279,7 +279,7 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
break;
}
if (state.Role.SeesArrowsToDeadBodies)
if (state.Role.SeesArrowsToDeadBodies && !player.Is(CustomRoles.Blind))
{
AURoleOptions.NoisemakerImpostorAlert = true;
AURoleOptions.NoisemakerAlertDuration = 300f;
+2
View File
@@ -51,6 +51,8 @@ internal static class LocateArrow
/// <param name="locate"></param>
public static void Add(byte seer, Vector3 locate)
{
if (Main.PlayerStates.TryGetValue(seer, out var state) && state.SubRoles.Contains(CustomRoles.Blind)) return;
ArrowInfo arrowInfo = new(seer, locate);
if (!LocateArrows.Any(a => a.Key.Equals(arrowInfo)))
+2
View File
@@ -51,6 +51,8 @@ internal static class TargetArrow
/// <param name="target"></param>
public static void Add(byte seer, byte target)
{
if (Main.PlayerStates.TryGetValue(seer, out var state) && state.SubRoles.Contains(CustomRoles.Blind)) return;
ArrowInfo arrowInfo = new(seer, target);
if (!TargetArrows.Any(a => a.Key.Equals(arrowInfo)))
+3
View File
@@ -899,6 +899,7 @@ public static class Utils
case CustomRoles.Phantasm:
if (forRecompute) hasTasks = false;
break;
case CustomRoles.Pawn:
case CustomRoles.Cherokious:
case CustomRoles.Crewpostor:
case CustomRoles.Hypocrite:
@@ -1121,6 +1122,7 @@ public static class Utils
CustomRoles.Hypocrite => Color.red,
CustomRoles.Crewpostor => Color.red,
CustomRoles.Cherokious => GetRoleColor(CustomRoles.Cherokious),
CustomRoles.Pawn => GetRoleColor(CustomRoles.Pawn),
_ => normalColor
};
}
@@ -3444,6 +3446,7 @@ public static class Utils
CustomRoles.Hypocrite => Color.red,
CustomRoles.Crewpostor => Color.red,
CustomRoles.Cherokious => GetRoleColor(CustomRoles.Cherokious),
CustomRoles.Pawn => GetRoleColor(CustomRoles.Cherokious),
_ => normalColor
};
}
+22 -1
View File
@@ -200,7 +200,9 @@ internal static class ChatCommands
new(["fix", "blackscreenfix", "fixblackscreen", "ф", "исправить", "修复"], "{id}", GetString("CommandDescription.Fix"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InGame, FixCommand, true, false, [GetString("CommandArgs.Fix.Id")]),
new(["xor", "异或命令"], "{role} {role}", GetString("CommandDescription.XOR"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, XORCommand, true, false, [GetString("CommandArgs.XOR.Role"), GetString("CommandArgs.XOR.Role")]),
new(["ci", "chemistinfo", "химик", "化学家"], "", GetString("CommandDescription.ChemistInfo"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, ChemistInfoCommand, true, false),
new(["forge"], "{id} {role}", GetString("CommandDescription.Forge"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ForgeCommand, true, true, [GetString("CommandArgs.Forge.Id"), GetString("CommandArgs.Forge.Role")]),
new(["choose", "pick", "выбрать", "选择", "escolher"], "{role}", GetString("CommandDescription.Choose"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ChooseCommand, true, true, [GetString("CommandArgs.Choose.Role")]),
// Commands with action handled elsewhere
new(["shoot", "guess", "bet", "bt", "st", "угадать", "бт", "猜测", "赌", "adivinhar"], "{id} {role}", GetString("CommandDescription.Guess"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Guess.Id"), GetString("CommandArgs.Guess.Role")]),
new(["tl", "sp", "jj", "trial", "суд", "засудить", "审判", "判", "julgar"], "{id}", GetString("CommandDescription.Trial"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Trial.Id")]),
@@ -384,6 +386,23 @@ internal static class ChatCommands
// ---------------------------------------------------------------------------------------------------------------------------------------------
private static void ChooseCommand(PlayerControl player, string text, string[] args)
{
if (!AmongUsClient.Instance.AmHost)
{
RequestCommandProcessingFromHost(nameof(ChooseCommand), text);
return;
}
if (!player.IsAlive() || !player.Is(CustomRoles.Pawn) || !player.AllTasksCompleted()) return;
if (args.Length < 2 || !GetRoleByName(string.Join(' ', args[1..]), out var role) || role.GetMode() == 0) return;
if (!player.IsLocalPlayer()) ChatManager.SendPreviousMessagesToAll();
player.RpcSetCustomRole(role);
player.RpcChangeRoleBasis(role);
}
private static void ForgeCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
@@ -397,6 +416,8 @@ internal static class ChatCommands
if (!player.IsAlive() || !player.Is(CustomRoles.Forger) || player.GetAbilityUseLimit() < 1) return;
if (args.Length < 3 || !GuessManager.MsgToPlayerAndRole(text[6..], out byte targetId, out CustomRoles forgeRole, out _)) return;
if (!player.IsLocalPlayer()) ChatManager.SendPreviousMessagesToAll();
Forger.Forges[targetId] = forgeRole;
player.RpcRemoveAbilityUse();
+12
View File
@@ -2433,6 +2433,8 @@
"CommandDescription.Fix": "Fixes the black screen bug for a specific player.",
"CommandDescription.XOR": "Specify 2 roles that will never spawn in the same game.",
"CommandDescription.ChemistInfo": "Show all processes available for the Chemist role.",
"CommandDescription.Forge": "As the Forger, forge a fake role for a player.",
"CommandDescription.Choose": "Choose your role as the Pawn after completing all tasks.",
"CommandArgs.ChangeSetting.Name": "The setting's name to change (leave blank to view all settings)",
"CommandArgs.ChangeSetting.UnknownValue": "(leave blank to view what to put here)",
"CommandArgs.Rename.Name": "Your new name",
@@ -2511,6 +2513,9 @@
"CommandArgs.DraftDescription.Index": "The number in the drafting message of the role to view the description of",
"CommandArgs.Fix.Id": "The player's ID to fix the black screen bug for",
"CommandArgs.XOR.Role": "A main role that will never spawn in the same game with the other role",
"CommandArgs.Forge.Id": "The player's ID to forge a fake role for",
"CommandArgs.Forge.Role": "The fake role to forge",
"CommandArgs.Choose.Role": "The role to choose",
"Commands.ChangeSettingHelp": "<b><u>Arguments:</u></b><size=70%>\\n- map (theskeld/mirahq/polus/dlekseht/airship/thefungle/custom)\\n- impostors (number)\\n- players (number)\\n- recommended (on/off)\\n- confirmejects (on/off)\\n- emergencymeetings (number)\\n- anonymousvotes (on/off)\\n- emergencycooldown (number)\\n- discussiontime (number)\\n- votingtime (number)\\n- playerspeed (float)\\n- crewmatevision (float)\\n- impostorvision (float)\\n- killcooldown (float)\\n- killdistance (short/medium/long/custom)\\n- taskbarupdates (always/meetings/never)\\n- visualtasks (on/off)\\n- commontasks (number)\\n- longtasks (number)\\n- shorttasks (number)\\n- scientistcount (number)\\n- scientistchance (number)\\n- vitalsdisplaycooldown (float)\\n- batteryduration (float)\\n- engineercount (number)\\n- engineerchance (number)\\n- ventusecooldown (float)\\n- maxtimeinvents (float)\\n- guardianangelcount (number)\\n- guardianangelchance (number)\\n- protectcooldown (float)\\n- protectduration (float)\\n- protectvisibletoimpostors (on/off)\\n- shapeshiftercount (number)\\n- shapeshifterchance (number)\\n- shapeshiftduration (float)\\n- shapeshiftcooldown (float)\\n- leaveshapeshiftevidence (on/off)\\n- phantomcount (number)\\n- phantomchance (number)\\n- inviscooldown (float)\\n- invisduration (float)\\n- noisemakercount (number)\\n- noisemakerchance (number)\\n- noisemakerimpostoralert (on/off)\\n- noisemakeralertduration (number)\\n- trackercount (number)\\n- trackerchance (number)\\n- trackduration (float)\\n- trackcooldown (float)\\n- trackdelay (float)\\n- ghostdotasks (on/off)\\n\\n<u><b>Notes:</b></u>\\n1. Upper and lowercase matters\\n2. Where it says custom, you obviously put a number argument after it\\n3. A float is a single precision floating number, like 1.7\\n4. \"ghostdotasks\" causes issues if you set it\\n5. Example uses:\\n - \"/cs map polus\"\\n - \"/cs killdistance custom 4\"\\n - \"/cs trackdelay 1,7\"\\n - \"/cs confirmejects on\"",
"AddTagSuccess": "<#00ffa5>✓</color> Suceessfully created the tag {0} for {1}. If you want to change it, just use this command again and it will override the current tag. To delete it, simply type <#00a5ff>/deletetag {2}</color>!",
"DeleteTagSuccess": "<#00ffa5>✓</color> Successfully deleted {0}'s tag.",
@@ -8927,6 +8932,13 @@
"DazzlerResetDazzledVisionOnDeath": "Reset vision of dazzled players on death/eject",
"DazzleCooldown": "Dazzle Cooldown",
"DazzleButtonText": "Dazzle",
"Pawn": "Pawn",
"PawnInfo": "Complete Tasks Then Pick Your Role",
"PawnInfoLong": "(Neutrals):\\nAs the Pawn, you must complete all of your tasks, then use <b>/choose {role}</b> to pick your role.\\n\\n(Replace {role} with the name of the role that you want to become.) (You can only choose roles that are enabled.)\\nYou lose if you have this role when the game ends.",
"Blind": "Blind",
"BlindInfo": "You Can't See Arrows",
"BlindInfoLong": "(Add-ons):\\nYou cannot see any arrows towards dead bodies and players.",
"Prefix.Blind": "Blind",
"Forger": "Forger",
"ForgerInfo": "Forge Others' Roles",
"ForgerInfoLong": "(Impostors):\\nAs the Forger, you can use <b>/forge {id} {role}</b> to change the specified player's role to the one you specifed after they die. Note that this will only be visual, the player will keep their actual role technically.",
+11
View File
@@ -0,0 +1,11 @@
namespace EHR.AddOns.Common;
public class Blind : IAddon
{
public AddonTypes Type => AddonTypes.Harmful;
public void SetupCustomOption()
{
Options.SetupAdtRoleOptions(651600, CustomRoles.Blind, canSetNum: true, teamSpawnOptions: true);
}
}
+24
View File
@@ -0,0 +1,24 @@
namespace EHR.Neutral;
public class Pawn : RoleBase
{
public static bool On;
public override bool IsEnable => On;
public override void SetupCustomOption()
{
StartSetup(651500)
.CreateOverrideTasksData();
}
public override void Init()
{
On = false;
}
public override void Add(byte playerId)
{
On = true;
}
}