Skip to content

Commit

Permalink
Merge pull request #56 from impostor4291/overseer-narc
Browse files Browse the repository at this point in the history
Make Narc appear as Sheriff to Overseer
  • Loading branch information
impostor4291 authored Jan 17, 2025
2 parents cb37dd4 + 38547f6 commit e54450b
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 24 deletions.
3 changes: 1 addition & 2 deletions Modules/ExtendedPlayerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ public static bool KnowRoleTarget(PlayerControl seer, PlayerControl target)
else if (target.GetRoleClass().KnowRoleTarget(seer, target) && !Main.PlayerStates[seer.PlayerId].IsNecromancer && !Main.PlayerStates[target.PlayerId].IsNecromancer) return true;
else if (seer.GetRoleClass().KnowRoleTarget(seer, target) && !Main.PlayerStates[seer.PlayerId].IsNecromancer && !Main.PlayerStates[target.PlayerId].IsNecromancer) return true;
else if (Solsticer.OtherKnowSolsticer(target)) return true;
else if (Overseer.IsRevealedPlayer(seer, target) && !(target.Is(CustomRoles.Trickster) && (!target.Is(CustomRoles.Narc) || seer.Is(CustomRoles.Madmate)))) return true;
else if (Overseer.IsRevealedPlayer(seer, target) && !target.Is(CustomRoles.Trickster) && (!target.Is(CustomRoles.Narc) || seer.Is(CustomRoles.Madmate))) return true;
else if (Gravestone.EveryoneKnowRole(target)) return true;
else if (Mimic.CanSeeDeadRoles(seer, target)) return true;
else if (Workaholic.OthersKnowWorka(target)) return true;
Expand Down Expand Up @@ -1334,7 +1334,6 @@ public static bool ShowSubRoleTarget(this PlayerControl seer, PlayerControl targ
else if (Options.ImpsCanSeeEachOthersAddOns.GetBool() && seer.CheckMMCanSeeImp() && !seer.Is(CustomRoles.Narc) && target.CheckMMCanSeeImp() && !subRole.IsBetrayalAddon()) return true;
else if (Options.CovenCanSeeEachOthersAddOns.GetBool() && seer.Is(Custom_Team.Coven) && target.Is(Custom_Team.Coven) && !subRole.IsBetrayalAddon()) return true;
else if (Options.ApocCanSeeEachOthersAddOns.GetBool() && seer.IsNeutralApocalypse() && target.IsNeutralApocalypse() && !subRole.IsBetrayalAddon()) return true;
else if (Overseer.IsRevealedPlayer(seer, target) && subRole == CustomRoles.Narc && !seer.Is(CustomRoles.Madmate)) return true;

else if ((subRole is CustomRoles.Madmate
or CustomRoles.Sidekick
Expand Down
24 changes: 18 additions & 6 deletions Modules/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2171,25 +2171,37 @@ public static Task DoNotifyRoles(PlayerControl SpecifySeer = null, PlayerControl
string TargetRoleText = KnowRoleTarget
? $"<size={fontSize}>{seer.GetDisplayRoleAndSubName(target, false)}{GetProgressText(target)}</size>\r\n" : "";

string BlankRT = string.Empty;

if (seer.IsAlive() && Overseer.IsRevealedPlayer(seer, target) && target.Is(CustomRoles.Trickster) && (!target.Is(CustomRoles.Narc) || seer.Is(CustomRoles.Madmate)))
{
TargetRoleText = Overseer.GetRandomRole(seer.PlayerId); // Random trickster role
TargetRoleText += TaskState.GetTaskState(); // Random task count for revealed trickster
BlankRT = Overseer.GetRandomRole(seer.PlayerId); // Random trickster role
BlankRT += TaskState.GetTaskState(); // Random task count for revealed trickster
TargetRoleText = $"<size={fontSize}>{BlankRT}</size>";
}
if (seer.IsAlive() && Overseer.IsRevealedPlayer(seer, target) && target.Is(CustomRoles.Narc) && !seer.Is(CustomRoles.Madmate))
{
BlankRT = ColorString(GetRoleColor(CustomRoles.Sheriff), GetString(CustomRoles.Sheriff.ToString())); //Sheriff
if (Sheriff.ShowShotLimit.GetBool())
BlankRT += ColorString(GetRoleColor(CustomRoles.Sheriff).ShadeColor(0.25f), $"({Sheriff.ShotLimitOpt.GetInt()})"); // Sheriff progress text
TargetRoleText = $"<size={fontSize}>{BlankRT}</size>";
}
// Same thing as Trickster but for Illusioned Coven
if (seer.IsAlive() && Overseer.IsRevealedPlayer(seer, target) && Illusionist.IsCovIllusioned(target.PlayerId))
{
TargetRoleText = Overseer.GetRandomRole(seer.PlayerId);
TargetRoleText += TaskState.GetTaskState();
BlankRT = Overseer.GetRandomRole(seer.PlayerId);
BlankRT += TaskState.GetTaskState();
TargetRoleText = $"<size={fontSize}>{BlankRT}</size>";
}
if (seer.IsAlive() && Overseer.IsRevealedPlayer(seer, target) && Illusionist.IsNonCovIllusioned(target.PlayerId))
{
var randomRole = CustomRolesHelper.AllRoles.Where(role => role.IsEnable() && !role.IsAdditionRole() && role.IsCoven()).ToList().RandomElement();
TargetRoleText = ColorString(GetRoleColor(randomRole), GetString(randomRole.ToString()));
BlankRT = ColorString(GetRoleColor(randomRole), GetString(randomRole.ToString()));
if (randomRole is CustomRoles.CovenLeader or CustomRoles.Jinx or CustomRoles.Illusionist or CustomRoles.VoodooMaster) // Roles with Ability Uses
{
TargetRoleText += randomRole.GetStaticRoleClass().GetProgressText(target.PlayerId, false);
BlankRT += randomRole.GetStaticRoleClass().GetProgressText(target.PlayerId, false);
}
TargetRoleText = $"<size={fontSize}>{BlankRT}</size>";
}

// ====== Target player name ======
Expand Down
25 changes: 18 additions & 7 deletions Patches/MeetingHudPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,25 +1145,36 @@ public static void Postfix(MeetingHud __instance)
var myRole = PlayerControl.LocalPlayer.GetRoleClass();
var enable = true;

string BlankRT = string.Empty;

if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, pc) && pc.Is(CustomRoles.Trickster) && (!pc.Is(CustomRoles.Narc) || PlayerControl.LocalPlayer.Is(CustomRoles.Madmate)))
{
roleTextMeeting.text = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId); // random role for revealed trickster
roleTextMeeting.text += TaskState.GetTaskState(); // Random task count for revealed trickster
//enable = false;
BlankRT = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId); // random role for revealed trickster
BlankRT += TaskState.GetTaskState(); // Random task count for revealed trickster
roleTextMeeting.text = $"<size={roleTextMeeting.fontSize}>{BlankRT}</size>";
}
if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, pc) && pc.Is(CustomRoles.Narc) && !PlayerControl.LocalPlayer.Is(CustomRoles.Madmate))
{
BlankRT = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Sheriff), GetString(CustomRoles.Sheriff.ToString())); //Sheriff
if (Sheriff.ShowShotLimit.GetBool())
BlankRT += Utils.ColorString(Utils.GetRoleColor(CustomRoles.Sheriff).ShadeColor(0.25f), $"({Sheriff.ShotLimitOpt.GetInt()})"); // Sheriff progress text
roleTextMeeting.text = $"<size={roleTextMeeting.fontSize}>{BlankRT}</size>";
}
if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, pc) && Illusionist.IsCovIllusioned(pc.PlayerId))
{
roleTextMeeting.text = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId);
roleTextMeeting.text += TaskState.GetTaskState();
BlankRT = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId);
BlankRT += TaskState.GetTaskState();
roleTextMeeting.text = $"<size={roleTextMeeting.fontSize}>{BlankRT}</size>";
}
if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, pc) && Illusionist.IsNonCovIllusioned(pc.PlayerId))
{
var randomRole = CustomRolesHelper.AllRoles.Where(role => role.IsEnable() && !role.IsAdditionRole() && role.IsCoven()).ToList().RandomElement();
roleTextMeeting.text = ColorString(GetRoleColor(randomRole), GetString(randomRole.ToString()));
BlankRT = ColorString(GetRoleColor(randomRole), GetString(randomRole.ToString()));
if (randomRole.GetStaticRoleClass().IsMethodOverridden("GetProgressText")) // Roles with Ability Uses
{
roleTextMeeting.text += randomRole.GetStaticRoleClass().GetProgressText(PlayerControl.LocalPlayer.PlayerId, false);
BlankRT += randomRole.GetStaticRoleClass().GetProgressText(PlayerControl.LocalPlayer.PlayerId, false);
}
roleTextMeeting.text = $"<size={roleTextMeeting.fontSize}>{BlankRT}</size>";
}

