Add Focused

This commit is contained in:
Gurge44 committed 2026-07-13 10:14:04 +02:00
1 parent 04e2c02b9b
commit 32c39d2c31
16 files changed
+46 -22

No files matched your search

+2 -1
View File
@@ -566,8 +566,9 @@ public enum CustomRoles
Facilitator, // Ghost role
Finder,
Flash,
Fragile,
Focused,
Fool,
Fragile,
Giant,
Glow,
Gravestone,
+2 -1
View File
@@ -566,8 +566,9 @@ public enum CustomRoles
Facilitator, // Ghost role
Finder,
Flash,
Fragile,
Focused,
Fool,
Fragile,
Giant,
Glow,
Gravestone,
+2 -2
View File
@@ -888,9 +888,9 @@ public static class RoomRush
try
{
Main.CachedAllPlayerControls().Do(x => LocateArrow.RemoveAllTarget(x.PlayerId));
Main.CachedAllPlayerControls().ForEach(x => LocateArrow.RemoveAllTarget(x.PlayerId));
Vector2 goalPos = RoomGoal.GetRoomClass().transform.position;
if (DisplayArrowToRoom.GetBool()) Main.CachedAllPlayerControls().Do(x => LocateArrow.Add(x.PlayerId, goalPos));
if (DisplayArrowToRoom.GetBool()) Main.CachedAllPlayerControls().ForEach(x => LocateArrow.Add(x.PlayerId, goalPos));
}
catch (Exception e) { Utils.ThrowException(e); }
+1
View File
@@ -762,6 +762,7 @@ public class Main : BasePlugin
{ CustomRoles.Listener, "#060270" },
{ CustomRoles.Unbound, "#DFC57B" },
{ CustomRoles.AntiTP, "#fcba03" },
{ CustomRoles.Focused, "#A10E49" },
{ CustomRoles.Dizzy, "#de97a7" },
{ CustomRoles.Entombed, "#8c71de" },
{ CustomRoles.Urgent, "#D49255" },
+1
View File
@@ -1958,6 +1958,7 @@ internal static class CustomRolesHelper
CustomRoles.Reach when (pc.GetCustomRole() is CustomRoles.Mafioso or CustomRoles.Evolver or CustomRoles.Berserker) || pc.Is(CustomRoles.Constricted) => false,
CustomRoles.Constricted when (pc.GetCustomRole() is CustomRoles.Mafioso or CustomRoles.Evolver or CustomRoles.Berserker) || pc.Is(CustomRoles.Reach) => false,
CustomRoles.Beartrap when pc.Is(CustomRoles.GuardianAngelEHR) => false,
CustomRoles.Focused when pc.GetRoleTypes() is not (RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper) => false,
CustomRoles.Dizzy when pc.GetRoleTypes() is not (RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper) => false,
CustomRoles.Reach when pc.GetRoleTypes() is not (RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper) => false,
CustomRoles.Constricted when pc.GetRoleTypes() is not (RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper) => false,
+2
View File
@@ -1826,6 +1826,8 @@ internal static class ExtendedPlayerControl
public void BeartrapKilled(PlayerControl target)
{
if (player.Is(CustomRoles.Focused)) return;
Logger.Info($"{target?.Data?.PlayerName} was Beartrap", "Beartrap");
float tmpSpeed = Main.AllPlayerSpeed[player.PlayerId];
Main.AllPlayerSpeed[player.PlayerId] = Main.MinSpeed;
@@ -659,7 +659,7 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
if (player.Is(CustomRoles.Bloodlust) && Bloodlust.HasImpVision.GetBool()) opt.SetVision(true);
if (Main.AllAlivePlayerControlsToList.Any(x => x.Is(CustomRoles.Bewilder) && !x.IsAlive() && x.GetRealKiller()?.PlayerId == player.PlayerId && !x.Is(CustomRoles.Hangman)))
if (!player.Is(CustomRoles.Focused) && Main.CachedAllPlayerControls().Exists(x => x.Is(CustomRoles.Bewilder) && !x.IsAlive() && x.GetRealKiller()?.PlayerId == player.PlayerId && !x.Is(CustomRoles.Hangman)))
{
opt.SetVision(false);
opt.SetFloat(FloatOptionNames.CrewLightMod, Options.BewilderVision.GetFloat());
+1 -1
View File
@@ -39,7 +39,7 @@ static class StartRpcImmediatelyPatch
public static void Postfix(uint targetNetId, byte callId, SendOption option, int targetClientId = -1)
{
if (callId is 21 or 44 or 45 or 104) return;
Logger.Info($"Starting RPC: {callId} ({RPC.GetRpcName(callId)}) as {Main.CachedAllPlayerControls().FirstOrDefault(x => x.NetId == targetNetId)?.GetRealName() ?? targetNetId.ToString()} with SendOption {option} to {Utils.GetClientById(targetClientId)?.Character?.GetRealName() ?? targetClientId.ToString()}", "StartRpcImmediately");
Logger.Info($"Starting RPC: {callId} ({RPC.GetRpcName(callId)}) as {Main.CachedAllPlayerControls().Find(x => x.NetId == targetNetId)?.GetRealName() ?? targetNetId.ToString()} with SendOption {option} to {Utils.GetClientById(targetClientId)?.Character?.GetRealName() ?? targetClientId.ToString()}", "StartRpcImmediately");
}
}
+12 -9
View File
@@ -194,16 +194,19 @@ internal static class CheckMurderPatch
TimeSinceLastKill[killer.PlayerId] = 0f;
if (target.Is(CustomRoles.Diseased))
if (!killer.Is(CustomRoles.Focused))
{
if (!Main.KilledDiseased.TryAdd(killer.PlayerId, 1))
Main.KilledDiseased[killer.PlayerId] += 1;
}
if (target.Is(CustomRoles.Diseased))
{
if (!Main.KilledDiseased.TryAdd(killer.PlayerId, 1))
Main.KilledDiseased[killer.PlayerId] += 1;
}
if (target.Is(CustomRoles.Antidote))
{
if (!Main.KilledAntidote.TryAdd(killer.PlayerId, 1))
Main.KilledAntidote[killer.PlayerId] += 1;
if (target.Is(CustomRoles.Antidote))
{
if (!Main.KilledAntidote.TryAdd(killer.PlayerId, 1))
Main.KilledAntidote[killer.PlayerId] += 1;
}
}
killer.ResetKillCooldown(false);
@@ -761,7 +764,7 @@ internal static class MurderPlayerPatch
if (killer.AmOwner && Main.PlayerStates.TryGetValue(killer.PlayerId, out var ks) && ks.GetKillCount() <= 1)
Achievements.Type.OhNo.CompleteAfterGameEnd();
if (target != killer && !killer.Is(CustomRoles.KillingMachine) && (killer.PlayerId != target.PlayerId || target.GetRealKiller()?.GetCustomRole() is CustomRoles.Swooper or CustomRoles.Wraith || !killer.Is(CustomRoles.Oblivious) || !Options.ObliviousBaitImmune.GetBool()))
if (target != killer && !killer.Is(CustomRoles.KillingMachine) && !killer.Is(CustomRoles.Focused) && (killer.PlayerId != target.PlayerId || target.GetRealKiller()?.GetCustomRole() is CustomRoles.Swooper or CustomRoles.Wraith || !killer.Is(CustomRoles.Oblivious) || !Options.ObliviousBaitImmune.GetBool()))
{
killer.RPCPlayCustomSound("Congrats");
target.RPCPlayCustomSound("Congrats");
+4
View File
@@ -149,6 +149,7 @@
"Prefix.Facilitator": "Facilitator",
"Prefix.Finder": "Finder",
"Prefix.Flash": "Flash",
"Prefix.Focused": "Focused",
"Prefix.Fool": "Fool",
"Prefix.Fragile": "Fragile",
"Prefix.GA": "Guardian Angel",
@@ -3737,6 +3738,9 @@
"FlashInfo": "You're faster",
"FlashInfoLong": "(Add-ons):\\nThe Flash is faster by default.",
"FlashSpeed": "<color=#ff8400>Flash</color> Speed",
"Focused": "Focused",
"FocusedInfo": "You Bypass On-Death Effects",
"FocusedInfoLong": "(Add-ons):\\nAs a Focused player, you aren't affected by on-death effects, such as Bane, Bewilder, Beartrap, etc.",
"Fool": "Fool",
"FoolInfo": "You can't fix lights & comms",
"FoolInfoLong": "(Add-ons):\\nYou can't fix Lights and Comms sabotages. Note: Technician can't be Fool.",
+11
View File
@@ -0,0 +1,11 @@
namespace EHR.Roles;
public class Focused : IAddon
{
public AddonTypes Type => AddonTypes.Mixed;
public void SetupCustomOption()
{
Options.SetupAdtRoleOptions(659400, CustomRoles.Focused, canSetNum: true, teamSpawnOptions: true);
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ internal class Stained : IAddon
public static void OnDeath(PlayerControl pc, PlayerControl killer)
{
if (!killer || !pc || pc.PlayerId == killer.PlayerId || !killer.IsAlive() || !GameStates.IsInTask) return;
if (!killer || !pc || pc.PlayerId == killer.PlayerId || !killer.IsAlive() || killer.Is(CustomRoles.Focused) || !GameStates.IsInTask) return;
VioletNameList ??= [];
VioletNameList.Add(killer.PlayerId);
@@ -26,7 +26,7 @@ internal class Demolitionist : RoleBase
public static void OnDeath(PlayerControl killer, PlayerControl target)
{
if (killer == null || target == null || killer.PlayerId == target.PlayerId || !killer.IsAlive() || !GameStates.IsInTask) return;
if (!killer || !target || killer.PlayerId == target.PlayerId || !killer.IsAlive() || killer.Is(CustomRoles.Focused) || !GameStates.IsInTask) return;
string warningMark = Utils.ColorString(Color.yellow, "\u26a0");
killer.Notify($"{warningMark} {CustomRoles.Demolitionist.ColoredTextByRole(Translator.GetString("OnDemolitionistDead"))} {warningMark}");
+1 -1
View File
@@ -22,7 +22,7 @@ public class Bane : RoleBase
public static void OnKilled(PlayerControl killer)
{
if (killer == null || killer.Is(CustomRoles.Bloodlust)) return;
if (!killer || killer.Is(CustomRoles.Bloodlust) || killer.Is(CustomRoles.Focused)) return;
CustomRoles erasedRole = killer.IsImpostor() ? CustomRoles.ImpostorEHR : killer.IsCrewmate() ? CustomRoles.CrewmateEHR : killer.Is(Team.Coven) ? CustomRoles.CovenMember : CustomRoles.Amnesiac;
killer.RpcSetCustomRole(erasedRole);
+3 -3
View File
@@ -225,18 +225,18 @@ public class Medic : RoleBase
killer.SetKillCooldown(ResetCooldown.GetFloat());
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
var medics = Main.CachedAllPlayerControls().Where(x => PlayerIdList.Contains(x.PlayerId) && x.IsAlive()).ToArray();
var medics = Main.CachedAllPlayerControls().FindAll(x => PlayerIdList.Contains(x.PlayerId) && x.IsAlive());
switch (KnowShieldBroken.GetInt())
{
case 0:
target.RpcGuardAndKill();
medics.Do(x => x.KillFlash());
medics.ForEach(x => x.KillFlash());
medics.NotifyPlayers(Translator.GetString("MedicKillerTryBrokenShieldTargetForMedic"));
Main.CachedAllPlayerControls().Where(x => ProtectList.Contains(x.PlayerId)).NotifyPlayers(Translator.GetString("MedicKillerTryBrokenShieldTargetForTarget"));
break;
case 1:
medics.Do(x => x.KillFlash());
medics.ForEach(x => x.KillFlash());
medics.NotifyPlayers(Translator.GetString("MedicKillerTryBrokenShieldTargetForMedic"));
break;
case 2:
@@ -49,7 +49,7 @@ public class Fakeshifter : RoleBase
if (MarkedId == byte.MaxValue && target.IsAlive())
{
MarkedId = target.PlayerId;
PlayerControl randomPlayer = Main.CachedAlivePlayerControls().Without(target).RandomElement();
PlayerControl randomPlayer = Main.CachedAlivePlayerControls().FindAll(x => x.PlayerId != target.PlayerId).RandomElement();
bool hasValue = false;
CustomRpcSender sender = CustomRpcSender.Create("Fakeshifter", SendOption.Reliable);
sender.StartPackedMessage();