From 6199e55110609cebce00a296769257cf05e173ee Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 1 Apr 2026 21:30:19 -0500 Subject: [PATCH] Add Guardian Angel protection checks --- MiraAPI/Networking/CustomMurderRpc.cs | 7 ++++++- MiraAPI/Utilities/Extensions.cs | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/MiraAPI/Networking/CustomMurderRpc.cs b/MiraAPI/Networking/CustomMurderRpc.cs index d31e185..0a31cf1 100644 --- a/MiraAPI/Networking/CustomMurderRpc.cs +++ b/MiraAPI/Networking/CustomMurderRpc.cs @@ -93,7 +93,12 @@ public static class CustomMurderRpc beforeMurderEvent.Cancel(); } - if (beforeMurderEvent.IsCancelled) + if (target.ProtectedByGa()) + { + beforeMurderEvent.Cancel(); + murderResultFlags = MurderResultFlags.FailedProtected; + } + else if (beforeMurderEvent.IsCancelled) { murderResultFlags = MurderResultFlags.FailedError; } diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 70f8c15..c45e4b2 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -156,6 +156,16 @@ public static class Extensions return TutorialManager.InstanceExists || AmongUsClient.Instance.HostId == playerControl.OwnerId; } + /// + /// Checks if a PlayerControl is protected by a Guardian Angel. + /// + /// The player you're checking for. + /// If the player is protected, true, else false. + public static bool ProtectedByGa(this PlayerControl playerControl) + { + return playerControl.protectedByGuardianId > -1; + } + /// /// Used to convert a System.Collections.Generic.List to Il2cppSystem. ///