var suffixBuilder = new StringBuilder(32);
Expand Down
28 changes: 22 additions & 6 deletions Patches/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,24 +1316,40 @@ public static Task DoPostfix(PlayerControl __instance)
else if (ExtendedPlayerControl.KnowRoleTarget(PlayerControl.LocalPlayer, __instance)) RoleText.enabled = true;
else RoleText.enabled = false;

string BlankRT = string.Empty;

if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, __instance) && __instance.Is(CustomRoles.Trickster) && (!__instance.Is(CustomRoles.Narc) || PlayerControl.LocalPlayer.Is(CustomRoles.Madmate)))
{
RoleText.text = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId); // random role for revealed trickster
RoleText.text += TaskState.GetTaskState(); // random task count for revealed trickster
RoleText.enabled = true; //have to make it return true otherwise modded Overseer won't be able to reveal Trickster's role,same for Illusionist's targets
BlankRT = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId); // random role for revealed trickster
BlankRT += TaskState.GetTaskState(); // random task count for revealed trickster
RoleText.text = $"<size=1.4>{BlankRT}</size>";
}
if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, __instance) && __instance.Is(CustomRoles.Narc) && !PlayerControl.LocalPlayer.Is(CustomRoles.Madmate))
{
RoleText.enabled = true;
BlankRT = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Sheriff), GetString(CustomRoles.Sheriff.ToString())); //Sheriff
if (Sheriff.ShowShotLimit.GetBool())
BlankRT += Utils.ColorString(Utils.GetRoleColor(CustomRoles.Sheriff).ShadeColor(0.25f), $"({Sheriff.ShotLimitOpt.GetInt()})"); // Sheriff progress text
RoleText.text = $"<size=1.4>{BlankRT}</size>";
}
if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, __instance) && Illusionist.IsCovIllusioned(__instance.PlayerId))
{
RoleText.text = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId);
RoleText.text += TaskState.GetTaskState();
RoleText.enabled = true;
BlankRT = Overseer.GetRandomRole(PlayerControl.LocalPlayer.PlayerId);
BlankRT += TaskState.GetTaskState();
RoleText.text = $"<size=1.4>{BlankRT}</size>";
}
if (!PlayerControl.LocalPlayer.Data.IsDead && Overseer.IsRevealedPlayer(PlayerControl.LocalPlayer, __instance) && Illusionist.IsNonCovIllusioned(__instance.PlayerId))
{
RoleText.enabled = true;
var randomRole = CustomRolesHelper.AllRoles.Where(role => role.IsEnable() && !role.IsAdditionRole() && role.IsCoven()).ToList().RandomElement();
RoleText.text = Utils.ColorString(Utils.GetRoleColor(randomRole), GetString(randomRole.ToString()));
BlankRT = Utils.ColorString(Utils.GetRoleColor(randomRole), GetString(randomRole.ToString()));
if (randomRole is CustomRoles.CovenLeader or CustomRoles.Jinx or CustomRoles.Illusionist or CustomRoles.VoodooMaster) // Roles with Ability Uses
{
RoleText.text += randomRole.GetStaticRoleClass().GetProgressText(PlayerControl.LocalPlayer.PlayerId, false);
BlankRT += randomRole.GetStaticRoleClass().GetProgressText(PlayerControl.LocalPlayer.PlayerId, false);
}
RoleText.text = $"<size=1.4>{BlankRT}</size>";
}


Expand Down
2 changes: 1 addition & 1 deletion Roles/Crewmate/Overseer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public override void OnReportDeadBody(PlayerControl reporter, NetworkedPlayerInf
//string roleName = GetRoleName(randomRole);
string RoleText = ColorString(GetRoleColor(randomRole), GetString(randomRole.ToString()));

return $"<size={1.5}>{RoleText}</size>";
return RoleText;
}

public override string GetMark(PlayerControl seer, PlayerControl seen = null, bool isForMeeting = false)
Expand Down
4 changes: 2 additions & 2 deletions Roles/Crewmate/Sheriff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ internal class Sheriff : RoleBase

private static OptionItem KillCooldown;
private static OptionItem MisfireKillsTarget;
private static OptionItem ShotLimitOpt;
private static OptionItem ShowShotLimit;
public static OptionItem ShotLimitOpt;
public static OptionItem ShowShotLimit;
private static OptionItem CanKillAllAlive;
private static OptionItem CanKillCoven;
private static OptionItem MisfireOnAdmired;
Expand Down

0 comments on commit e54450b

Please sign in to comment.